Interrupts and Scheduling Algorithms Flashcards
What is an interrupt?
Interrupts are signals generated by software or hardware to indicate to the processor that a process needs attention.
Different types of interrupts have different…
priorities and how urgent they are must be taken into account by the operating system when allocating processor time.
How are interrupts evaluated?
Interrupts are stored in order of their priority within an abstract data structure called a priority queue in a special register known as an interrupt register. It is the job of the operating system to ensure interrupts are serviced fairly by the processor through the Interrupt Service Routine (ISR).
Describe the mechanics of the Interrupt Service Routine.
The processor checks the contents of the interrupt register at the end of each Fetch-Decode-Execute cycle. If an interrupt exists that is of a higher priority to the process being executed, the current contents of the special purpose registers in the CPU are temporarily transferred into a stack. The processor then responds to the interrupt by loading the appropriate ISR into RAM. A flag is set to signal the ISR has begun. Once the interrupt has been serviced, the flag is reset. The interrupt queue is checked again for further interrupts of a higher priority to the process that was originally being executed.
What does ISR stands for?
Interrupt Service Routine
How does the OS manages the execution of different programs?
The OS implements various scheduling algorithms that, albeit working in different ways, ensure all sections of programs being run (known as ‘jobs’) receive a fair amount of processing time.
What are the 2 types of scheduling algorithms?
Pre-emptive and non pre-emptive algorithms
What are some examples of pre-emptive algorithms?
Multilevel Feedback Queues, Shortest Remaining Time, Round Robin
What are some examples of non pre-emptive algorithms?
First Come First Served, Shortest
Job First
What are the characteristics of pre-emptive algorithms?
Jobs are actively made to start and stop by the OS.
What are the characteristics of non pre-emptive algorithms?
Once a job is started, it is left alone until it is completed.
Describe the mechanics of the Round robin algorithm.
Each job is given a fixed section of processor time - known as a time slice - within which it is allowed to execute. Once each job in the queue has used its first time slice, the operating system again grants each job an equal slice of processor time. This continues until a job has been completed, at which point it is removed from the queue.
What are the advantages of the Round Robin algorithm?
Round Robin ensures each job is seen to.
What are the disadvantages of the Round Robin algorithm?
- Longer jobs will take a much longer time for completion due to their execution being inefficiently split up into multiple cycles.
- This algorithm also does not take into account job priority
Describe the mechanics of First come first served algorithm.
Jobs are processed in chronological order by which they entered the queue.