Scheduling Flashcards
What is scheduling?
Scheduling allows one process to use the CPU while the execution of another process is on hold (i.e. waiting state) due to unavailability of any resource like I/O etc (part of the process manager). It handles the removal of the running processes from the CPU and the selection fo another process. It is also responsible for multiplexing processes on the CPU. The scheduling algorithm will determine the order in which the OS will execute the processes.
Describe the Schedular Organisation.
When a process is changed in the ready state, the enqueuer places a pointer to the process descriptor into a ready list. Context switcher saves the content of all processor registers of the process being removed into the process’ descriptor, whenever the scheduler switches the CPU from executing a process to executing anoter (voluntarily/involuntarily context switch). The dispatcher is invoked after the current process has been removed from the CPU.
Name the two types of Schedulers.
Cooperative scheduler (voluntary CPU sharing).
Preemptive scheduler (involuntary CPU sharing)
Describe the two scheduler types, Cooperative and Preemptive scheduling.
Cooperative - Each process will periodically invoke the process scheduler, voluntarily sharing the CPU. Each process should call a function that will implement the process scheduling. It allows much simpler implementation of applications because their execution is never unexpectedly interrupted by the process scheduler.
Preemptive - the interrupt sytem enforces periodic involuntary interruption of any process’s execution. It can force a process to involuntarily execute a yield type function. This is done by incorportating an interval timer device that produces an interrupt whenever the time expires. The interrupt handler will call the scheduler to reschedule the processor without any action on the part of the running process.
What is the problem with cooperative scheduler?
One process could keep the CPU forever.
Name 2 strategies used to select the next running process.
Non-preemptive strategy and preemptive strategy.
Describe what is meant by non-preemtptive selection strategies.
Allow any process to run to completion once it has been allocated te control of the CPU. A process that gets the control of the CPU, releases the CPU whenever it ends or when it voluntarily gives up the control of the CPU.
Describe what is meant by preemtptive selection strategies.
The highest priority process among all ready processes is allocated the CPU. All lower priority processes are made to yeild to the highest priority process whenever it requests the CPU. It allows for equitable resource sharing among processes at the expense of overloading the system
What are the follow shortened Scheduling Algorithms :
1. FCFS
2. SJF
3. SRTN
4. Time slice = ?
5. MLQ
6. MLQF
- First Come First Serve
- Shortest Job First
- Shortest Remaining TIme Next
- Round Robin
- Multiple Level Queue
- Multiple Level Queue with Feedback
How do you calculate the Turnaround time?
Completion Time - Arrival Time
How do you calculate the Waiting time?
Turnaround Time - Burst Time
Which of the following Algorithms are preemptive or non-preemptive? FCFS, SJF, SRJN, Time Slice
FCFS - non-preemptive
SJF - non-preemptive
SRTN - preemptive
Time Slice - preemptive
Explain what happens in the Time Slice Algorithm.
Each process gets a time slice of CPU time, distributing the processing time equitably among all processes requesting the processor. Whenever a time slice expires, the control of the CPU is given to the next process in the ready list. It is not well suited for long jobs, since the scheduler will be called multiple times until the job is done. It is very sensitive to the size of the time slice.
What is Priority Based Scheduling? Is it preemptive or non-preemptive?
There are both preempitve and non-preemptive variants.
Each process has an externally assigned priority and every time an event occurs that generates a process switch, the process with the highest priority is chosen from the ready process list.
What is a problem, and the solution to that problem, with priority based scheduling?
Problem: The lower priority processes will never gain CPU time.
Solution: Use dynamic priorities so that the longer a process waits, the higher its priority is.