Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Processor Manager Description: You will develop a processor manager for a single-processor, multi-programming system. The processor manager will include the tasks of the job

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
1. Processor Manager Description: You will develop a processor manager for a single-processor, multi-programming system. The processor manager will include the tasks of the job scheduler and the process scheduler. The job scheduler will use a first-in, first out policy. The process scheduler willuse the round-robin algorithm with a quantum of 5ms. Define the following structures in your code: 1. Process Control Block You can define a class or a struct for the PCB. The PCB should have fields for pid, state arrival time, completion time, total burst, burst so far, priority. class PCB public: int pid; string state; // waiting, running, complete int arrival Time; // time it arrived at the Ready Quue int startTime; // this will be the clock time (in ms) int completionTime; int totalBurst; int burstSoFar; // increment each time process gets am on the cpu int priority }; Feel free to define the class with private members and public getters/setters if you wish (that really is the correct way to do it) 2. Job Queue vector jobQueue; W jobs arriving into the system will get added here 3. Ready Queue vector readyTorunqualy; // Jobs that are waiting to run are in this queue Upon start up your program will read the file jobs.txt to get a list of the jobs. These jobs are added to the jobQueue. The file contains a list of 5 space-delimited records that define a job and has the following structure: pid state arrival-time start-time completion-time total-burst burst-so-far priority Here is an example: jobs.txt 2 hold 200701 8 hold 100602 1 hold 500 302 5 hold 0 0 0 804 4 hold 300205 The file jobs.txt is in this project. Your processor manager should work with any file data that meets the structure described above. Here is pseudo code for the Processor Manager: Read quantumsize from command line clocke; Read the jobs file and add the jobs to jobsQueue (This means reading each one into a PCB object and then adding that object to the job: while there are jobs in jobsqueue with arrival tine > clock or jobs in readyToRunQueue ) { Remove jobs from the jobs Queue with an arrival time - clock and add then to the readyToRunQueue Change state of jobs to ready to run if( readyToRunQueue is not empty ) running job (R) - Get the first job in the readyToRunQueue; quantumCount @ change R.state running change R. startTime clock while( R.state = waiting and Ristate to complete) { clock++ quantumCount++ increnent R.burstSoFar by 1 if( R.burst SoFar == totalBurst) if( R.burstSoFar ** totalBurst ) change R.state = complete change R.completionTime - clock update statistics: wait time, completion time, turnaround time else if( quantumCount = quantum) change R.state = waiting add R to readyToRunQueue Remove jobs from the jobsQueue with an arrival time - clock and add to them ready Toruniqueue } // end while quantum not3 } else { // readyqueue empty, there are future jobs, cpu idle Ilock** } ) // while jobs available At the end of the simulation your Processor Manager should generate the following report Job# | TOTAL WAIT TIME COMPLETION TIME | TURNAROUND TIME ITI 0101012 1 1 H 11 0101012 1101012 Total simulation time: 5 Average Turnaround time: 2 Average Waiting time: 2 When your program is executed, the quantum size will be passed on the command line. /a.out 5 int main(int arge, char argv) { if( argc

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_2

Step: 3

blur-text-image_3

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

Databases A Beginners Guide

Authors: Andy Oppel

1st Edition

007160846X, 978-0071608466

More Books

Students also viewed these Databases questions

Question

In an Excel Pivot Table, how is a Fact/Measure Column repeated?

Answered: 1 week ago