Question
Can anyone help me with this with some explanation if possible? Thanks. ./memory 0,0,0,0 produces this output: 0 | 1024 | 1152 | 2176 |
Can anyone help me with this with some explanation if possible? Thanks.
./memory 0,0,0,0 produces this output: 0 | 1024 | 1152 | 2176 | 2192 | 3216 | 3472 | 4496 | 4624 | --------------
Question #1 [5 pts] If invoking the program as
./memory 70,0,0,0
produces this output: 0 | 1024 | 1152 | 2176 | 2192 | 3216 | 3472 | 4496 | 4624 | --------------
The 70-byte chunk was allocated at address 3216
would you conclude that the heap allocator allocates new chunks of RAM at the beginning (i.e., lower addresses) or at the end (i.e., higher addresses) of holes in memory? Why? To explain why just use a contraposition argument (e.g., if the heap allocator did X then Y would happen, but instead Z happens). Whatever the heap allocator does, this is what we assume it does for all subsequent questions.
Question #2 [15 pts] If invoking the program as
./memory 80,20,30,10
produces this output: 0 | 1024 | 1152 | 2176 | 2192 | 3216 | 3472 | 4496 | 4624 | --------------
The 80-byte chunk was allocated at address 1024
The 20-byte chunk was allocated at address 1104
The 30-byte chunk was allocated at address 4496
The 10-byte chunk was allocated at address 2176
would you say that the heap allocator uses first fit best fit worst fit none of the above?
Question #3 [15 pts] If invoking the program as
./memory 40, 30, 80, 60
produces this output: 0 | 1024 | 1152 | 2176 | 2192 | 3216 | 3472 | 4496 | 4624 | --------------
The 40-byte chunk was allocated at address 3216
The 30-byte chunk was allocated at address 4496
The 80-byte chunk was allocated at address 1024
The 60-byte chunk was allocated at address 3256
would you say that the heap allocator uses first fit best fit worst fit none of the above?
Question #4 [15 pts] After looking up some documentation, you find out that the heap allocator uses Worst fit! What would the output of the memory program be when invoked as follows: ./memory 100, 100, 100, 20
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started