0% found this document useful (0 votes)
15 views15 pages

OSY24

The document is a micro project report on the implementation of the First-Come, First-Served (FCFS) scheduling algorithm, submitted for a Diploma in Information Technology. It includes project details, acknowledgments, an introduction to process scheduling, characteristics, advantages and disadvantages of various scheduling algorithms, and a Java implementation of the FCFS algorithm. The conclusion emphasizes the simplicity and fairness of FCFS while noting its inefficiencies compared to more advanced scheduling methods.

Uploaded by

atharvchavan0911
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views15 pages

OSY24

The document is a micro project report on the implementation of the First-Come, First-Served (FCFS) scheduling algorithm, submitted for a Diploma in Information Technology. It includes project details, acknowledgments, an introduction to process scheduling, characteristics, advantages and disadvantages of various scheduling algorithms, and a Java implementation of the FCFS algorithm. The conclusion emphasizes the simplicity and fairness of FCFS while noting its inefficiencies compared to more advanced scheduling methods.

Uploaded by

atharvchavan0911
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 15

A

Micro project report On

“FCFS Algorithm Implementation”

SUBMITTED TO M.S.B.T.E., Mumbai

For the Award of


DIPLOMA IN INFORMATION TECHNOLOGY
BY

Roll no Name of Student Enrollment no


24 Kshitij Shrimant Chavan 2210740184
27 Prashant Keshav Gaikawad 2210740187
48 Varad Suraj Patil 2210740211
66 Prathmesh Hanumant Shelke 2212140140

UNDER THE GUIDANCE OF


Mr.Bhathlavande A.S
DEPARTMENT OF INFORMATION TECHNOLOGY
NBA ACCREDIATED

SVERI’s College of Engineering (Polytechnic), Pandharpur


Gopalpur Pandharpur-41330
2024-25

AFFILIATED TO

M.S.B.T.E.
Evolution sheet for Micro Project

Academic Year:- 2024-25 Name of Faculty:-Mr.A.S.Bhatlavande


Course:- Computer Engineering Course code:- CO5I
Subject:-Operating System Subject Code:- 22032
Semester:- V Scheme:- I

Title of Project:- FCFS Algorithm Implementation

COs addressed by the Micro Project:

Generate business ideas(product/service)for intrapreneurial


Co4
And Entrepreneurial opportunities through brainstorming.
Comments/Suggestions about team work/leadership/inter-personal communication (if any)

Marks out of 4
Marks out of 6 Total
for
for mars
Roll No Name of students performance
performance in out
in oral/
group activity of 10
Presentation

24 Kshitij Shrimant Chavan


27 Prashant Keshav Gaikawad
48 Varad Suraj Patil
66 Prathmesh Hanumant Shelke

Name and
Signature of
faculty
SVERI’s COLLEGE OF ENGINEERING (POLYTECHNIC), PANDHARPUR.

CERTIFICATE

This is to certify that the Project report entitled


“ FCFS Algorithm Implementation”
Submitted by

Roll no Name of Student Enrollment no


24 Kshitij Shrimant Chavan 2210740184
27 Prashant Keshav Gaikawad 2210740187
48 Varad Suraj Patil 2210740211
66 Prathmesh Hanumant Shelke 2212140140

is a bonafide work carried out by above students, under the guidance of Mr.Bhathlavande A.S and it is
submitted towards the fulfillment of requirement of MSBTE, Mumbai for the award of Diploma in
Information Technology at SVERI’s COE (Polytechnic), Pandharpur during the academic year 2024-25.

(Mr.Bhatlavande.A.S.)
Guide
(Mr. Bhandare P.S ) (Dr. Misal N. D.)
HOD Principal

Place: Pandharpur

Date:
Acknowledgement

I take this opportunity to express my sincere thanks and deep sense of gratitude to my guide
Mr.Bhatlavande.A.S. 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 Engineering 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 project work.
Introduction

First-Come, First-Served (FCFS) is a straightforward, non-preemptive scheduling algorithm that


