P3L1 Scheduling - Introduction Flashcards
Visual Metaphor
An OS scheduler is like ___________________________
- Toy shop manager dispatches orders immediately as they arrive is like ___________
- This method reduces ______________
- Toy shop manager dispatches simple orders first is like ________________
- This method maximizes ___________
- Toy shop manager dispatches complex orders first is like ______________
- This method utilizes ____________
… a toy shop manager
- Toy shop manager dispatches orders immediately as they arrive is like First Come First Served (FCFS)
- This method reduces order processing overhead
- Toy shop manager dispatches simple orders first is like Shortest Jobs First (SJF)
- This method maximizes throughput
- Toy shop manager dispatches complex orders first is like scheduling complex tasks first, interleave short jobs
- This method utilizes resources (like CPU, devices, memory)
As in the toy shop manager metaphor for OS scheduling, list 3 approaches an OS can take to scheduling tasks (threads/processes) and the advantages of each:
- first come first served (less overhead to decide things)
- Shortest Job First (SJF) - high throughput
- Complex jobs first - uses resources, cpu, memory, devices .. once in a while do short jobs to keep throughput high
The CPU scheduler decides how and when the processes (and their threads) access the ______ _____ .
The scheduler concerns the scheduling of both ____ level tasks and _____ level tasks.
The scheduler selects one of the tasks in the ______ ______ and then schedules it on the ____.
The CPU scheduler decides how and when the processes (and their threads) access the shared CPUs.
The scheduler concerns the scheduling of both user level tasks and kernel level tasks.
The scheduler selects one of the tasks in the ready queue and then schedules it on the CPU.
List 4 ways a task may become ready for scheduling
- I/O request - An I/O operation they have been waiting on is completed
- Time slice expired - Wake interrupt
- Fork - Task was created
- Wait for interrupt - Interrupted thread (was ready on the CPU, so when interrupted goes right on the ready queue)
The OS scheduler runs when the CPU becomes ______.
For example, if a task makes an I/O request and is placed on the ______ queue for that device, the scheduler has to select a new task from the _______ queue to run on the CPU.
The OS scheduler runs when the CPU becomes idle.
For example, if a task makes an I/O request and is placed on the wait queue for that device, the scheduler has to select a new task from the ready queue to run on the CPU.
A common way that schedulers share time within the system is by giving each task some amount of time on the CPU. This is known as a _______. When a _______expires, the scheduler must be run.
Once the scheduler selects a task to be scheduled, that task is dispatched onto the _______.
The operating system
- ______ ______ to the new task
- enters _____ mode
- sets the _______ ______, and execution begins.
In summary, the objective of the OS scheduler is to choose the next task to run from the ready queue.
A common way that schedulers share time within the system is by giving each task some amount of time on the CPU. This is known as a timeslice. When a timeslice expires, the scheduler must be run.
Once the scheduler selects a task to be scheduled, that task is dispatched onto the CPU.
The operating system
- context switches to the new task
- enters user mode
- sets the program counter, and execution begins.
In summary, the objective of the OS scheduler is to choose the next task to run from the ready queue.
In one sentence, what is the objective of the OS scheduler?
The objective of the scheduler is to choose the next task to run from the ready queue
What’s a task in the context of scheduling?
A process or a thread
List 2 questions to answer in the design of an OS scheduler
- Which task to select? (scheduling policy/algorithm).
- How to schedule?(runqueue data structure)
What’s the name of the main scheduling data structure?
runqueue
True or False?
For each scheduling algorithm, the scheduling data structure is different.
True because runqueue scheduling algorithm is tightly coupled to the data structure that best supports it.
In summary, the objective of the OS scheduler is to choose the next task to run from the ________ ________
How do we decide which task to be selected? This depends on the scheduling policy/algorithm.
How does the scheduler accomplish its job?
This depends very much on the structure of ready queue, also known as a runqueue.
The design of the _______ and the _________ algorithm are tightly coupled: a _____ _________that is optimized for one ________ may be a poor choice for implementing another.
![](https://s3.amazonaws.com/brainscape-prod/system/cm/281/165/398/q_image_thumb.png?1561172507)
In summary, the objective of the OS scheduler is to choose the next task to run from the ready queue.
How do we decide which task to be selected? This depends on the scheduling policy/algorithm.
How does the scheduler accomplish its job?
This depends very much on the structure of ready queue, also known as a runqueue.
The design of the runqueue and the scheduling algorithm are tightly coupled: a data structure that is optimized for one algorithm may be a poor choice for implementing another.