This presentation is a short description to the first come first algorithm used in various data structures by the computer.
Report
Share
Report
Share
1 of 30
More Related Content
First Come First Serve
1. FIRST COME FIRST SERVE
SUBMITTED BY:
Harmanjit Dhillon(B130010121)
Manav Khurana (B130010122)
Leepika Kapoor (B130010123)
Priyanka (B130010125)
Kanav Sood (B130010126)
2. INTRODUCTION :
• First-Come First-Serve (FCFS)
– One ready queue;
– OS runs the process at head of the queue;
– New processes come in at the end of the queue;
– Running process does not give up the CPU until it
terminates or it performs IO.
• Round Robin
– Process runs for one time slice, then moved to back of the
queue;
– Each process gets equal share of the CPU.
3. • Shortest Time to Completion (STCF)
– Process with shortest computation time left is picked;
– Varianted by preemption;
– Requires knowledge of the future.
• Exponential Queue (Multi-level Feedback)
– Gives newly runnable processes a high priority and a very
short time slice;
– If process uses up the time slice without blocking then
decrease priority by one and double time slice for next time;
– Solves both efficiency and response time problems.
4. Scheduling Algorithms
First-Come First-Serve
• Non-preemptive FCFS (no priority scheme)
– Simplest implementation of scheduling
algorithms
– Used on timeshared systems (with timer
interruption)
• Non-preemptive FCFS (with priority scheme)
– Next highest priority process is picked
when CPU is yielded
5. Once process grabs CPU,
former keeps latter until
completion
Rarely used in real-time
Preemptive FCFS (with
priority scheme)
6. Scheduling Algorithms
Round Robin
• Used mostly on timeshared
systems
• Allows multiple users slices
of the CPU on a “round
robin” basis
• Majority of users have the
same priority
• Not a popular scheme with
dynamic priority systems
7. Scheduling Algorithms
Shortest Time to Completion
• Priorities are assigned in inverse order of time needed for completion
of the entire job
• Minimizes average turnaround time
• Exponential averaging is used to estimate the process’ burst duration
• A job exceeding the resource estimation is aborted
• A job exceeding the time estimation is preempted
• Store estimated value in PCB for the current burst, and compare with
actual value
8. Scheduling Algorithms
Exponential Queues
• Popular in interactive systems
• A single queue is maintained for each
priority level
• A new process is added at the end of the
highest priority queue
– It is alloted a single time quantum when
it reaches the front
• If it yields the CPU within the time
quantum, it is moved to the rear
• If not, it is placed at the rear of the next
queue down
• Dispatcher selects the head of the
highest priority queue
– A job that “succeeds” moves up
– A job that “fails” moves down
21. Evaluated Program And
Parameters
The Program helps us find the total
time a person has worked on to set
up his career and waited to work at
the position he desired to in his
life.
22. Parameters:
1.Number Of Processes: The total number of
tasks he has performed to achieve his job and
his job as well
2.Process Name: The process he has worked on
in his entire life.
3.Process Time: The time he has spent on one
process.
4.Waiting Time: The time he has waited to
enter every task.
23. 5. Total Waiting Time:The Total amount of
time waited for this event, in hundredths of
a second.
6. Average Waiting Time:The total amount of
waiting time divided by the number of
incoming calls answered.
24. Program Worked On
• #include<stdio.h>
• #include<conio.h>
• int main()
• {
• char p[100][100];
• int tot=0,wt[10],pt[10],z,n,i;
• float avg=0;
• printf("n enter number of process :");
• scanf("%d",&n);
• wt[0]=0;
25. • for(i=1;i<=n;i++)
• {
• printf("n enter process %d name : ",i);
• scanf("%s",&p[i-1]);
• printf("enter process time : ");
• scanf("%d",&pt[i-1]);
• wt[i]=wt[i-1]+pt[i-1];
• tot=tot+wt[i];
• }
• avg=(float)tot/n;
• printf("n p-nametp-timetw-time n");
26. • for (i=0;i<n;i++)
• printf("%st%dt%dn",p[i],pt[i],wt[i]);
• printf("n total waiting time : %d n avg
wating time : %f nn ",tot ,avg);
• getch();
• }