|
|
5 |
Consider the following sequence of page references:
5, 6, 7, 6, 8, 7, 9, 5, 9, 6, 8, 9
Assuming that all frames are initially empty, indicate the contents of memory after each reference, and how many page faults are found for each of the following page replacement algorithms:
Reference String |
5 |
6 |
7 |
6 |
8 |
7 |
9 |
5 |
9 |
6 |
8 |
9 |
Frame 1 |
||||||||||||
Frame 2 |
||||||||||||
Frame 3 |
||||||||||||
Frame 4 |
||||||||||||
Page Fault |
Total Page Faults:
Reference String |
5 |
6 |
7 |
6 |
8 |
7 |
9 |
5 |
9 |
6 |
8 |
9 |
Frame 1 |
||||||||||||
Frame 2 |
||||||||||||
Frame 3 |
||||||||||||
Frame 4 |
||||||||||||
Page Fault |
Total Page Faults:
First In First Out (FIFO) :
This is one of the simplest page replacement algorithm.
In this algorithm, the operating system keeps track of all pages in
the memory in a queue, the oldest page is in the front of the queue
and is removed when a page needs to be replaced with a new page
.
Total Page Faults = all the page fault with the value 1 , so here there are 7 1's . Total Page fault = 7
Explanation, : (Lets call rs = reference string)
1. First 3 rs (5,6,7) goes in Frame (1,2,3). - 3 page faults
2. 4th rs 6 is already present in Frame 2 - 0 page fault
3. 5th rs 8 goes in Frame 4 - 1 page fault
4. 6th rs 7 is is already present in Frame 3 - 0 page
fault
Now 9 comes and none of the frames are empty , so operating system will try to replace the oldest rs with 9. Here that is 5 available in Frame 1.
5. So 7th rs 9 replaces 5 in frame 1 - 1 page fault
6. Next , 8th rs 5 replaces 6(oldest frame) in Frame 2 - 1 page
fault
7. 9th rs 9 is already present in Frame 1 - 0 page
fault
8. Next , 10th rs 6 replaces 7(oldest frame) in Frame 3 - 1 page
fault
9. Next , both 11th and 12th rs (8,9) are already available in the
frames(4,1) - 0 page faults
-----------------------------------------
Least Recently Used(LRU) :
In LRU algorithm least recently used page will be replaced with the
new one.
Total Page Faults = all the page fault with the value 1 , so here there are 8 1's . Total Page fault = 8
1. First 3 rs (5,6,7) goes in Frame (1,2,3). - 3 page faults
2. 4th rs 6 is already present in Frame 2 - 0 page fault
3. 5th rs 8 goes in Frame 4 - 1 page fault
4. 6th rs 7 is already present in Frame 3 - 0 page
fault
Now 9 comes and none of the frames are empty , so operating system will try to replace the least recently used rs with 9. Here that is 5 available in Frame 1.
5. So 7th rs 9 replaces 5 in frame 1 - 1 page fault
6. Next , 8th rs 5 replaces 6(least recently used) in Frame 2 - 1
page fault
7. 9th rs 9 is already present in Frame 1 - 0 page
fault
8. Next , 10th rs 6 replaces 8(least recently used) in Frame 4 - 1
page fault ( rs 7 used once more after rs 8 came , so 8 is least
recently used)
9. Next, 11th rs 8 replaces 7(least recently used) in Frame 3 -
1 page fault
10. Next , 12th rs 9 is already present in Frame 1 - 0
page fault
I hope this answers your question.
Please give thumbs up if it helps.
Answer the following questions based on the Memory Management tasks of an Operating System. 5 Consider...
Question 7 30 pts Consider the following page reference string: {1,2,3,4,1,5,6,2,1,2,3,7,6,3} Assume that the system has 4 page frames allocated to these 7 pages. Follow the page placement and replacement using the following three replacement algorithms: • LRU replacement • FIFO replacement • Optimal replacement How many page faults will occur for these three algorithms? Assume that all frames are initially empty, so your first unique pages will all cost one fault each USE ENCLOSED TABLES! Show all calculations in...
Consider the following page reference string: 1, 2, 3, 4, 2, 1, 5, 6, 2, 1, 2, 3, 7, 6, 3, 2, 1, 2, 3, 6. How many page faults would occur for the following replacement algorithms, assuming one, two, three, four, five, six, or seven frames? Remember all frames are initially empty, so your first unique pages will all cost one fault each. • LRU replacement • FIFO replacement • Optimal replacement
Java Looking for some help on getting this started. Directions below. Operating systems designers have long used simulation as an inexpensive way to test new algorithms. In this assignment you write a Java program that prompts the user for simulation data then runs a selected page replacement algorithm on that system, reporting frame assignments and total page faults. Instructions Your program will prompt the user first for the number of frames to be used in the simulation, then for a...
Consider the following page reference string for a three-frame memory: 6 3 1 5 3 4 3 2 5 4 3 4 5 1 5 3 1 6 3 1 Apply LRU, Clock and FIFO algorithms What will be the number of page faults for each replacement algorithm note that page faults at the beginning are counted?
Consider the following page reference string: A C B D B A E F B F A G E F A Assuming demand paging with four frames, how many page faults would occur for the following replacement algorithms? Remember that all frames are initially empty, so your first unique pages will cost one fault each. Show all of your works. LRU replacement FIFO replacement Optimal (MIN) replacement
Consider the following virtual page reference sequence: page 1, 2, 3, 4, 2, 1, 5, 6, 2, 1, 2, 3. This indicates that these particular pages need to be accessed by the computer in the order shown. Consider each of the following 4 algorithm-frame combinations: LRU with 3 frames FIFO with 3 frames LRU with 4 frames FIFO with 4 frames . For each of the 4 combinations, below, move from left to right as the virtual page numbers are...
Implement the frame replacement algorithm for virtual memory Assume a computer system have 10 memory frames available inside the physical memory and is required to execute a process containing 20 pages. Assume a process P has been executed in the system and produced a sequence of 40 page demands as follows: Page demands trace of process P Demand 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 cont. Page...
3. Assume a virtual memory system with the following properties: • The physical memory available to an application consists of four-page frames, with frame numbers 0, 1, 2, and 3. The application has six pages of data in its virtual address space, using page numbers 0, 1, 2, 3, 4, and 5. Build a table showing which frame is used to bring in each page for the following sequences of page references using FIFO, MIN, and LRU as page replacement...
This is JAVA programing problem. Please give me all necessary screenshot and comments. (I use Eclipse) Thanks Write a program that implements the FIFO, LRU, and Optimal page replacement algorithms presented in chapter 8 of your text. First generate a random page-reference string (this should be 20 entries long) where page numbers range from 0 to 9. Apply the random page-reference string to each algorithm, and record the number of page faults incurred by each algorithm. Implement the replacement algorithms...
Consider the following page reference string, for a process with 5 virtual pages, and three frames in memory, and fill in the tables for the LRU. B. LRU. Reference string: ABCBDEABCDA Page Page Reference Fault Total Page Faults