Wednesday, 27 March 2013

Structure of RAM and storage of variables during program in RAM

We know that If we execute a program then it goes into RAM and then all operation perform and we get a exe to display the output .So it is very important to know the structure of RAM.Here is a snapshot for Ram structure:-


Here we can see that the RAM have the extra segment at the top of it which has the highest address.Below it there is a stack segment,then data segment ,then code segment and at the lowest ROM section.Thus the ROM section has the lowest address.Now can we can study briefly about all of these  five parts:-

(1) Extra segment:-Extra segment is the topmost part of the RAM.It has the highest address.It stores the far pointers and used for keyboard buffer and video buffer.

(2)Stack segment:-Stack segment have the two main parts:-stack and heap.In Stack memory is allocated towards top to bottom while in heap memory is allocated towards bottom to top manner.We can understand  here with the help of these snap shot that what part of program they contains in program execution:-

                                           
(3)Data segment:-Data segment also have two parts.The first one is bss which stands for block started by symbol and the second one is data.We can understand what kind of data these two parts contains during execution of program with the help of these snapshot:-



(4)Code segment:-Code segment have the program instructions in it mainly contains body of program during program execution.

(5) ROM section:-It mainly stores information about the ram configuration.


Here some important information about default storage class specifier for variables and function is following:-

(1)For external declarations (outside a function) the default storage class specifier will be extern and for internal declarations(inside a function) it will be auto. 

(2)default storage class specifier for functions  is always extern.

No comments:

Post a Comment