- Information
- AI Chat
OSY216D 2021 S1 A2 - MEMO
OPERATING SYSTEMS III (OSY301T)
Tshwane University of Technology
Preview text
Faculty of Information and Communication
Technology
Department of Information Technology
Operating Systems 226R Assignment 2 MEMO
OSY216D
Due Date: 30 July 2021 at 18:
SPECIAL REQUIREMENTS : Submit a typped neat report
INSTRUCTIONS TO CANDIDATES: Answer all the questions
NUMBER OF PAGES: 10 APPENDIX: 0
COURSE/S:
DIPLOMA IN
INFORMATION TECHNOLOGY
EXAMINER Dr. M. MIGABO
MODERATOR Mr. N. MATANGA
TOTAL MARKS: 40 FULL MARKS: 40
Question 1 – Memory Management: Theory-based questions [22]
- Consider a swapping system in which memory consists of the following hole sizes in memory order: 10 MB, 4 MB, 20 MB, 18 MB, 7 MB, 9 MB, 12 MB, and 15 MB. Which hole is taken for successive segment requests of (a) 12 MB (b) 10 MB (c) 9 MB for first fit? Now repeat the question for best fit, worst fit, and next fit. (4)
The first fit will take 20 MB, 10 MB, 18 MB. The best fit will take 12 MB, 10 MB, and 9 MB The worst fit will take 20 MB, 18 MB, and 15 MB The next fit will take 20 MB, 18 MB, and 9 MB
- For each of the following decimal virtual addresses, compute the virtual page
number and offset for a 4-KB page and for an 8 KB page: 40000, 16384,
- (4)
a) For a 4 KB page size we get: 4𝐾𝐵 = 4 × 2 10 = 4096 𝐵𝑦𝑡𝑒𝑠/𝑝𝑎𝑔𝑒 40000 𝑏𝑦𝑡𝑒𝑠 4096 𝑏𝑦𝑡𝑒𝑠𝑝𝑎𝑔𝑒
= 9.
𝑃𝑎𝑔𝑒 𝑁𝑢𝑚𝑏𝑒𝑟 = 𝐹𝑙𝑜𝑜𝑟(9) = 9 (Floor means taking the unit only) 𝑂𝑓𝑓𝑠𝑒𝑡 = (9 − 9)𝑝𝑎𝑔𝑒 × 4096 𝑏𝑦𝑡𝑒𝑠 𝑝𝑎𝑔𝑒
= 3136 𝑏𝑦𝑡𝑒𝑠
16384 𝑏𝑦𝑡𝑒𝑠
4096 𝑏𝑦𝑡𝑒𝑠𝑝𝑎𝑔𝑒
= 4.
𝑃𝑎𝑔𝑒 𝑁𝑢𝑚𝑏𝑒𝑟 = 𝐹𝑙𝑜𝑜𝑟(4) = 4
𝑂𝑓𝑓𝑠𝑒𝑡 = (4 − 4)𝑝𝑎𝑔𝑒 × 4096 𝑏𝑦𝑡𝑒𝑠
𝑝𝑎𝑔𝑒
= 0 𝑏𝑦𝑡𝑒
120000 𝑏𝑦𝑡𝑒𝑠
4096 𝑏𝑦𝑡𝑒𝑠𝑝𝑎𝑔𝑒
= 29.
𝑃𝑎𝑔𝑒 𝑁𝑢𝑚𝑏𝑒𝑟 = 𝐹𝑙𝑜𝑜𝑟(29) = 29
𝑂𝑓𝑓𝑠𝑒𝑡 = (29 − 29)𝑝𝑎𝑔𝑒 × 4096 𝑏𝑦𝑡𝑒𝑠
𝑝𝑎𝑔𝑒
= 1216 𝑏𝑦𝑡𝑒
- You are given the following data about a virtual memory system: (a)The TLB can hold 1024 entries and can be accessed in 1 clock cycle (1nsec). (b) A page table entry can be found in 100 clock cycles or 100 nsec. (c) The average page replacement time is 6 msec.
If page references are handled by the TLB 99% of the time, and only 0% lead to a page fault, what is the effective address-translation time? (4)
The chance of a hit is 0 for the TLB, 0 for the page table, and 0. for a page fault (i., only 1 in 10 000 references will cause a page fault). The effective address translation time in nsec is then:
0 × 1 + 0 × 100 + 0 × 6 × 10 6 ≈ 602 𝑐𝑙𝑜𝑐𝑘 𝑐𝑦𝑐𝑙𝑒𝑠
Note that the effective address translation time is quite high because it is dominated by the page replacement time even when page faults only occur once in 10 000 references.
- A student in a compiler design course proposes to the professor a project of writing a compiler that will produce a list of page references that can be used to implement the optimal page replacement algorithm. Is this possible? Why or why not? Is there anything that could be done to improve paging efficiency at run time? (4)
This is probably not possible except for the unusual and not very useful case of a program whose course of execution is completely predictable at compilation time. If a compiler collects information about the locations in the code of calls to procedures, this information might be used at link time to rearrange the object code so that procedures were located close to the code that calls them. This would make it more likely that a procedure would be on the same page as the calling code. Of course, this would not help much for procedures called from many places in the program.
Question 2 – Memory Management: Application-based questions
[18]
- Discuss by means of appropriate examples the benefits and disadvantages of local and global page replacement algorithm in terms of the effect on the performance of paging systems within an Operating System. (5)
Local page replacement means that if a fault occurs during the execution of a process A, the page to replace the one the fault occurred on must be taken from the ones associated with that process only while in the global page replacement context, it could be a page from another process.
Benefits of local page replacement algorithm is that it is faster than the global one as the global one requires that the system must continually decide how many page frames to assign to each process which is time consuming.
The disadvantage of local page replacement is when the working set size varies a lot over the lifetime of a process in which case, trashing can easily occur. Also, if the working set shrinks, local algorithms may result in wasting memory as compared to the global counterpart.
- Draw logic flow diagrams for the following page replacement algorithms:
- The not recently used page replacement algorithm
- The first-in first out (FIFO) replacement algorithm
- The second-chance Page replacement algorithm
- The Least Recently used (LRU) algorithm (8)
b) The first-in first out (FIFO) replacement algorithm
c) The second chance page replacement algorithm
- Briefly explain why the optimal page replacement algorithm is not implementable. Focus on providing the reasons that would make its implementation impossible. (5)
The optimal page replacement consists of choosing the best possible page to replace. When a fault occurs, the page with the highest label should be removed. What makes it unrealizable (impossible to implement) is that at the time of the page fault, the operating system has no way of knowing when each of the pages will be referenced next. It is however possible to simulate the performance of the optimal page replacement algorithm on a discrete simulator. This is what brings its usefulness as it allows for performance evaluation of other realizable algorithms by comparison of how well the performance of these other algorithms correlates with its performance which is an indication of how good an algorithm is in this case.
OSY216D 2021 S1 A2 - MEMO
Course: OPERATING SYSTEMS III (OSY301T)
University: Tshwane University of Technology
- Discover more from: