A system has four frames. The time of loading, time of last access, and the R(reference) and M (modified) bits for each page are as shown below. The times are in clock ticks:
page |
loaded |
last ref. |
R |
M |
0 |
126 |
280 |
1 |
0 |
1 |
230 |
265 |
0 |
1 |
2 |
140 |
270 |
0 |
0 |
3 |
110 |
285 |
1 |
1 |
For each of the following page replacement algorithms, determine which page will be replaced:
- Second Chance
- LRU
- CLOCK
b) Consider a file whose size varies between 4Kb and 4MB during its lifetime. State, with a reason, whether or not the following allocation schemes will be appropriate for implementing the file storage: contiguous allocation, linked list allocation, file allocation table
c) In the case of an external USB hard drive attached to a computer, which is more suitable a write-through cache or nonwrite-through cache.
d) Write down the average access time for a disk cache given that the h% of the time it takes 1ms to satisfy a request from the cache and that 75ms is needed to satisfy a request if a disk read is necessary.
e) (i)Describe how to implement a lock using semaphores.
(ii)What is a test-and-set instruction? How can it be used to implement mutual exclusion? You may include a segment of pseudo-assembly code to aid your explanation.