wpe41.gif (23084 bytes)CIS3355: Business Data Structures
Fall, 2008
 

Do we actually know where a piece of datum will be stored in RAM?

First we must ask ourselves, "What is Random Access Memory?". Random Access Memory is the component in the computer where the programs you are working on or the pages on the internet you are viewing are temporarily being stored. If you are working on a particular application, say "Microsoft Word", whatever you typed is being temporarily stored to RAM. Once you finish, you may save it to the hard disk or some other form of medium, ie, floppy disk or you can just print it. In either case, whatever you may have typed is still in RAM, however you do not know where in RAM it was stored. How is that?

 

 

 

Take for instance a large trunk that you may have at home to place stuff which you would like to keep in. Throughout the year, you continue to add more stuff to the trunk and each item you place in the trunk keeps taking up the space that is available and you keep placing more and more stuff in no particular order. RAM works much the same way. The stuff in the trunk is the "Datum" and when it was placed in RAM, the datum was placed in whatever available space was free.

 

 

 

Random Access Memory (RAM) is a type of computer storage whose contents can be accessed in any order. Most RAM memory is stored in chips (integrated circuits ICs) that are found on the motherboard of a computer. Memory chips are normally only available aas part of a card called a module. Below are examples of a SIMM (single in-line memory), a DIMM (dual in-line memory module), and a SODIMM (small outline dual in-line memory module) from top to bottom.

 

 

 

 

 

 

 

 

 

 

Note: If you have ever had to purchase additional RAM for your computer, you had to add an additional memory chip equal to the amount of RAM you already have. In other words, if your computer had 128 megabytes of RAM, you could only install an additional 128 megabytes of RAM for a total of 256 megabytes. If you wanted to again add more RAM memory, you would install an additional 256 megabytes of RAM bringing to the total to 512 megabytes of RAM. 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

RAM consists of many capacitors and transistors. A capacitor and a transistor are paired together to make a memory cell. The capacitor represents one "bit" of data and the transistor is able to change the state of the capacitor to either a 0 or a 1. The zero's and 1's when read in a sequence represent the code which the computer understands. This is called binary data because there are only two states that the capacitor can be in. In order for a capacitor to achieve a value of 1, it needs to be filled with electrons. To achieve value of 0, the capacitor needs to be emptied of electrons.  

There are two kinds of RAM, Dynamic RAM (DRAM) and Static RAM (SDRAM).  In Dynamic RAM, the  capacitors have a problem holding a value of 1 and it has to be constantly refreshed in order to stay in the correct state. For additional information on how this occurs, go to http://www.howstuffworks.com/ram1.htm. Static RAM uses a different technology known a flip-flop in which a memory cell takes any where from four to six transistors and some wiring and never needs to be refreshed. Since Static RAM takes more parts, there is less memory per chip and takes up more space thus making SDRAM more expensive. ( For additional information see How Boolean Logic Works).

 

 

The computer reads the 0's and 1's in sequence either as a character or unsigned character, short, signed or unsigned integer, long integer, long double or a float or any other data type and stores them accordingly with only one requirement. The location where the data is stored must be stored in contiguous bytes of storage as in the following example.

         

 

 

 

    

 

 

 

        If we wanted to store char a = "a", it would be stored:

                                              01100001

                    If we wanted to store short b = 50, it would be stored:

                                        00000000 00110010

                    if we wanted to store int c = 5487, it would be stored:

                         00000000 00000000 00010101 01101111

                                 

             3200

              3201  (a)                              

               3203

            3204

 

       00010011

 

          01100001

 

         111000111

 

        01010100

            3205 (50)

             3206

               3207

            3208

 

        00000000

 

         00110010

 

           11100110

 

         01001110

           3209 (5487)

            3210

              3211

            3212

 

       00000000

 

       00000000

 

            00010101

 

        01101111

          3213

           3214

             3215

           3216

 

       00011110

 

       11010001

 

          01001001

 

        11100100

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Now we can ask ourselves, "Where in RAM will we find location a, b, c? The correct answer would be that we really do not know since address allocations are made at RUN-TIME and are based on available locations, the table above shows the possible locations. RAM will allocate whatever available contiguous locations there are.

Note: The locations in the table that were not used (ie, those not highlighted) are still filled with the locations used by a previous program. They remain there until such time that RAM replaces the contents of those locations.

Questions/Answers

1. How many contiguous bytes/bits of storage would a data type char require?

       a)    16 bits

        b)    8 bits

        c)    2 bytes

        d)    16 bytes

2. Given the following char code, what would be the output?

            char =  nm = '0', ab = 18

            printf("%c %d",nm, ab);

        a)    nm = 48, ab = DC2

        b)    nm = 0, ab = 18

        c)    nm = 60, ab = 22

        d)    nm = 31, ab = 12

3.    Which of the following is true of RAM? 

        a)    Temporary storage 

        b)   Primary storage

        c)    Secondary storage

        d)    All of the above

4.    Can we determine where in RAM a piece of datum is stored?

         a)  Yes

         b)  No

         

Answers:

    1. b

    2. b

    3. a

    4. b

For additional  or detailed information on RAM allocation here are some the sites to look at:

http://www.ece.utexas.edu/~valvano/embed/chap3/chap3.htm

http://www.howstuffworks.com/ram1.htm

http://www.onelook.com