Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In class we discussed the timeslice CPU scheduling algorithm. We also considered other ways that the processes in the CPU could be scheduled. Modify the

In class we discussed the timeslice CPU scheduling algorithm. We also considered other ways that the processes in the CPU could be scheduled. Modify the time-slicing CPU scheduling algorithm found here: http://www.cs.uri.edu/~cingiser/csc110/handouts/python/cpu_timeslice.py to implement priority-based scheduling.

Assume that there are two priority levels in the operating system, HIGH and LOW. In the data following data file: [http://www.cs.uri.edu/~cingiser/csc110/assignments/prio_proc.txt]

each process has associated with it a priority specified by H for high, and L for low. Write the program so that high priority processes get two times the time slice and low priority processes get only one time slice.

Note: The input file has three items on each line instead of two. You will have to split the input accordingly. You also have to make sure put the process back into the queue in the correct format. Your output will look something like this:

image text in transcribed

Enter the name of the file containing the processes prio proc .txt The time slice is 3 The contents of the queue are P1,4,H P2,5,L P3,3,L P4,7,H P5,8,L P6,9,L P7,3,H P8,2,H P9,4,L Getting next process Process P1 has 4 instructions to execute with priority H Executing instruction 3 of process P1 Timer 1 Executing instruction 2 of process P1. Timer Executing instruction 1 of process P1 Timer 3 Executing instruction 0 of process P1 Timer 4 Process P1 Complete Getting next process Process P2 has 5 instructions to execute with priority L Executing instruction 4 of process P2 Timer 1 Executing instruction 3 of process P2 Timer 2 Executing instruction 2 of process P2 Timer Put process P2 back in queue with instructions left to execute Getting next process Process P3 has 3 instructions to execute with priority L Executing instruction 2 of process P3 Timer 1 Executing instruction 1 of process P3 Timer 2 Executing instruction 0 of process P3 Timer Process P3 Complete Getting next process Process P4 has 7 instructions to execute with priority H Executing instruction 6 of process P4 Timer 1 Executing instruction 5 of process P4 Timer 2 Executing instruction 4 of process P4 Timer 3 Executing instruction 3 of process P4 Timer 4 Executing instruction 2 of process P4 Timer 5 Executing instruction 1 of process P4 Timer 6 Put process P4 back in queue with 1 instructions left to execute Getting next process Process P5 has 8 instructions to execute with priority L Executing instruction 7 of process P5 Timer 1 Executing instruction 6 of process P5 Timer 2 Executing instruction 5 of process P5 Timer 3 Put process P5 back in queue with 5 instructions left to execute Getting next process Process P6 has 90 instructions to execute with priority L Executing instruction 8 of process P6 Timer 1 Executing instruction 7 of process P6 Timer 2 Executing instruction 6 of process P6 Timer 3 Put process P6 back in queue with 6 instructions left to execute Getting next process Process P7 has 3 instructions to execute with priority H Executing instruction 2 of process P7 Timer 1 Executing instruction 1 of process P7 Timer 2 Executing instruction 0 of process P7 Timer 3 Process P7 Complete

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: Heikki Topi, Jeffrey A Hoffer, Ramesh Venkataraman

13th Edition

0134773659, 978-0134773650

More Books

Students also viewed these Databases questions