01 Homework cs4448
01 Homework cs4448
Solution:
The memories should perform compaction/relocation as frequent as possible, for
example: when a certain percentage of memory is busy, or when data is waiting to get in…
The advantages: when u perform it even more often than recommended is the memory
will have more space to work with, and the process will be faster.
The disadvantages: perform this action even more often than recommended will make
your computer processing data more time than before, and each time its relocated, the data will
be reallocated into another block address. So, if that block is already having data, the other data
will be put on waiting list. This can easily make your computer hotter and run slower.
a. Indicate which memory blocks are allocated to each of the arriving jobs.
b. Explain in your own words what advantages the next-fit algorithm could offer.
Solution:
a, When the block is show from low-order memory to high-order memory, we
will have the order of the blocks is: 5 -> 4 -> 1 -> 3 -> 2.
So when the jobs arriving in order A, B, C, D we first search from the order of the block
form 5 and then stop at block 2 and allocated in it because it satisfied requested of job A.
Block 2 will be busy now.
Then to job B, it will come back to search from block 5, because block 2 is the last one in
order and stop at block 5 and allocated in it. Block 5 will be busy now.
Then to job C, it will search from block 5 because that is the last block it visited last time.
It will stop at block 2 because it satisfied the requested. But block 2 is busy so job C will
be put on waiting list.
Then to job D, it will search from block 5 and stop at block 1 and allocated in it. Block 1
will be busy now.
b, The advantages that next-fit algorithm could offer is fast, because it will keeps
track of the partition that was last allocated, so that it can start its next search from that
exact spot instead of restarting the search with Block 1. So, if somehow the order of the
job requested is in the same order with the block order, it can be quickly allocated into
the block next to the last one without have to searching all over again from the beginning
block.
a. Indicate which memory blocks are allocated to each of the arriving jobs.
b. In this chapter, we introduced external and internal fragmentation. Explain in your own
words, which one would be expected in a worst-fit memory allocation scheme.
Solution:
a, When the block is show from low-order memory to high-order memory, we
will have the order of the blocks is: 4 -> 1 -> 3 -> 5 -> 2.
When the job A arriving, it will search for the block have the highest memory, so it run
from the beginning block is 4 to block 2 and stop there, then it will be allocated in block
2. Block 2 is busy now.
Then to job B, because block 2 is busy, so now it will search the second biggest block
which is block 5, then allocated there, now block 5 is busy.
Then to job C, it will search for the third biggest block which is block 3, but the memory
block size is not satisfied the requested, and 2 bigger blocks above are already busy, so
job C will be in waiting list.
Then to job D, it will search for the third biggest block is 3, then it will be allocated there,
now block 3 is busy.
b, External fragmentation would be best expected in a worst-fit memory
allocation because this process occurs when the memory fragments are large enough to
satisfy the request.
Solution:
Bounds registers are hardware registers used to enforce memory protection and access
control. Their main role is to define the limits or boundaries of a memory segment, ensuring that
programs or processes do not access memory locations beyond what they are allowed to.
Solution:
a, Job 4 can be accommodated or not depend on the algorithms that we use, if we uses
best-fit, next-fit… then job 4 cannot be accommodated, because block 5 where job 3 is allocated
is the first block fit the requested of job 4, but its already busy. So, job 4 will be put on waiting
list. But if we use worst-fit then job 4 can be accommodated in the last block.