processes tasks in the order they arrive in the ready queue. It is simple to implement and treats all
processes equally, ensuring fairness. However, FCFS can lead to high average waiting and turnaround
times, especially when shorter processes are delayed by longer ones, resulting in the "convoy effect."
Despite its limitations, FCFS is useful in certain batch processing scenarios.
 What is Process Scheduling?

Process scheduling is the activity of the process manager that handles the removal of the running
process from the CPU and the selection of another process based on a particular strategy.

Process scheduling is an essential part of a Multiprogramming operating system. Such operating


systems allow more than one process to be loaded into the executable memory at a time and the loaded
process shares the CPU using time multiplexing.

Fig.CPU scheduling Classification

 Categories of Scheduling

 Scheduling falls into one of two categories:

1. Non-Preemptive:

In this case, a process’s resource cannot be taken before the process has finished running. When a
running process finishes and transitions to a waiting state resources are switched.

2. Preemptive:

In this case, the OS assigns resources to a process for a predetermined period. The process switches
from running state to ready state or from waiting state to ready state during resource allocation. This
switching happens because the CPU may give other processes priority and substitute the currently
active process for the higher priority process.
1. Shortest Remaining Time Next (SRTN):

Shortest remaining time next is the preemptive version of the Shortest job first which we have
discussed earlier where the processor is allocated to the job closest to completion. In SRTF the process
with the smallest amount of time remaining until completion is selected to execute.

 Characteristics of SRTN

1. SRTF algorithm makes the processing of the jobs faster than SJF algorithm, given it’s overhead
charges are not counted.
2. The context switch is done a lot more times in SRTN than in SJF and consumes the CPU’s
valuable time for processing. This adds up to its processing time and diminishes its advantage of
fast processing.

 Advantages of SRTN

1. In SRTF the short processes are handled very fast.


2. The system also requires very little overhead since it only makes a decision when a process
completes or a new process is added.

 Disadvantages of SRTN

1. Like the shortest job first, it also has the potential for process starvation.
2. Long processes may be held off indefinitely if short processes are continually added.

.
2.Shortest Job First (SJF):
Shortest job first (SJF) is a scheduling process that selects the waiting process with the smallest
execution time to execute next. This scheduling method may or may not be preemptive. Significantly
reduces the average waiting time for other processes waiting to be executed. The full form of SJF is
Shortest Job First.

 Advantages of SJF :-

1. As SJF reduces the average waiting time thus, it is better than the first come first serve scheduling
algorithm.
2. SJF is generally used for long term scheduling

 Disadvantages of SJF :-

1. One of the demerit SJF has is starvation.


2. Many times it becomes complicated to predict the length of the upcoming CPU request
3. Round Robin:

Round Robin is a CPU scheduling algorithm where each process is cyclically assigned a fixed time
slot. It is the preemptive version of First come First Serve CPU Scheduling algorithm. Round Robin
CPU Algorithm generally focuses on Time Sharing technique.

 Characteristics of Round robin:-

1. It’s simple, easy to use, and starvation-free as all processes get the balanced CPU allocation.
2. One of the most widely used methods in CPU scheduling as a core.
3. It is considered preemptive as the processes are given to the CPU for a very limited time.

 Advantages of Round robin:-

1. Round robin seems to be fair as every process gets an equal share of CPU.
2. The newly created process is added to the end of the ready queue.

 Disadvantages 0f round robin algorithm:-

1. Context Switching Overhead: Frequent context switching between processes can lead to
increased overhead, as the CPU must save and load process states. This can degrade overall
system performance, especially with a large number of processes.
2. Average Waiting Time: While RR aims to reduce the waiting time for processes, if the time
quantum is too large, it can lead to increased waiting times for shorter processes. Conversely, if
the time quantum is too small, the overhead from context switching can negate the benefits of
reduced waiting times.
4. First Come First Serve:
FCFS considered to be the simplest of all operating system scheduling algorithms. First come first
serve scheduling algorithm states that the process that requests the CPU first is allocated the CPU first
and is implemented by using FIFO queue.

 Characteristics of FCFS:-

