FIRST COME FIRST SERVE
SUBMITTED BY:
Harmanjit Dhillon(B130010121)
Manav Khurana (B130010122)
Leepika Kapoor (B130010123)
Priyanka (B130010125)
Kanav Sood (B130010126)
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.
• 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.
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
 Once process grabs CPU,
former keeps latter until
completion
Rarely used in real-time
 Preemptive FCFS (with
priority scheme)
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
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
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
EXPLANATION WITH EXAMPLE
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.
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.
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.
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;
• 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");
• 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();
• }
Output To The Program
Scheduling Algorithms
Implementation - Analysis
• Direct analysis
– Pick a task set and observe results
• Apply queuing theory to obtain results
– Multi-level feedback queue scheme
• Simulations of scheme implementations
– FCFS, RR, STCF
• Innovations and projections
– “Lottery” scheduling and “own” algorithm
Scheduling Algorithms
References
1) Cooling, J.E. Software Design for Real-Time Systems. Chapman &
Hall, London, UK: 1995.
2) Stallings, William. Operating Systems: Internals and Design
Principles. Upper Saddle River, NJ: Prentice Hall, 1998.
3) http://www.cs.wisc.edu/~bart/537/lecturenotes/s11.html - viewed on
03/24/2000
4) Savitzky, Stephen. Real-Time Microprocessor Systems. Van Nostrand
Reinhold Company, N.Y.: 1985.
5) Undergraduate Operating System Course Notes (Ottawa University,
1998)
THANK YOU

First Come First Serve

  • 1.
    FIRST COME FIRSTSERVE SUBMITTED BY: Harmanjit Dhillon(B130010121) Manav Khurana (B130010122) Leepika Kapoor (B130010123) Priyanka (B130010125) Kanav Sood (B130010126)
  • 2.
    INTRODUCTION : • First-ComeFirst-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 Timeto 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 processgrabs 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 Timeto 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
  • 9.
  • 21.
    Evaluated Program And Parameters TheProgram 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 WaitingTime: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(); • }
  • 27.
  • 28.
    Scheduling Algorithms Implementation -Analysis • Direct analysis – Pick a task set and observe results • Apply queuing theory to obtain results – Multi-level feedback queue scheme • Simulations of scheme implementations – FCFS, RR, STCF • Innovations and projections – “Lottery” scheduling and “own” algorithm
  • 29.
    Scheduling Algorithms References 1) Cooling,J.E. Software Design for Real-Time Systems. Chapman & Hall, London, UK: 1995. 2) Stallings, William. Operating Systems: Internals and Design Principles. Upper Saddle River, NJ: Prentice Hall, 1998. 3) http://www.cs.wisc.edu/~bart/537/lecturenotes/s11.html - viewed on 03/24/2000 4) Savitzky, Stephen. Real-Time Microprocessor Systems. Van Nostrand Reinhold Company, N.Y.: 1985. 5) Undergraduate Operating System Course Notes (Ottawa University, 1998)
  • 30.