|
Understanding The Basics Of Computer Memory I N D E X:
Intro For those who may be just entering programming or perhaps even new to computers in general, this tutorial focuses on giving you an overview of how the computer memory works. While we don't need to expects in the field, but by having at least a reasonable understanding of memory, will assist us when programming. The Memory is the part of your computer that information is stored within. It can hold all types of information, from the actual programs we use through to graphics, sounds, text or general data. On a computer with Windows installed, memory is managed by Windows. Thus when Windows runs a program, each program is given or requests a section of memory to use. Then while the program operates, it might request more memory to perhaps store images or sounds in, display text, all sorts of stuff. Then once it's finished using it's memory, it will then frees this memory back to Windows. So other programs can use it. Thus memory is a shared resource. PCs today have a lot of memory chips built into them. This is required as the programs we use get bigger and more complex, as does the quality of graphics and sound. This quality increase (graphics and sound information) takes more memory to store. It's not uncommon for a home computer to have 128 / 256 / 512 or more megabytes of memory today. That's a staggering amount, and probably thousands of the times of the memory capacity used by NASA computers during the moon landing. When a program stores information in memory, this information is broken down and stored in 'BIT' form. A BIT is the smallest piece of memory that can be manipulated. Each Bit has only two numerical states, ON (one) or OFF (zero), so a bit can be thought of as a switch. Obviously you can't store a great deal of information with a single BIT of memory, you'd need thousands of them, in fact millions of them to store programs, images or sounds in. So in it's simplest form, you can think of your computers Memory as nothing more than a huge row of millions of BITS (switches), where each BIT can be turned ON/OFF independently of the others. Example1 - Memory organized as a row of bits Here's a row of bits representing how a small amount of memory might look. A Zero represents a Bit (switch) that is turned OFF and a ONE represents a bit (switch) that is turned ON.
While a BIT might be the smallest piece of information that can be manipulated in a computers memory, it's not very convenient for us or even the computer to work with. So rather than memory being arranged as one giant string of individual bits, memory is organized into groups of eight bits. These groups are called BYTES. When we talk about the memory capacity of a computer it's measured in bytes. In simple terms a Megabyte refers to roughly a million bytes. So a computer that has 128 megabytes of memory, can be thought of as having 128 million individual bytes. Example2 - Memory organized as bytes Here's how we could represent the above memory example (displayed above as bits), but now organized vertically as a bytes (8bits per byte). So each byte is represented as 8 Bits (8 switches...where each bit still has is it's ON/OFF state as before). You'll notice that we still have the same sequence of bits stored, we've just grouped them into bytes now.
The biggest question you're probably asking yourself now, is if a computer has millions of these bytes, how does it, or how do we humans distinguish one byte from another ? The answer is via each bytes ADDRESS. You and think of an Address like an numerical label. Each address is associated with one particular byte and is unique within the computers memory. So by using these addresses, we can specify which byte in memory we'd like to read or store information in. Typically the bytes in a block memory are addressed in ascending order, starting from address zero, and going up (increasing by one) to the size of the block of memory. So if a block of memory has 1000 bytes in it, and it's first byte address is zero, then the second byte will be at address 1, and the third byte at address 2, the forth byte at address 3 and so on.. Example3 - Memory organized as Bytes, with each bytes unique address This example takes the previous byte example further, by adding the unique addresses to the table. The table is a representation of the following format.. So we have the unique memory address on the left and the byte information on the right. UniqueAddress = Byte Information (it's bit data) Example: 5 = 01011010 ; Thus represents that the byte information "01011010" is stored at address 5 in memory.
If you're still a bit confused about how addresses fit into the picture, let's make an analogy. Imagine a street with thousands of houses along it. The individual houses will represent our individual bytes of memory. So within each house (the byte) we can store some information. We can distinguish between houses (bytes) via using each houses street number (it's address).. Most importantly each houses street number (it's address) is assigned an ascending unique number. Now it should be easy to visualize driving down the street and going into the house at street number 100, reading / grabbing the information inside it, then going to the house at street number 345 and storing the information you read previously. Now in computer speak, we'd be reading the byte at memory address 100 and then storing this byte at memory address 345. FACTS:
|
Related Info: | ArrayBasics | Bin$ | Comparisons | CopyMemory | CreateBank | Hex$ | LinkedLists | NamingConventions | ProgramLayout | Variables : |
|
|||||||||||||||||||||||||||||||||||||||
(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com |