1. FCFS supports non-preemptive and preemptive CPU scheduling algorithms.


2. Tasks are always executed on a First-come, First-serve concept.
3. FCFS is easy to implement and use.
4. This algorithm is not much efficient in performance, and the wait time is quite high.

 Advantages of FCFS:-

1. Easy to implement
2. First come, first serve method

 Disadvantages of FCFS:-

1. FCFS suffers from Convoy effect.


2. The average waiting time is much higher than the other algorithms.
3. FCFS is very simple and easy to implement and hence not much efficient.
 Implementation of FCFS algorithm:
import java.util.Scanner;

class Process {
int processId;
int burstTime;
int arrivalTime;
int waitingTime;
int turnaroundTime;

public Process(int id, int burst, int arrival) {


this.processId = id;
this.burstTime = burst;
this.arrivalTime = arrival;
}
}

public class FCFS {

public static void findWaitingTime(Process[] processes, int n) {


processes[0].waitingTime = 0; // First process has no waiting time

// Calculate waiting time for each process


for (int i = 1; i < n; i++) {
processes[i].waitingTime = processes[i - 1].waitingTime + processes[i - 1].burstTime;
}
}

public static void findTurnaroundTime(Process[] processes, int n) {


// Calculate turnaround time for each process
for (int i = 0; i < n; i++) {
processes[i].turnaroundTime = processes[i].burstTime + processes[i].waitingTime;
}
}

public static void findAvgTime(Process[] processes, int n) {


findWaitingTime(processes, n);
findTurnaroundTime(processes, n);

float totalWaitingTime = 0, totalTurnaroundTime = 0;

System.out.println("\nProcess ID\tBurst Time\tArrival Time\tWaiting Time\tTurnaround Time");


for (int i = 0; i < n; i++) {
System.out.printf("%d\t\t%d\t\t%d\t\t%d\t\t%d\n",
processes[i].processId,
processes[i].burstTime,
processes[i].arrivalTime,
processes[i].waitingTime,
processes[i].turnaroundTime);

totalWaitingTime += processes[i].waitingTime;
totalTurnaroundTime += processes[i].turnaroundTime;
}

System.out.printf("\nAverage Waiting Time: %.2f", totalWaitingTime / n);


System.out.printf("\nAverage Turnaround Time: %.2f\n", totalTurnaroundTime / n);
}

public static void main(String[] args) {


Scanner scanner = new Scanner(System.in);

System.out.print("Enter the number of processes: ");


int n = scanner.nextInt();
Process[] processes = new Process[n];

// Input process details


for (int i = 0; i < n; i++) {
System.out.print("Enter Burst Time and Arrival Time for Process " + (i + 1) + ": ");
int burstTime = scanner.nextInt();
int arrivalTime = scanner.nextInt();
processes[i] = new Process(i + 1, burstTime, arrivalTime); // Process ID starts from 1
}
// Sort processes based on arrival time (FCFS)
for (int i = 0; i < n - 1; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (processes[j].arrivalTime > processes[j + 1].arrivalTime) {
Process temp = processes[j];
processes[j] = processes[j + 1];
processes[j + 1] = temp;
}
}
}

findAvgTime(processes, n);
scanner.close();
}
}
 Output:
 Conclusion:

While FCFS is a simple and fair scheduling algorithm, its inefficiencies in terms of average waiting
time and responsiveness make it less suitable for modern operating systems that require high
performance and interactivity. For systems with a mix of short and long processes or in time-sharing
environments, more sophisticated algorithms such as Shortest Job First (SJF), Round Robin (RR), or
Priority Scheduling are often preferred. However, FCFS can still be effective in certain scenarios,
particularly in batch processing systems where processes have similar execution times or in
educational contexts where simplicity is valued.

 Reference :

1. https://edurev.in/question/2642097
2. https://www.geeksforgeeks.org

3. https://www.blackbox.org

You might also like