Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program that implements a process scheduler based on priority. Your program should have the following: Create a linked list with 10 objects. Each

image text in transcribed

Write a program that implements a process scheduler based on priority. Your program should have the following: Create a linked list with 10 objects. Each object will represent a process. At the beginning, all objects are basically empty (Null). Process creation: when creating a process, the program should ask for the process name and duration, then your program should assign an ID to the process that is different than all current processes available. (Hint: to make it easier to work with next steps, let the duration of the process be around 30 seconds). Sort the created processes into a queue (linked list) based on the process name (i.e., sort alphabetically). The program should extract the process at the head of the queue and assign to the CPU (virtual one, not physically assign it) for the duration specified in the process. When the process is finished, your scheduler should extract the next process from the linked list, and so on. When a process is finished executing, the process should be deleted, and the process ID can be used again for a later process. If the queue is empty (i.e., no process is available), the scheduler should check periodically (every 5 second) if there are any new processes. In order to avoid process starvation, a process that remains at the tail of the queue while creating 3 new processes should be moved to the head of the queue. Bonus (5 points): The scheduler above is non-preemptive (once a process starts execution, it remains active until it is done). A 5 points bonus will be awarded if you get the scheduler to be preemptive (i.e., if a new process with higher priority is created while a process is currently running, context switch needs to be done)

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

Modern Database Management

Authors: Jeffrey A. Hoffer Fred R. McFadden

9th Edition

B01JXPZ7AK, 9780805360479

More Books

Students also viewed these Databases questions

Question

Compute the mean and variance of (a) 1 0 tdB(t) (b) 1 0 t2 d B(t)

Answered: 1 week ago

Question

7. Identify six intercultural communication dialectics.

Answered: 1 week ago