CPU SCHEDULING Flashcards
Define a CPU burst
The amount of time a process uses the processor
before it is no longer ready (aka Execution time)
What are the different types of CPU bursts
- long bursts – process is CPU bound (i.e. array work)
- short bursts – process I/O bound
What are the different scheduling criteria to compare scheduling algorithms
CPU Utilization
Throughput
Turnaround time
Waiting time
Response time
Describe CPU utilization as a criterion
Ideally the CPU would be busy 100% of the time, so as to waste
0 CPU cycles. On a real system CPU usage should range from
40% ( lightly loaded ) to 90% ( heavily loaded. )
Describe throughput as a criterion
Number of processes completed per unit time. May range from 10 / second to 1 / hour depending on the specific processes.
Describe Turnaround time as a criterion
Time required for a particular process to complete, from
submission time to completion. ( Wall clock time. )
Describe waiting time as a scheduling criterion
-How much time processes spend in the ready queue
waiting their turn to get on the CPU.
-( Load average - The average number of processes sitting in the ready queue waiting their turn to get into the CPU. Reported in 1-minute, 5-minute, and 15-minute averages by “uptime” and “who”. )
Describe response time as a scheduling criterion
The time taken in an interactive program from the
issuance of a command to the commence of a response
to that command.
List 6 examples of CPU scheduling algorithms
First-Come, First-Served (FCFS) Scheduling Algorithm Shortest-Job-Next (SJN) Scheduling Algorithm
Priority Scheduling Algorithm
Shortest Remaining Time First (SRTF) Scheduling Algorithm
Round Robin(RR) Scheduling Algorithm
Multiple-Level Queues Scheduling Algorithm
* Multi-level feedback Queues Scheduling Algorithm
Differentiate between preemptive and non-preemptive algorithms
Non-preemptive algorithms are designed so that once a
process enters the running state, it cannot be preempted
until it completes its allotted time, whereas the preemptive scheduling is based on priority where a scheduler may preempt a low priority running process anytime when a high priority process enters into a ready state
Describe the First Come Firs Serve algorithm
- Jobs are executed on first come, first serve basis.
- It is a non-preemptive scheduling algorithm.
- Easy to understand and implement.
- Its implementation is based on FIFO queue.
- Poor in performance as average wait time is high.
Describe the Shortest Job Next algorithm
-This algorithm picks a process based on the next shortest CPU burst,
- This is a non-preemptive, pre-emptive scheduling algorithm.
- Best approach to minimize waiting time.
- Easy to implement in Batch systems where required CPU time is known in advance.
- Impossible to implement in interactive systems where required CPU time is not known.
- The processer should know in advance how much time process will take.
Describe priority based algorithm
- Priority scheduling is a non-preemptive algorithm and one of the most common scheduling algorithms in batch systems.
- Each process is assigned a priority. Process with highest priority is to be executed first and so on.
How is priority determined? What happens when processes have the same priority
- Priority can be decided based on memory requirements, time requirements or any other resource requirement.
- Processes with same priority are executed on first come first served basis.
Describe the round robin algorithm
CPU bursts are assigned with a small unit of CPU time
called time quantum.
- When a process is given the CPU, a timer is set for whatever value has been set for a time quantum.
- If the process finishes its burst before the time quantum
timer expires, then it is swapped out of the CPU just like the normal FCFS algorithm.
- If the timer goes off first, then the process is swapped out of the CPU and moved to the back end of the ready queue.
- The ready queue is maintained as a circular queue, so when all processes have had a turn, then the scheduler gives the first process another turn, and so on.