Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

im struggling with figuring out how to do this i am taking in a file in c++ i have attached a screen shot of the

im struggling with figuring out how to do this i am taking in a file in c++ i have attached a screen shot of the file being used as well as the question
I would greatly appreciae the assistance
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
here is the input file it needs to be able to handle different frame sizes and the first value in the input file is the frame size
image text in transcribed
Overview The Memory Management module in an operating system needs to run page replacement algorithms in order to optimally run the process by using the allocated number of frames as efficiently as possible. We have discussed the First Come First Serve, Least Recently Used and Optimal page replacement algorithms, In this project, we will try to write a high-level language program that will perform calculations for implementing the first of the three algorithms mentioned above, generate and report the frame allocations for a given address sequence along with the number of page faults for the algorithm. The idea behind this project is to enable a better understanding of frame allocation and replacement strategy for the students. Learning Objectives The focus of this assignment is on the following learning objectives: - Be able to generate the reference string from the address sequence for the process - Be able to allocate the frames in accordance with the reference string for a process based on the number of frames allocated to the process for the FCFS algorithm - Be able to identify the victim pages to be evicted from the allocated frames, fill the frames with the right new page, and report the outcome of every stage of page replacement - Be able to identify and report page fault interrupts Prerequisites - To complete this project, you need to make sure that you have the following: - C/C++ compiler - AC/C++IDE or text editor (multiple editors exist for developers) - An understanding of the material presented in class - An understanding of the material covered in the textbook. Problem Description You are to implement a program that would solve questions like the one below: A process spanning 15 pages of size 100 locations each has been allocated 3 frames. The address sequence for the program is as follows: 0000,0001,0002,0003,0010,1020,1021,1022,1350,1351,0021,0022,0023,0430,0431 The list of requirements are as follows: General requirements for the program: 1. The program reads the number of frames allocated to the process - from a text file and reports the number of frames allocated. 2. The text file will next contain an address sequence inside the program involving 50 addresses in the range. The students can assume that a page or frame contains 100 locations and that these addresses are in number base 10 (decimal). The addresses will be stored in the file with 10 addresses in one line. They need to be read in from the file and reported so as to have 10 addresses in every line. 3. The reference string should be found out from the address sequence and reported. 4. The program should then run the FCFS algorithm for the reference string and report the contents in the frames for every page entry in the reference string and the final count on the number of page faults for the algorithm based on the reference string. 5. You should not hard code your project only for the values (or the same number of address values) provided in the sample input file. The instructor will use some other input file with less or more number of frames and/or addresses, so please make sure your project is general and works for any number of values. You can assume only that the addresses are for pages that contain exactly 100 locations and that the addresses indicated in the file will be in the decimal number system. 6. The program should clear any dynamically allocated memory used and not leave any memory leaks before exiting. 7. The program should be tested on the UWF SSH server (or on the VM-only if the SSH server is down) before submission and submitted with a makefile. The instructor/grader will test the program files by only running 'make' and 'make clean'. The instructor/grader should not be required to run the executable by entering another command on the command line and typing make should create and run the target executable. Please make sure that the makefile also contains the name of the target executable file and the command to run the target. Entering the 'make' command on the command prompt should nun the target executable file. Grading Breakdown - [3 pts] Reading in from the input file and reporting the number of frames allocated correctly. - [8 pts] Reading in from the input file and reporting the address sequence correctly, and neatly. well formatted. - [7 pts] Generating and reporting the reference string for the address sequence correctly. - [15 pts] Generating and reporting the contents of the frames for FCFS corresponding to every page number entry in the reference string. - [10 pts] Reporting the number of page faults for FCFS correctly. - [5 pts] Submitting a makefile with all the requirements specified for the program in point about the makefile above. - [2 pts] Submitting the project as per below instructions. Submission Points will be deducted for not following these instructions. Before submitting this project in eLearning make sure that you follow the following steps: 1. Make sure that your name appears at the top of each file. This should be done as a comment for any source code files. 2. Include screenshots of different stages of your code running as image files, if you were not able to run your project on the UWF SSH server. 3. If your project spans source code multiple files (h \& .cpp or .c), add all files, including the screenshot images into a zip file with the file name "lastname_firstname project01.zip". 4. Turn your zipped-up project into eLearning/Canvas. 5. The students should avoid submitting unrelated files and folder/s to Canvas. No executables or object files should be submitted either. Only the relevant code files (.cpp, .h or .hpp, the makefile, and if required, a readme.txt) must be zipped and submitted. Submissions containing unrelated files or extraneous folders will invite penalty. 6. The students can develop their projects using other IDEs of their choice, but they must compulsorily test run and ascertain that their project code runs on the UWF SSH server prior to submission, because the projects will be tested by the grader by running them on the SSH server. It is therefore very highly recommended that students keep testing their code on the SSH server during development at various stages to not discover any issues after they have completed their project. 7. Please double check your submissions to make sure you ended up submitting the correct files - and that you have submitted all the files (none of the required files are missing in the upload). If it is discovered after the deadline that irrelevant files have been turned in, the grader will have no option other than giving a zero on such submissions. 8. The students are once again reminded to turn in their original work, and avoid any plagiarism. SAMPLE RUN The number of frames allocated to the process read from input ftle: 3 The address sequence indicated in the file, 10 addresses per line: 700653326834838701654327835839702325328836703651655656293704652457670294705831458671295675832287329672676833288330673677285289291674678286290292837840 The reference string is: 76826636423363282288768 Now running the FIrO Page Replacement Algorithm... Below are the page allocations to the frames. 777222444666633322288866633 66777Totalpagefaults:158886632228 3700701702651652831832833285286653654325655457458287288289290326327328656670671329330291292834835836293294295672673674837838839703704705675676677678840

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Power Of Numbers In Health Care A Students Journey In Data Analysis

Authors: Kaiden

1st Edition

8119747887, 978-8119747887

More Books

Students also viewed these Databases questions