OPERATING SYSTEMS
1. Given six memory partitions of 100 MB, 170 MB, 40 MB, 205 MB, 300 MB, and 185 MB (in order), how would the first‐fit, best‐fit, and worst‐fit algorithms place processes of size 200 MB, 15 MB, 185 MB, 75 MB, 175 MB, and 80 MB (in order)?
Indicate which, if any, requests cannot be satisfied. Comment on how efficiently each of the algorithms manages memory in terms of fragmentation.
2. Consider a logical address space of 64 pages of 1,024 words each, mapped onto a physical memory of 32 frames.
3. Assuming a 1‐KB page size, what are the page numbers and offsets for the following address references (provided as decimal numbers):
a. 3085
b. 42095
c. 215201
d. 650000
e. 2000001
Answer:-----------
1).
We have six memory partitions, let label them:
100MB (F1), 170MB (F2), 40MB (F3), 205MB (F4), 300MB (F5) and 185MB
(F6).
We also have six processes, let label them:
200MB (P1), 15MB (P2), 185MB (P3), 75MB (P4), 175MB (P5) and 80MB
(P6).
Using First-fit:--
P1 will be allocated to F4. Therefore, F4 will have a remaining
space of 5MB from (205 - 200).
P2 will be allocated to F1. Therefore, F1 will have a remaining
space of 85MB from (100 - 15).
P3 will be allocated F5. Therefore, F5 will have a remaining space
of 115MB from (300 - 185).
P4 will be allocated to the remaining space of F1. Since F1 has a
remaining space of 85MB, if P4 is assigned there, the remaining
space of F1 will be 10MB from (85 - 75).
P5 will be allocated to F6. Therefore, F6 will have a remaining
space of 10MB from (185 - 175).
P6 will be allocated to F2. Therefore, F2 will have a remaining
space of 90MB from (170 - 80).
The remaining free space while using First-fit
include: F1 having 10MB, F2 having 90MB, F3 having 40MB as
it was not use at all, F4 having 5MB, F5 having 115MB and F6 having
10MB.
Using Best-fit:----
P1 will be allocated to F4. Therefore, F4 will have a remaining
space of 5MB from (205 - 200).
P2 will be allocated to F3. Therefore, F3 will have a remaining
space of 25MB from (40 - 15).
P3 will be allocated to F6. Therefore, F6 will have no remaining
space as it is entirely occupied by P3.
P4 will be allocated to F1. Therefore, F1 will have a remaining
space of of 25MB from (100 - 75).
P5 will be allocated to F5. Therefore, F5 will have a remaining
space of 125MB from (300 - 175).
P6 will be allocated to the part of the remaining space of F5.
Therefore, F5 will have a remaining space of 45MB from (125 -
80).
The remaining free space while using Best-fit
include: F1 having 25MB, F2 having 170MB as it was not use
at all, F3 having 25MB, F4 having 5MB, F5 having 45MB and F6 having
no space remaining.
Using Worst-fit:-----
P1 will be allocated to F5. Therefore, F5 will have a remaining
space of 100MB from (300 - 200).
P2 will be allocated to F4. Therefore, F4 will have a remaining
space of 190MB from (205 - 15).
P3 will be allocated to part of F4 remaining space. Therefore, F4
will have a remaining space of 5MB from (190 - 185).
P4 will be allocated to F6. Therefore, the remaining space of F6
will be 110MB from (185 - 75).
P5 will not be allocated to any of the available space because none
can contain it.
P6 will be allocated to F2. Therefore, F2 will have a remaining
space of 90MB from (170 - 80).
The remaining free space while using Worst-fit
include: F1 having 100MB, F2 having 90MB, F3 having 40MB,
F4 having 5MB, F5 having 100MB and F6 having
110MB.
Explanation:--------
First-fit allocate process to the very first available
memory that can contain the process.
Best-fit allocate process to the memory that
exactly contain the process while trying to minimize creation of
smaller partition that might lead to wastage.
Worst-fit allocate process to the largest
available memory.
From this best fit perform well as all process are allocated to memory and it reduces wastage in the form of smaller partition. Worst-fit is indeed the worst as some process could not be assigned to any memory partition.
2).
a). Logical memory = 64 pages = 2⁶ pages
Size of each word = 1024 = 2¹⁰
Hence total logical memory = 2⁶ x 2¹⁰ = 2¹⁶
Hence the logical address will have 16 bits.
b) Physical memory = 32 frames = 2⁵
frames
size of each word = 1024 = 2¹⁰
Hence total physical size = 2⁵ x 2¹⁰ = 2¹⁵
Hence there will be 15 bits in the physical
address
3).
Given Page size = 1 KB = 1024 Byte
| Page number | Offset | |
| a. | 3085/1024 = 3 | 3085 mod 1024 = 13 |
| b. | 42095/1024 = 41 | 42095 mod 1024 = 111 |
| c. | 215201/1024 = 210 | 215201 mod 1024 =161 |
| d. | 650000/1024 = 634 | 650000 mod 1024 =784 |
| e. | 2000001/1024 = 1953 | 2000001 mod 1024 = 129 |
OPERATING SYSTEMS 1. Given six memory partitions of 100 MB, 170 MB, 40 MB, 205 MB,...
Given six memory partitions of 100 MB, 170 MB, 40 MB, 205 MB, 300 MB, and 185 MB (in order), how would the first-fit, best-fit, and worst-fit algorithms place processes of size 200 MB, 15 MB, 185 MB, 75 MB, 175 MB, and 80 MB (in order)? Indicate which—if any— requests cannot be satisfied. Comment on how efficiently each of the algorithms manages memory.
Operating Systems Name two differences between logical and physical addresses. Why are page sizes always powers of 2? Consider a logical address space of 64 pages of 1,024 words each, mapped onto a physical memory of 32 frames. a. How many bits are there in the logical address? b. How many bits are there in the physical address?
Consider a logical address space of 8 pages; each page is 2048 byte long, mapped onto a physical memory of 64 frames.(i) How many bits are there in the logical address and how many bits are there in the physical address?(ii) A 6284 bytes program is to be loaded in some of the available frames ={10,8,40,25,3, 15,56,18,12,35} . Show the contents of the program's page table.(iii) What is the size of the internal fragmentation?(iv) Convert the following logical addresses 2249...
Please help answer the following questions on how operating systems handle memory allocation in Main Memory. Suppose page size = 2^11 and the logical address is 15 bits. How many pages can a process have at most? Convert the logical address of 18723 to a <page#, offset> format. Assume the page size from the question 1. Suppose the logical address 18723 is located in frame 5. What is the physical address that the logical address is mapped to?
Given six memory partitions of 800 KB,500 KB,350KB,200KB,450KB and 100 KB (in order), how would the first-fit, best-fit and worst-fit algorithms place processes of size 315KB,600KB, 345KB, 110KB and 400KB(in order) i) Which algorithm makes the most efficient use of memory? ii) Are there any internal and external fragmentation? If yes, how it can be solved?
Consider a logical address space of 512 pages with a 4-KB page size, mapped onto a physical memory of 256 frames. How many bits are required in the logical address? How many bits are required in the physical address?
Consider a logical address space of 256 pages with a 4-KB page size, mapped onto a physical memory of 64 frames. a. How many bits are required in the logical address? b. How many bits are required in the physical address?
Operating systems
Consider a logical address space of 4 pages of 1024 words each, mapped onto a physical memory of 16 frames. a. How many bits are there in the logical address? b. How many bits are there in the physical address? te: Show the calculation.)
Exercise 5 (2.5 points) Assume a memory management system built on paging, its physical memory has the total size of 4 GB. It placed over 16 KB pages. The limit of the logical address space for each process is 512 MB. 1. What is the total number of bits in the physical address? 2. What is the number of bits that specifies the page displacement? 3. Determine how many physical frames in the system. Explain the layout for the logical...
Operating Systems 1. Given memory partitions of 100 KB, 500 KB, 200 KB, 300 KB and 600 KB (in order), how would each of the first-fit, best-fit and worst-fit algorithms place processes of 212 KB, 417 KB, 112 KB and 426 KB (in that order)? Which algorithm makes the most efficient use of memory?