OSY Microproject
OSY Microproject
Marks out
Marks out
of 6 for
of 4 for Total marks
Roll No Name of student performan
performance in out of
ce in group
oral/Presentation 10
activity
20 Shingade Pratik Sukhadev
49 More Karan Sadanand
69 Kature Mayur Rajendra
76 Tamboli Musif Husen
Name &
Signature
of faculty ( Ms.Muttagi.V.R)
1
A PROJECT REPORT ON
“ First Come First Serve (FCFS) Algorithm”.
Submitted in partial fulfillment of the requirements of the award of degree
Of
DIPLOMA ENGINEERING
In
Information Technology
BY:-
SVERI’S
COLLEGE OF ENGINEERING (POLY). PANDHARPUR
2022-23
2
CERTIFICATE
The project-report entitled – “ First Come First Serve (FCFS) Algorithm ” .
submitted by
Roll No Name
20 Shingade Pratik Sukhadev
49 More Karan Sadanand
69 Kature Mayur Rajendra
76 Tamboli Musif Husen
Examiner Principal
(Prof. ) (Prof.Dr.N.D. Misal)
Date:
Place: Pandharpur
3
ACKNOWLEDGEMENT
I take this opportunity to express my sincere thanks and deep sense of gratitude to
my guide, Ms.Muttagi.V.R madam for his constant support, motivation, valuable guidance
and immense help during the entire course of this work. Without his constant
encouragement, timely advice and valuable discussion, it would have been difficult in
completing this work. I would also like to acknowledge Computer Department who
provided me the facilities for completion of the project. We are thankful to him for sharing
his experienced in research field with me and providing constant motivation during entire
principle.
Name of Students :-
Roll No Name
20 Shingade Pratik Sukhadev
49 More Karan Sadanand
69 Kature Mayur Rajendra
76 Tamboli Musif Husen
4
First Come First Serve (FCFS) Algorithm
1. RATIONALE:
Process Scheduling is an OS task that schedules processes of different states like ready,
waiting, and running. Process scheduling allows OS to allocate a time interval of CPU
execution for each process. Another important reason for using a process scheduling system
is that it keeps the CPU busy all the time. This allows you to get the minimum response time
for programs. It is done by various scheduling algorithms used by short-term scheduler, one
of them is a First Come First Serve (FCFS) algorithm.
4. Literature Review:
FCFS is the simplest scheduling algorithm. There is a single rule; schedule the first process
to arrive, and let it run to completion. This is a non-preemptive scheduling algorithm, which
means that only a single process can run at a time, regardless of whether it uses the resources
of the system effectively, and also regardless of whether there is a queue of other processes
waiting, and the relative importance of those processes. Due to these limitations, the
algorithm is not widely used but is included here as a baseline on which to compare other
simple algorithms [1].
5
5. Actual methodology Followed:
FCFS is the simplest CPU scheduling algorithm. With this algorithm, processes are
assigned the CPU in the order they request it. Basically, there is a single queue of ready
processes. Relative importance of jobs measured only by arrival time. The implementation of the
FCFS policy easily managed with a FIFO queue. When a process enters the ready queue, its
PBC is linked onto the tail of the queue. The average waiting time under the FCFS policy,
however, IS often quite long.
Example
Consider the processes P1, P2, P3, P4 given in the below table, arrives for execution in the same
order, with Arrival Time 0, and given Burst Time, let's find the waiting time, average waiting
time, turn around time, average turn around time using the FCFS scheduling algorithm.
Solution: -
Gantt Chart:
P2 P4 P1 P3
0 2 5 11 19
6
Waiting Time:
1. P1=5
2. P2=0
3. P3=11
4. P4=2
Code
#include<iostream>
using namespace std;
void findWaitingTime(int processes[], int n, int bt[], int wt[])
{
wt[0] = 0;
for (int i = 1; i < n ; i++)
{
wt[i] = bt[i-1] + wt[i-1];
}
}
void findTurnAroundTime( int processes[], int n, int bt[], int wt[], int tat[])
{
for (int i = 0; i < n ; i++)
{
tat[i] = bt[i] + wt[i];
}
7
}
void findAverageTime( int processes[], int n, int bt[])
{
int wt[n], tat[n], total_wt = 0, total_tat = 0;
findWaitingTime(processes, n, bt, wt);
findTurnAroundTime(processes, n, bt, wt, tat);
cout << "Processes "<< " Burst time "<< " Waiting time " << " Turn around time\n";
for (int i = 0; i < n; i++)
{
total_wt = total_wt + wt[i];
total_tat = total_tat + tat[i];
cout << " " << i+1 << "\t\t" << bt[i] <<"\t "<< wt[i] <<"\t\t " << tat[i] <<endl;
}
cout << "Average waiting time = "<< (float)total_wt / (float)n;
cout << "\nAverage turn around time = "<< (float)total_tat / (float)n;
}
int main()
{
int processes[] = { 1, 2, 3, 4};
int n = sizeof processes / sizeof processes[0];
int burst_time[] = {21, 3, 6, 2};
findAverageTime(processes, n, burst_time);
return 0;
}
8
6. Actual Resources Used:
In this way we have implemented the first come first serve algorithm with example.
9
8. Learning Outcomes of this Micro-Project:
1) We are able to calculate turnaround time and average waiting time of the
given scheduling algorithm
2) We have gained ability to develop such projects.
3) Coding knowledge has improved due to such projects.
1) In Batch OS, Batch Monitor uses FCFS scheduling algorithm to schedule batches.
2) Used in online reservation systems, ex- railway reservation.
3) Spooling in printers.
4) Buffer for devices like keyboard.
References
1. https://www.sciencedirect.com/topics/computer-science/first-come-first-
servedhttps://www.sciencedirect.com/topics/computer-science/first-
come-first-served
2. https://www.geeksforgeeks.org/program-for-fcfs-cpu-scheduling-set-1/
3. https://en.wikipedia.org/wiki/Scheduling_(computing)
4. https://en.wikibooks.org/wiki/Operating_System_Design/Scheduling_Pro
cesses/FCFS
5. https://www.techopedia.com/definition/23455/first-come-first-served-fcfs
10