0% found this document useful (0 votes)
61 views4 pages

01 Homework cs4448

Uploaded by

Dinh Nam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
61 views4 pages

01 Homework cs4448

Uploaded by

Dinh Nam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 4

Name: Cao Viet Anh

Troy ID: 1607848


CS4448
Homework 1

Exercise 2 (10 pts):


Description: In your own words, how often should memory compaction/relocation be
performed? Describe the advantages and disadvantages of performing it even more often
than recommended.

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.

Exercise 6 (20 pts):


Description: Next-fit is an allocation algorithm that starts by using the first-fit algorithm,
but it 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. In other words, it starts
searching from the most recently allocated block when the next job arrives. Using the
following configuration with jobs arriving in order (Job A, B, C, and D) and with blocks
shown in order from low-order memory to high-order memory:

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.

Exercise 7 (20 pts):


Description: Worst-fit is an allocation algorithm that allocates the largest free block to a
new job. It is the opposite of the best-fit algorithm. Using the following configuration
with jobs arriving in order (Job A, B, C, and D) and with blocks shown in order from
low-order memory to high-order memory:

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.

Exercise 11 (20 pts):


Description: Using your own words, explain the role of the bounds register.

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.

Exercise 18 (30 pts):


Description: Given the memory configuration in Figure 2.10 below, answer the
following questions given that, at this point, Job 4 arrives requesting a block of 100K.
a. Can Job 4 (100K) be accommodated? Why or why not?
b. If relocation is used, after memory compaction, what are the contents of the relocation
registers for Job 1, Job 2, and Job 3?
c. What are the contents of the relocation register for Job 4 after it has been loaded into
memory?
d. An instruction that is part of Job 1 was originally loaded into memory location 22K.
What is its new location after compaction?
e. An instruction that is part of Job 2 was originally loaded into memory location 55K.
What is its new location after compaction? An instruction that is part of Job 3 was
originally loaded into memory location 80K. What is its new location after compaction?
f. If an instruction was originally loaded into memory location 110K, what is its new
location after compaction?

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.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy