0% found this document useful (0 votes)
11 views3 pages

RTOS Task-1 D26

The document discusses the First Come First Serve (FCFS) CPU scheduling algorithm, which operates like a FIFO queue where the first process to arrive is the first to be executed. It outlines the algorithm steps, pseudo code, and includes a flowchart for visual representation of the process. FCFS is easy to implement and is primarily used in batch systems.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views3 pages

RTOS Task-1 D26

The document discusses the First Come First Serve (FCFS) CPU scheduling algorithm, which operates like a FIFO queue where the first process to arrive is the first to be executed. It outlines the algorithm steps, pseudo code, and includes a flowchart for visual representation of the process. FCFS is easy to implement and is primarily used in batch systems.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Name :- Nishit Dudakiya

En No :- 92110133026
Subject :- RTOS
Sem :- 8th

TASK-1 : CPU Scheduling ( First Come First Serve- FCFS)

- First Come First Serve, is just like FIFO(First in First out) Queue
data structure, where the data element which is added to the
queue first, is the one who leaves the queue first.
- This is used in Batch Systems.
- It's easy to understand and implement programmatically, using
a Queue data structure, where a new process enters through
the tail of the queue, and the scheduler selects process from
the head of the queue.

• Algorithm for FCFS Scheduling :


1. Start
2. Input the number of processes and their burst times
3. Sort the processes based on their arrival times in ascending order
4. Initialize the total waiting time and average waiting time to 0
5. For each process in the sorted list:
- Calculate waiting time for the current process: waiting time of process i
=sum of burst times of processes before i
- Update total waiting time
6. Calculate average waiting time: average waiting time = total waiting
time / number of processes
7. Output the average waiting time
8. End
• Pseudo Code :-
FCFS_Scheduling(processes[], n):
Sort processes based on arrival times
total_waiting_time = 0
for i from 0 to n-1:
for j from 0 to i-1:
total_waiting_time += processes[j].burst_time
processes[i].waiting_time = total_waiting_time
average_waiting_time = total_waiting_time / n
return average_waiting_time

• Flow chart :-
[Start]
|
v
[Input data]
|
v
[Sort processes by arrival time]
|
v
[Initialize total_waiting_time = 0]
|
v
[For each process in sorted list]
|
v
[Calculate waiting time for the process]
|
v
[Update total_waiting_time]
|
v
[Calculate average_waiting_time]
|
v
[Output average_waiting_time]
|
v
[End]

You might also like