Question

In: Computer Science

An operating system uses the First-Come, First-Served (FCFS) CPU scheduling algorithm. Consider the following set of...

An operating system uses the First-Come, First-Served (FCFS) CPU scheduling algorithm.

Consider the following set of processes in this OS, with the length of the CPU burst time given in milliseconds, and the shown priority. A larger priority number implies a higher priority. There is no pre-emption.

The processes are assumed to have arrived in the order P1, P2, P3, P4, P5, all at time 0.

Process Burst Time Priority
P1 2 2
P2 1 5
P3 4 1
P4 6 4
P5 3 3

a) Draw a Gantt chart illustrating the order of execution of these processes, showing their completion times.

b) Calculate each process’ waiting time, and then compute the average waiting time for this set.

Note:  waiting time = completion time – arrival time – burst time

=> Write your answers on scratch paper (make sure it is visible) then take a picture of it and upload it here.

Solutions

Expert Solution

As given that the larger priority number implies higher priority means 5 is the highest priority while 1 is the lowest priority.

Process

Burst Time

Priority

P1

2

2

P2

1

5

P3

4

1

P4

6

4

P5

3

3

a)

All process are arriving at time 0.

So process based on the higher priority is executed first. Process P2 has a higher priority which is 5. so first process P2 is executed and completed at time 1. Then process p4 has higher priority which is 4. so second process P4 is executed . Then process P5 has higher priority which is 3. so third process P5 is executed. Then process P1 has higher priority which is 2. so then process P1 is exceuted . Then process P3 is executed.

Gantt Chart:

P2

P4

P5

P1

P3

0                        1                         7                           10                       12   16

b)

Waiting time of each process:

P1 = 12 - 0 - 2 =10

P2 = 1 - 0 - 1 = 0

P3 = 16 - 0 - 4 = 12

P4 = 7 - 0 - 6 = 1

P5 = 10 - 0 - 3 = 7

Average waiting time = ( 10 + 0 + 12 + 1 + 7) / 5

= 30 / 5

=6

So average waiting time is 6.


Related Solutions

List of six process scheduling algorithms (for operating systems): First-Come, First-Served (FCFS) Scheduling Shortest-Job-Next (SJN) Scheduling...
List of six process scheduling algorithms (for operating systems): First-Come, First-Served (FCFS) Scheduling Shortest-Job-Next (SJN) Scheduling Priority Scheduling Shortest Remaining Time Round Robin(RR) Scheduling Multiple-Level Queues Scheduling Compare and contrast the algorithms against one another here. You have at least six algorithms, so this should be an extensive part of the project, and all research based.
in C++ We are going to implement the following scheduling algorithms 1. First-Come First-Served (FCFS) 2....
in C++ We are going to implement the following scheduling algorithms 1. First-Come First-Served (FCFS) 2. Shortest Remaining Time First (SRTF) 3. Highest Response Ratio Next (HRRN) 4. Round Robin, with di_erent quantum values (RR) We are interested to compute the following metrics, for each experiment: _ The average turnaround time _ The total throughput (number of processes done per unit time) _ The CPU utilization _ The average number of processes in the ready queue The simulator needs to...
First-Come, First-Served (FCFS) Scheduling Shortest-Job-Next (SJN) Scheduling Priority Scheduling Shortest Remaining Time Round Robin(RR) Scheduling Multiple-Level...
First-Come, First-Served (FCFS) Scheduling Shortest-Job-Next (SJN) Scheduling Priority Scheduling Shortest Remaining Time Round Robin(RR) Scheduling Multiple-Level Queues Scheduling Provide a timing example of each of the algorithms above. List some processes (at least four) with the appropriate properties for creating a time diagram (such as Process ID, Arrival Time, Burst Time, and Execution Time). Walk through the timing diagram identifying the algorithm you’re using and state which process goes first, which process finishes first, etc.
Implement the CPU scheduling algorithm FCFS non-preemptive in python. Have the program answer the table. Simulate...
Implement the CPU scheduling algorithm FCFS non-preemptive in python. Have the program answer the table. Simulate and evaluate with the set of eight processes below. Assumptions: All processes are activated at time 0 Assume that no process waits on I/O devices. After completing an I/O event, a process is transferred to the ready queue. Waiting time is accumulated while a process waits in the ready queue. Turnaround time is a total of (Waiting time) + (CPU burst time) + (I/O...
For First Come First Served (FCFS), -What is the arrival time, completion time, burst time, turnaround...
For First Come First Served (FCFS), -What is the arrival time, completion time, burst time, turnaround time, and the waiting time? -discuss these terms further as they pertain to the efficiency of the algorithm as well as properties such as starvation. -Pros and Cons of FCFS
Hi Guys, The assignment in Process Scheduling Operating System to write C code that implement FCFS...
Hi Guys, The assignment in Process Scheduling Operating System to write C code that implement FCFS & Round-Robin ( Without using any array) but we can use linkedlist
What is the average waiting time for Processes If Operating System uses the First Come First...
What is the average waiting time for Processes If Operating System uses the First Come First Serve (FCFS) Scheduling Algorithm? (P1=5 ms, P2=10 ms, P3=15 ms) Process Order: P2, P1, P3 Select one: a. 8.3 b. 11.7 c. 10 d. 6.7
Consider the following set of jobs to be scheduled for execution on a single CPU system....
Consider the following set of jobs to be scheduled for execution on a single CPU system. Job Arrival Time Burst (msec) Priority A 0 6 3 (Silver) B 1 2 1 (Diamond) C 3 5 3 (Silver) D 5 3 4 (Bronze) E 7 2 2 (Gold)    (a)     Draw a Gantt chart showing First-Come-First-Served (FCFS) scheduling for these jobs. (b)     Draw a Gantt chart showing preemptive PRIORITY scheduling. (c)    Draw a Gantt chart showing Highest Response Ratio Next (HRRN) scheduling. (d)     Draw a...
Consider the following set of jobs to be scheduled for execution on a single CPU system....
Consider the following set of jobs to be scheduled for execution on a single CPU system. Job Arrival Time Burst (msec) Priority A 0 6 3 (Silver) B 1 2 1 (Diamond) C 3 5 3 (Silver) D 5 3 4 (Bronze) E 7 2 2 (Gold)    Draw a Gantt chart showing First-Come-First-Served (FCFS) scheduling for these jobs.       Draw a Gantt chart showing preemptive PRIORITY scheduling. Draw a Gantt chart showing Highest Response Ratio Next (HRRN) scheduling.     Draw a...
Consider the following set of jobs to be scheduled for execution on a single CPU system....
Consider the following set of jobs to be scheduled for execution on a single CPU system. Job Arrival Time Burst (msec) Priority A 0 6 3 (Silver) B 1 2 1 (Diamond) C 3 5 3 (Silver) D 5 3 4 (Bronze) E 7 2 2 (Gold)    (a)     Draw a Gantt chart showing First-Come-First-Served (FCFS) scheduling for these jobs. (b)     Draw a Gantt chart showing preemptive PRIORITY scheduling. (c)    Draw a Gantt chart showing Highest Response Ratio Next (HRRN) scheduling. (d)     Draw a...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT