Commit a929d3c

mo khan <mo@mokhan.ca>
2021-04-18 21:43:50
answer question with words
1 parent c19e36e
Changed files (1)
doc/assignment3.md
@@ -78,6 +78,30 @@ Your answer for each question should be about 150 words. (100 marks total)
 
 1. Explain the distinction between a demand-paging system and a paging system with swapping. (8 marks)
 1. How does the second-chance algorithm for page replacement differ from the FIFO page replacement algorithm? (8 marks)
+
+> The simplest page-replacement algorithm is a first-in, first-out (FIFO)
+> algorithm. A FIFO replacement algorithm associates with each page the time
+> when that page was brought into memory. When a page must be replaced, the
+> oldest page is chosen. Notice that it is not strictly necessary to record
+> the time when a page is brought in. We can create a FIFO queue to hold all
+> pages in memory. We replace the page at the head of the queue. When a page
+> is brought into memory, we insert it at the tail of the queue.
+> The FIFO page-replacement algorithm is easy to understand and program.
+> However, its performance is not always good. On the one hand, the page
+> replaced may be an initialization module that was used a long time ago and is
+> no longer needed. On the other hand, it could contain a heavily used variable
+> that was initialized early and is in constant use.
+
+> The basic algorithm of second-chance replacement is a FIFO replacement
+> algorithm. When a page has been selected, however, we inspect its reference
+> bit. If the value is 0, we proceed to replace this page; but if the reference
+> bit is set to 1, we give the page a second chance and move on to select the
+> next FIFO page. When a page gets a second chance, its reference bit it
+> cleared, and its arrival time is reset to the current time. Thus, a page that
+> is given a second chance will not be replaced until all other pages have been
+> replaced (or given second chances). In addition, if a page is used often
+> enough to keep its reference bit set, it will never be replaced.
+
 1. Explain how copy-on-write operates. (8 marks)
 
 > Process creation using the `fork()` system call may initially bypass the need
@@ -142,6 +166,8 @@ Your answer for each question should be about 150 words. (100 marks total)
 > Solaris.
 
 1. If you were creating an operating system to handle files, what are the six basic file operations that you should implement? (8 marks)
+
+
 1. To create a new file, an application program calls on the logical file system. Describe the steps the logical file system takes to create a file. (8 marks)
 1. How is a hash table superior to a simple linear list structure? What issue must be handled by hash table implementation? (8 marks)
 1. What are the factors influencing the selection of a disk-scheduling algorithm? (8 marks)