Description
In this assignment, you will investigate how main memory is allocated and how
paging works.
Questions:
1. The following indicates a part of memory, available for allocation. The memory
is divided into segments of fixed sizes of the following sizes.
10 KB 4 KB 20 KB 18 KB 7 KB 9 KB 12 KB 15KB
Three processes A, B, and C with the respective sizes of 12 KB, 10 KB and 9 KB
are to be allocated successively.
Draw the results of the allocation when the following allocation methods are
used:
a. first fit
b. best fit
c. worst fit
d. next fit
Which algorithm makes use of the memory space the best?
2. A computer with 16 bit address has virtual address space of 64 KB and physical
memory of 32 KB. The size of a page is 4 KB.
a. How many virtual pages and page frames are generated?
b. Determine the size of a page table for a computer with 32 bit address, a
page size of 4 KB and each entry in the page table requires 4 bytes.
3. Suppose that we have free segments with sizes: 6, 17, 25, 14, and 19. Place a
program with size 13kB in the free segment using first-fit, best-fit and worst fit?
Indicate which segment it will be in for each of the 3 algorithms.
4. Consider a logical address space of 8 pages of 1024 words each, mapped onto a
physical memory of 32 frames.
How many bits are there in the logical address?
How many bits are there in physical address?
5. Suppose the page table for a process currently executing on the processor looks
like the following. All addresses are memory byte addresses, and addresses in
the main memory and processes start from zero. The page size is 512 bytes.
Virtual
page
number
Valid bit
Page frame
number
0 1 4
1 1 7
2 0 1
3 1 2
4 0 8
5 1 0
What physical address, if any, would each of the following virtual
addresses correspond to? Be sure to indicate if the corresponding address
is a valid physical address.
(i) 152
(ii) 1121
(iii)2499
6. Consider the following segment table:
Segment Base Limit
0 219 600
1 2300 14
2 90 100
3 1327 580
4 1952 96
All addresses are memory byte addresses, and addresses in the main memory
and processes start from zero. What are the physical addresses for the following
logical addresses (segment number, offset)?
(a) 0, 430
(b) 1, 10
(c) 2, 500
(d) 3, 400
(e) 4, 112
7. Consider the following page-reference string in virtual memory management:
1, 2, 8, 3, 4, 2, 1, 5, 6, 2, 1, 3, 7, 6, 3. Assuming four frames, how many page faults
would occur for the following replacement algorithms? Remember that all
frames are initially empty, so all of your first unique pages will cost one fault
each.
(a) LRU replacement
(b) FIFO replacement
(c) Optimal replacement
Report Submission Details
You need to submit a report that consists of answers to the listed questions.
Assignment Marking Criteria Weighting
Q 1 /5
Q 2 /2
Q 3 /3
Q 4 /2
Q 5 /3
Q 6 /5
Q 7 /3
Total /23