coding_assignment_3 COMSC 260 Applied Operating Systems Spring 2021 Coding Assignment #3, Due: 11:59 PM on Tuesday, May 4, 2021 Grading: up to 15% of the course’s final grade including bonus points...

1 answer below »
This assignment is going to be written in C language


coding_assignment_3 COMSC 260 Applied Operating Systems Spring 2021 Coding Assignment #3, Due: 11:59 PM on Tuesday, May 4, 2021 Grading: up to 15% of the course’s final grade including bonus points Submission: submit to Bridges a zip or a tgz file that comprises your source code and three sample outputs including the default one Description Write a program that implements the LRU page-replacement algorithms presented in chapter 8. Two implementation options are described in Section 8.4.4: 1. Counters 2. Stack You can choose either of the options. However, if you use stack and implement the algorithm correctly, you’ll get 5 bonus points. Requirement • Your submitted source code must be free of error or warning while compiling. • Without any command line parameters, your program should by default process a hard-coded page reference string [7 0 1 2 0 3 0 4 2 3 0 3 2 1 2 0 1 7 0 1] with 3 memory frames (refer to Figure 8.15). • Your program should take the following parameters from command line: o The number of frames o The number of pages o A reference string (optional) When the number of pages is passed in, your program will randomly generate a reference string with the number of pages specified. • Your program must print out the number of faults incurred at the end. • Assume page numbers range from 0 to 9. • Assume that demand paging is used. Sample output Default: $ ./lru # Use hard coded parameters: # Number of frames: 3 # Reference string: [7 0 1 2 0 3 0 4 2 3 0 3 2 1 2 0 1 7 0 1] ____________________________________________________________________ 7 FAULT [ -1 -1 -1 ] [ 7 -1 -1 ] 0 FAULT [ 7 -1 -1 ] [ 7 0 -1 ] 1 FAULT [ 7 0 -1 ] [ 7 0 1 ] 2 FAULT [ 7 0 1 ] [ 0 1 2 ] 0 HIT [ 0 1 2 ] [ 1 2 0 ] 3 FAULT [ 1 2 0 ] [ 2 0 3 ] 0 HIT [ 2 0 3 ] [ 2 3 0 ] 4 FAULT [ 2 3 0 ] [ 3 0 4 ] 2 FAULT [ 3 0 4 ] [ 0 4 2 ] 3 FAULT [ 0 4 2 ] [ 4 2 3 ] 0 FAULT [ 4 2 3 ] [ 2 3 0 ] 3 HIT [ 2 3 0 ] [ 2 0 3 ] 2 HIT [ 2 0 3 ] [ 0 3 2 ] 1 FAULT [ 0 3 2 ] [ 3 2 1 ] 2 HIT [ 3 2 1 ] [ 3 1 2 ] 0 FAULT [ 3 1 2 ] [ 1 2 0 ] 1 HIT [ 1 2 0 ] [ 2 0 1 ] 7 FAULT [ 2 0 1 ] [ 0 1 7 ] 0 HIT [ 0 1 7 ] [ 1 7 0 ] 1 HIT [ 1 7 0 ] [ 7 0 1 ] *** Total Page Faults: 12 *** Randomly generated Reference String: $ ./lru -f 4 -p 15 # Use a randomly genearted reference string: # Number of frames: 4 ____________________________________________________________________ 3 FAULT [ -1 -1 -1 -1 ] [ 3 -1 -1 -1 ] 6 FAULT [ 3 -1 -1 -1 ] [ 3 6 -1 -1 ] 7 FAULT [ 3 6 -1 -1 ] [ 3 6 7 -1 ] 5 FAULT [ 3 6 7 -1 ] [ 3 6 7 5 ] 3 HIT [ 3 6 7 5 ] [ 6 7 5 3 ] 5 HIT [ 6 7 5 3 ] [ 6 7 3 5 ] 6 HIT [ 6 7 3 5 ] [ 7 3 5 6 ] 2 FAULT [ 7 3 5 6 ] [ 3 5 6 2 ] 9 FAULT [ 3 5 6 2 ] [ 5 6 2 9 ] 1 FAULT [ 5 6 2 9 ] [ 6 2 9 1 ] 2 HIT [ 6 2 9 1 ] [ 6 9 1 2 ] 7 FAULT [ 6 9 1 2 ] [ 9 1 2 7 ] 0 FAULT [ 9 1 2 7 ] [ 1 2 7 0 ] 9 FAULT [ 1 2 7 0 ] [ 2 7 0 9 ] 3 FAULT [ 2 7 0 9 ] [ 7 0 9 3 ] *** Total Page Faults: 11 *** Passed-in Reference String from command line: $ ./lru -f 3 -r "7 0 1 2 0 3 0 4 2 3 0 3 2 1 2 0 1 7 0 1" Use command line parameters: # Number of frames: 3 # Reference string: [7 0 1 2 0 3 0 4 2 3 0 3 2 1 2 0 1 7 0 1] ____________________________________________________________________ 7 FAULT [ -1 -1 -1 ] [ 7 -1 -1 ] 0 FAULT [ 7 -1 -1 ] [ 7 0 -1 ] 1 FAULT [ 7 0 -1 ] [ 7 0 1 ] 2 FAULT [ 7 0 1 ] [ 0 1 2 ] 0 HIT [ 0 1 2 ] [ 1 2 0 ] 3 FAULT [ 1 2 0 ] [ 2 0 3 ] 0 HIT [ 2 0 3 ] [ 2 3 0 ] 4 FAULT [ 2 3 0 ] [ 3 0 4 ] 2 FAULT [ 3 0 4 ] [ 0 4 2 ] 3 FAULT [ 0 4 2 ] [ 4 2 3 ] 0 FAULT [ 4 2 3 ] [ 2 3 0 ] 3 HIT [ 2 3 0 ] [ 2 0 3 ] 2 HIT [ 2 0 3 ] [ 0 3 2 ] 1 FAULT [ 0 3 2 ] [ 3 2 1 ] 2 HIT [ 3 2 1 ] [ 3 1 2 ] 0 FAULT [ 3 1 2 ] [ 1 2 0 ] 1 HIT [ 1 2 0 ] [ 2 0 1 ] 7 FAULT [ 2 0 1 ] [ 0 1 7 ] 0 HIT [ 0 1 7 ] [ 1 7 0 ] 1 HIT [ 1 7 0 ] [ 7 0 1 ] *** Total Page Faults: 12 ***
Answered Same DayMay 03, 2021COMSC 260

Answer To: coding_assignment_3 COMSC 260 Applied Operating Systems Spring 2021 Coding Assignment #3, Due: 11:59...

Sandeep Kumar answered on May 04 2021
144 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here