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
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?
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...
In a demolition derby, two cars start from rest at opposite ends of a track. At...
In a demolition derby, two cars start from rest at opposite ends of a track. At exactly the same instant they begin to accelerate towards each other in a straight line. Car A accelerates at a rate of aA = 3.0 m/s2 , while Car B accelerates at a rate of aB = 4.0 m/s2 in the opposite direction. After 6.5 s the cars collide. Please use a coordinate system where Car A is travelling in the positive direction. a)(8...
1. a) Two trumpeters are standing at opposite ends of a large hall, both are playing...
1. a) Two trumpeters are standing at opposite ends of a large hall, both are playing a 440 Hz note. What beat frequency would a person hear if they were waking directly from one trumpeter towards the other one? b) A 10 m long organ pipe has both ends open. Assume that the velocity of sound is 340ms^-1. i) Calculate the fundamental frequency of the organ pipe. ii) What is the fundamental frequency of the pipe of one end is...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT