Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CODE REQUIRED IN PYTHON 3 One of the main applications of priority queues is in operating systemsfor scheduling jobs on a CPU. In this project

CODE REQUIRED IN PYTHON 3

One of the main applications of priority queues is in operating systemsfor scheduling jobs on a CPU. In this project you are to build a program that schedules simulated CPU jobs.

1. Your program should run in a loop, each iteration of which corresponds to a time slice for the CPU.

2. At every time slice, there is either 0 new jobs (96% probability) or 1 new job (4% probability) with random priority (see point 3) and random length (see point 4) added to the queue. You should assign a unique Job ID to each new job.

3. Each job is assigned a priority, which is an integer between 20 (highest priority) and 19 (lowest priority), inclusive. From among all jobs waiting to be processed in a time slice, the CPU must work on a job with highest priority.

4. In this simulation, each job will also come with a length value, which is an integer between 1 and 100, inclusive, indicating the number of time slices that are needed to process this job.

5. Jobs cannot be interruptedonce it is scheduled on the CPU, a job runs for a number of time slices equal to its length.

6. Your simulator must output the Job ID of the job running on the CPU in each time slice.

7. Run your simulation for 7*24*60 time slices.

8. Compute the average waiting time that jobs spent in the priority queue before being serviced.

9. Also output the number of jobs that are still in the priority queue at the end of your simulation.

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

Modern Database Management

Authors: Jeffrey A. Hoffer Fred R. McFadden

9th Edition

B01JXPZ7AK, 9780805360479

More Books

Students also viewed these Databases questions

Question

Ty e2y Evaluate the integral dy

Answered: 1 week ago