Chapter 5: CPU Scheduling Flashcards
Selects from among the processes in memory that are ready to execute, and allocates the CPU to one of them
CPU Scheduler
CPU scheduling decisions may take place when a process:
- Switches from running to waiting state
- Switches from running to ready state
- Switches from waiting to ready
- Terminates
Scheduling under 1 and 4 is
nonpreemptive
All other scheduling is
preemptive
gives control of the CPU to the process selected by the short-term scheduler; this involves:
switching context
switching to user mode
jumping to the proper location in the user program to restart that program
Dispatcher module
time it takes for the dispatcher to stop one process and start another running
Dispatch latency
amount of time to execute a particular process(finish time - submitted time)
Turnaround time
amount of time a process has been waiting in the ready queue(turnaround time - cpu burst time)
Waiting time
amount of time it takes from when a request was submitted until the first response is produced, not output (for time-sharing environment)
Response time
of processes that complete their execution per time unit
Throughput
Max CPU utilization Max throughput Min turnaround time Min waiting time Min response time
Optimization Criteria
FCFC (First Come First Serve) is…
Non preemptive scheduling
Associate with each process the length of its next CPU burst. Use these lengths to schedule the process with the shortest time
Shortest-Job-First (SJF) Scheduling
Two schemes:
nonpreemptive – once CPU given to the process it cannot be preempted until completes its CPU burst
preemptive – if a new process arrives with CPU burst length less than remaining time of current executing process, preempt. This scheme is know as the Shortest-Remaining-Time-First (SRTF)
Shortest-Job-First (SJF) Scheduling
is optimal – gives minimum average waiting time for a given set of processes
SJF