Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This project involves implementing several different process scheduling algorithms. The scheduler will be assigned a predefined set of tasks and will schedule the tasks based

This project involves implementing several different process scheduling algorithms. The scheduler will be assigned a predefined set of tasks and will schedule the tasks based on the selected scheduling algorithm. Each task is assigned a priority and CPU burst.The following scheduling algorithms will be implemented:

 

' First-come,first-served (FCFS)'  Shortest-job-first (SJF)'  Round-robin (RR) - The quantum is set to 10 milliseconds'  Priority Scheduling (PS). 

 

Priorities range from 1 to 10, where a higher numeric value indicates a higher relative priority. This algorithm uses round-robin scheduling for tasks with equal priority. Your program should first read the schedule of tasks, insert the tasks into a list, and invoke the scheduler. The schedule of tasks has the form [task name] [priority] [CPU burst], with the following example format: 
Thus, task T1 has priority 4 and a CPU burst of 20 milliseconds, and so forth. It is assumed that all tasks arrive at the same time, so your scheduler algorithms do not have to support higher-priority processes pre-empting processes with lower priorities

To simulate the execution of a task burst in the CPU you may write a function (say execute()) where it simply increments a counter by the amount of the burst time. Your program should also take into consideration the context switch time by adding it to the overall time. Context switch time should be a command line parameter that is passed to your program along with the file name containing the list of tasks. Your program should be written in C (or C++) and output the average turnaround time, waiting time, response time for the scheduling algorithm along with the CPU utilization. And example of the command that executes your program may look like: scheduler -a RR -c 2 -f tasks.txt This should run the round Ruben (RR) algorithm with context switch of 2 milliseconds for the tasks in file tasks.txt. The command options are as follows. Note that optionsmay be provided in any order.? -a should be followed by the abbreviation of the scheduling algorithm. If this option is not followed by the abbreviation of the scheduling algorithm, the program should apply all scheduling algorithms to the provided file.? -c is followed by the context switch time? -f is followed by the file name of the tasks

image


Task "pickNextTask() { } Task #ret = next_node->task; next_node = (next_node->next) ? next_node->next; tasklist; return ret; void schedule() { next_node tasklist; while(tasklist) ( Task t = pickNextTask(); int slice = QUANTUM < t->remaining burst? QUANTUM t->remaining_burst; run(t, slice); t->remaining_burst -= slice; if(It->remaining burst) ( delete(&tasklist, t);

Step by Step Solution

3.40 Rating (150 Votes )

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

Probability & Statistics For Engineers & Scientists

Authors: Ronald E. Walpole, Raymond H. Myers, Sharon L. Myers, Keying

7th Edition

9789813131279, 130415294, 9813131276, 978-0130415295

More Books

Students also viewed these Programming questions

Question

At which conferences do students regularly present?

Answered: 1 week ago