Question

In: Computer Science

In CP/M why are the stack and the heap on opposite ends of memory? Why is...

In CP/M why are the stack and the heap on opposite ends of memory? Why is the OS
at the top of upper memory?

Solutions

Expert Solution

Following is the memory layout of the CP/M:

And in this case, if we see for the memory available for program use is the memory which is used for stack and heap memory and they are expanding in opposite directions.
It is helpful as while running the program we don't know which memory is going to end up first beforehand, so we simply make them expand in opposite directions as we have very limited space of memory. So when they both meet each other which is the significant point when we end up with the free memory which we have.

But the OS here, in this case, is at the top of the memory just as to insure as this is the one which actually contains different programs which are going to be run. So it should be there at the top of the memory to access it easily and the memory required for the programs will be taken from the bottom

If you have any doubts, do let me know in the comment section
Thanks


Related Solutions

C++ Memory Allocation: 1) Write a C++ program that allocates static, stack, & heap memory. Your...
C++ Memory Allocation: 1) Write a C++ program that allocates static, stack, & heap memory. Your program does not need to do anything else.  Indicate via comments where memory for at least one variable in each memory area is allocated. a) Write code that allocates static memory (only include one declaration): b) Write code that allocates stack memory (only include one declaration): c) Write code that allocates heap memory (only include one declaration): 2) Edit the C++ program below to include...
Describe why a stack canary would not be useful against a heap overflow attack.
Describe why a stack canary would not be useful against a heap overflow attack.
What are the different stages of memory in a heap?
What are the different stages of memory in a heap?
A 3.1 kg rod of length 5.1 m has at opposite ends point masses of 4.0...
A 3.1 kg rod of length 5.1 m has at opposite ends point masses of 4.0 kg and 6.0 kg. a)Will the center of mass of this system be nearer to the 4.0-kg mass, nearer to the 6.0-kgmass, or at the center of the rod?    b) Where is the center of mass of the system? (F-net=M[Vcm/t] xCM= (summation of all mass by distance)/system of mass Diagram please, not fully understand the system. getting 5.03m
What is the difference between stack-dynamic and explicit heap-dynamic?  
What is the difference between stack-dynamic and explicit heap-dynamic?  
You and a friend are riding the subway, and sit at opposite ends of the car....
You and a friend are riding the subway, and sit at opposite ends of the car. You both count down from five, and then clap simultaneously, just as the train passes through a station. (It's an express train, so you don't slow down and stop at the station.) According to the predictions of special relativity, what would an observer on the subway platform observe as you passed through the station? Your claps would not be simultaneous. One would occur before...
A 16.6 kg kid & a 28.6 kg kid are at opposite ends of a 2.21...
A 16.6 kg kid & a 28.6 kg kid are at opposite ends of a 2.21 m long 42.7 kg see-saw, with the fulcrum at the center. You want to add a mass of 25 kg to the see-saw to balance it. How far from the smaller kid should you put it, in meters?
If two ends of a rope are pulled with forces of equal magnitude and opposite direction,...
If two ends of a rope are pulled with forces of equal magnitude and opposite direction, the tension at the center of the rope must be zero. True or false? The answer is false. I chose true though and I'm not understanding why. Forces act at the center of mass of the object, so if there are two forces of equal and opposite magnitude, then they should cancel out resulting in zero tension, no?
Lab 3.1 Create your objects in the stack (not on the heap). Add a friend function,...
Lab 3.1 Create your objects in the stack (not on the heap). Add a friend function, kilotopound, which will convert kilograms to pounds. Change your weight mutator to ask whether weight is input in kilograms or pounds. If it is kilograms, call the friend function kilotopound to convert it to pounds and return pounds. There are 2.2 pounds in one kilogram. Create an object on the stack with the following information:     uld – Container abbreviation - AYK uldid –...
Two astronauts on opposite ends of a spaceship are comparing lunches. One has an apple, the...
Two astronauts on opposite ends of a spaceship are comparing lunches. One has an apple, the other has an orange. They decide to trade. Astronaut 1 tosses the 0.125 kg apple toward astronaut 2 with a speed of vi,1 = 1.09 m/s . The 0.160 kg orange is tossed from astronaut 2 to astronaut 1 with a speed of 1.19 m/s . Unfortunately, the fruits collide, sending the orange off with a speed of 0.982 m/s in the negative y...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT