FIRST COME FIRST SERVE SCHEDULING WITH & WITHOUT ARRIVAL TIME – SHOUT CODERS

8 Likes Comment
Programming

This program is to implement CPU & scheduling algorithm for first come first serve scheduling. That is, First process can execute directly, Second process can execute after completion of first process, and so on. Waiting time of every process is nothing but the difference between previous process service time and arrival time of that process. Completion time of every process is the addition of it’s turn around time with arrival time.

A quick guide on FCFS scheduling algorithm is cover in this article.


ALGORITHM:

  1. Start the program.
  2. Get the number of processes and their burst time.
  3. Initialize the waiting time for process 1 and 0.
  4. Process for(i=2;i<=n;i++),wt.p[i]=p[i-1]+bt.p[i-1].
  5. The waiting time of all the processes is summed then average value time is calculated.
  6. The waiting time of each process and average times are displayed
  7. Stop the program

WITH OUT ARRIVAL TIME:

C PROGRAM :

PYTHON PROGRAM:

INPUT/OUTPUT:
enter the no of process 3
enter the burst time 2
enter the burst time 4
enter the burst time 6
Process sid bt wt tt
1 2 0 2
2 4 2 6
3 6 6 12
Avg Waiting time=2 Avg Turnaround time=6

.

WITH ARRIVAL TIME:

PYTHON PROGRAM:

INPUT/OUTPUT:

Enter the number of process: 3
Process 1 :
Enter the burst time 2
Enter the arrival time 0
Process 2 :
Enter the burst time 4
Enter the arrival time 1
Process 3 :
Enter the burst time 6
Enter the arrival time 2

Process sid BT WT TT CT
1 2 0 2 2
2 4 1 5 6
3 6 4 10 12
Avg Waiting time= 1 Avg Turn Arount Time= 5

.

Thus the FIFO process scheduling program was executed and verified successfully. The average waiting time is not optimal. Process terminates after completion of the execution. When process terminated it is denoted as Turnaround time. When process enters into the execution part at that time minus arrival time is noted as Waiting time. Every process has it’s own waiting time and turn around time.

You might like

SK. Saifuddin

About the Author: SK. Saifuddin

Leave a Reply

Your email address will not be published. Required fields are marked *

Close Bitnami banner
Bitnami