Operating Systems III. Scheduling - Eurecomsoc.eurecom.fr/OS/docs/CourseOS_III_Scheduling.pdfI...
Transcript of Operating Systems III. Scheduling - Eurecomsoc.eurecom.fr/OS/docs/CourseOS_III_Scheduling.pdfI...
![Page 1: Operating Systems III. Scheduling - Eurecomsoc.eurecom.fr/OS/docs/CourseOS_III_Scheduling.pdfI Static priority or dynamic priority I The process with the higher priority (may be the](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa523e27f8b9ae7438cfc7f/html5/thumbnails/1.jpg)
Operating Systems
III. Scheduling
Ludovic [email protected], office 470
http://soc.eurecom.fr/OS/
@OS Eurecom
![Page 2: Operating Systems III. Scheduling - Eurecomsoc.eurecom.fr/OS/docs/CourseOS_III_Scheduling.pdfI Static priority or dynamic priority I The process with the higher priority (may be the](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa523e27f8b9ae7438cfc7f/html5/thumbnails/2.jpg)
Basics of SchedulingScheduling algorithms
Scheduling in Windows, Linux and Android
DefinitionsSwitching Between Processes
Outline
Basics of SchedulingDefinitionsSwitching Between Processes
Scheduling algorithms
Scheduling in Windows, Linux and Android
2/35 Fall 2017 Institut Mines-Telecom Operating Systems - Scheduling
![Page 3: Operating Systems III. Scheduling - Eurecomsoc.eurecom.fr/OS/docs/CourseOS_III_Scheduling.pdfI Static priority or dynamic priority I The process with the higher priority (may be the](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa523e27f8b9ae7438cfc7f/html5/thumbnails/3.jpg)
Basics of SchedulingScheduling algorithms
Scheduling in Windows, Linux and Android
DefinitionsSwitching Between Processes
Three-level Scheduling: Admission, CPU andMemory
3/35 Fall 2017 Institut Mines-Telecom Operating Systems - Scheduling
![Page 4: Operating Systems III. Scheduling - Eurecomsoc.eurecom.fr/OS/docs/CourseOS_III_Scheduling.pdfI Static priority or dynamic priority I The process with the higher priority (may be the](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa523e27f8b9ae7438cfc7f/html5/thumbnails/4.jpg)
Basics of SchedulingScheduling algorithms
Scheduling in Windows, Linux and Android
DefinitionsSwitching Between Processes
Three-Level Scheduling: Explanations
I Admission schedulerI Jobs are first stored into an admission queueI Jobs are then admitted in the system
I Memory schedulerI Swap in / swap outI To be avoided: Disk storage is expensive in terms of timeI For example, good to keep in memory 5 processes which
compute 20% of their time, and store all the others processeson disk
I CPU schedulerI See next slides
I In interactive systems, usually only 2 levels of schedulerI Memory and CPU
4/35 Fall 2017 Institut Mines-Telecom Operating Systems - Scheduling
![Page 5: Operating Systems III. Scheduling - Eurecomsoc.eurecom.fr/OS/docs/CourseOS_III_Scheduling.pdfI Static priority or dynamic priority I The process with the higher priority (may be the](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa523e27f8b9ae7438cfc7f/html5/thumbnails/5.jpg)
Basics of SchedulingScheduling algorithms
Scheduling in Windows, Linux and Android
DefinitionsSwitching Between Processes
Scheduling Criteria
All systems
I Fairness: Giving each process a fair share of the CPU
I Policy enforcement: No process should be able to overcomethe rules of the system
I Balance: Keeping all parts of the system busy
Batch/Cloud systems
I CPU utilization: Keep the CPU busy
I Throughput: Maximize the number of processes that arecompleted per time unit (hour)
I Turnaround Time: Minimize time between submission andtermination
5/35 Fall 2017 Institut Mines-Telecom Operating Systems - Scheduling
![Page 6: Operating Systems III. Scheduling - Eurecomsoc.eurecom.fr/OS/docs/CourseOS_III_Scheduling.pdfI Static priority or dynamic priority I The process with the higher priority (may be the](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa523e27f8b9ae7438cfc7f/html5/thumbnails/6.jpg)
Basics of SchedulingScheduling algorithms
Scheduling in Windows, Linux and Android
DefinitionsSwitching Between Processes
Scheduling Criteria (Cont.)
Interactive systems
I Response time: Respond to interactions as fast as possible
I Proportionality: Meet users’ expectations
Real-time systems
I Meeting deadlines: Keep the CPU busy
I Predictability: Know in advance whether time constraintscan always be met, or not
6/35 Fall 2017 Institut Mines-Telecom Operating Systems - Scheduling
![Page 7: Operating Systems III. Scheduling - Eurecomsoc.eurecom.fr/OS/docs/CourseOS_III_Scheduling.pdfI Static priority or dynamic priority I The process with the higher priority (may be the](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa523e27f8b9ae7438cfc7f/html5/thumbnails/7.jpg)
Basics of SchedulingScheduling algorithms
Scheduling in Windows, Linux and Android
DefinitionsSwitching Between Processes
When to Schedule?
I At creation of a processI Run parent or child?
I At termination of a process
I When a process blocks on I/O, semaphore, etc.
I When I/O interrupt occursI At hardware clock interrupt
I Non-preemptive schedulingI The same process is given the CPU until it blocks or
voluntarily releases the CPUI Only choice if no timer is availableI Windows 3.1
I Preemptive schedulingI The same process can run only for a pre-defined time-intervalI The OS sets a timer to the time-interval
7/35 Fall 2017 Institut Mines-Telecom Operating Systems - Scheduling
![Page 8: Operating Systems III. Scheduling - Eurecomsoc.eurecom.fr/OS/docs/CourseOS_III_Scheduling.pdfI Static priority or dynamic priority I The process with the higher priority (may be the](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa523e27f8b9ae7438cfc7f/html5/thumbnails/8.jpg)
Basics of SchedulingScheduling algorithms
Scheduling in Windows, Linux and Android
DefinitionsSwitching Between Processes
Non-Preemptive Scheduler
8/35 Fall 2017 Institut Mines-Telecom Operating Systems - Scheduling
![Page 9: Operating Systems III. Scheduling - Eurecomsoc.eurecom.fr/OS/docs/CourseOS_III_Scheduling.pdfI Static priority or dynamic priority I The process with the higher priority (may be the](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa523e27f8b9ae7438cfc7f/html5/thumbnails/9.jpg)
Basics of SchedulingScheduling algorithms
Scheduling in Windows, Linux and Android
DefinitionsSwitching Between Processes
Preemptive Scheduler
9/35 Fall 2017 Institut Mines-Telecom Operating Systems - Scheduling
![Page 10: Operating Systems III. Scheduling - Eurecomsoc.eurecom.fr/OS/docs/CourseOS_III_Scheduling.pdfI Static priority or dynamic priority I The process with the higher priority (may be the](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa523e27f8b9ae7438cfc7f/html5/thumbnails/10.jpg)
Basics of SchedulingScheduling algorithms
Scheduling in Windows, Linux and Android
DefinitionsSwitching Between Processes
Scheduling Implementation
10/35 Fall 2017 Institut Mines-Telecom Operating Systems - Scheduling
![Page 11: Operating Systems III. Scheduling - Eurecomsoc.eurecom.fr/OS/docs/CourseOS_III_Scheduling.pdfI Static priority or dynamic priority I The process with the higher priority (may be the](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa523e27f8b9ae7438cfc7f/html5/thumbnails/11.jpg)
Basics of SchedulingScheduling algorithms
Scheduling in Windows, Linux and Android
Batch systemsInteractive systemsMultiprocessor systems
Outline
Basics of Scheduling
Scheduling algorithmsBatch systemsInteractive systemsMultiprocessor systems
Scheduling in Windows, Linux and Android
11/35 Fall 2017 Institut Mines-Telecom Operating Systems - Scheduling
![Page 12: Operating Systems III. Scheduling - Eurecomsoc.eurecom.fr/OS/docs/CourseOS_III_Scheduling.pdfI Static priority or dynamic priority I The process with the higher priority (may be the](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa523e27f8b9ae7438cfc7f/html5/thumbnails/12.jpg)
Basics of SchedulingScheduling algorithms
Scheduling in Windows, Linux and Android
Batch systemsInteractive systemsMultiprocessor systems
Presented Scheduling Algorithms
For batch systems
I First-Come First-Served
I Shortest Job First
I Shortest Remaining TimeNext
For interactive systems
I Round-Robin scheduling
I Priority-based scheduling
I Group-based scheduling
I Guaranteed scheduling
I Fair-share scheduling
I Lottery scheduling
For multiprocessors systems
Presentation of three differentapproaches
For RT systems
Attend lectures on RTOS to knowmore!
12/35 Fall 2017 Institut Mines-Telecom Operating Systems - Scheduling
![Page 13: Operating Systems III. Scheduling - Eurecomsoc.eurecom.fr/OS/docs/CourseOS_III_Scheduling.pdfI Static priority or dynamic priority I The process with the higher priority (may be the](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa523e27f8b9ae7438cfc7f/html5/thumbnails/13.jpg)
Basics of SchedulingScheduling algorithms
Scheduling in Windows, Linux and Android
Batch systemsInteractive systemsMultiprocessor systems
First-Come, First-Served (FCFS)
Processes are assigned the CPU in the order they request it
I Single queue of ready processes
I Easy to program, fair
I Non-preemptive scheduling
Example: Average Wait Time for various sets of processes
Process p1 p2 p3
Duration 24 3 3
Arrivaltime (@)
0 0 0
Arrival order AWT=?
p1, p2, p3 0+24+273 = 17
p2, p3, p1
p3, p2, p1
13/35 Fall 2017 Institut Mines-Telecom Operating Systems - Scheduling
![Page 14: Operating Systems III. Scheduling - Eurecomsoc.eurecom.fr/OS/docs/CourseOS_III_Scheduling.pdfI Static priority or dynamic priority I The process with the higher priority (may be the](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa523e27f8b9ae7438cfc7f/html5/thumbnails/14.jpg)
Basics of SchedulingScheduling algorithms
Scheduling in Windows, Linux and Android
Batch systemsInteractive systemsMultiprocessor systems
Shortest Job First (SJF)
Scheduler selects the job with the shortest computation time
I Easy to implement
I Non-preemptiveI Optimal when processes are all ready simultaneously
I Minimum AWT
But ... How to predict the next CPU burst time???
1. Specified amount
2. Exponential average
τn+1 = αtn + (1− α)τn
I τ : predicted valueI t: measured computation time
14/35 Fall 2017 Institut Mines-Telecom Operating Systems - Scheduling
![Page 15: Operating Systems III. Scheduling - Eurecomsoc.eurecom.fr/OS/docs/CourseOS_III_Scheduling.pdfI Static priority or dynamic priority I The process with the higher priority (may be the](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa523e27f8b9ae7438cfc7f/html5/thumbnails/15.jpg)
Basics of SchedulingScheduling algorithms
Scheduling in Windows, Linux and Android
Batch systemsInteractive systemsMultiprocessor systems
Shortest Job First: Example
Example ]1: Same arrival time
Process p1 p2 p3 p4
Duration 8 4 4 4
@ 0 0 0 0
Algo AWT=?
FCFS (p1,p2, p3, p4)
SJF
Example ]2: Various arrival times
Process p1 p2 p3 p4 p5
Duration 2 4 1 1 1
@ 0 0 3 3 3
Algo AWT=?
FCFS
SJF
Can you find a better scheduling???
15/35 Fall 2017 Institut Mines-Telecom Operating Systems - Scheduling
![Page 16: Operating Systems III. Scheduling - Eurecomsoc.eurecom.fr/OS/docs/CourseOS_III_Scheduling.pdfI Static priority or dynamic priority I The process with the higher priority (may be the](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa523e27f8b9ae7438cfc7f/html5/thumbnails/16.jpg)
Basics of SchedulingScheduling algorithms
Scheduling in Windows, Linux and Android
Batch systemsInteractive systemsMultiprocessor systems
Shortest Remaining Time Next (SRTN)
Preemptive version of Shortest Job First
Memo: SJF is non-preemptive
Example: Comparison between SJF and SRTN
Process p1 p2
Duration 10 1
@ 0 1
Algo Scheduling AWT=?
SJF p1 for 10, p2 for 1 0+92 = 4.5
SRTN p1 for 1, p2 for 1, p1 for 9 1+02 = 0.5
16/35 Fall 2017 Institut Mines-Telecom Operating Systems - Scheduling
![Page 17: Operating Systems III. Scheduling - Eurecomsoc.eurecom.fr/OS/docs/CourseOS_III_Scheduling.pdfI Static priority or dynamic priority I The process with the higher priority (may be the](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa523e27f8b9ae7438cfc7f/html5/thumbnails/17.jpg)
Basics of SchedulingScheduling algorithms
Scheduling in Windows, Linux and Android
Batch systemsInteractive systemsMultiprocessor systems
Round-Robin (RR)
Each process is assigned a time quantum
I If the process is still running at the end of its quantum, it ispreempted
I Next process is assigned the CPU
I Widely used, easy to implement, fair
How to set the value of the quantum???
I Quantum too short? Quantum too long?I What happens if:
I quantum = ε?I quantum =∞?
I Typical quantum: 10 to 50 ms
17/35 Fall 2017 Institut Mines-Telecom Operating Systems - Scheduling
![Page 18: Operating Systems III. Scheduling - Eurecomsoc.eurecom.fr/OS/docs/CourseOS_III_Scheduling.pdfI Static priority or dynamic priority I The process with the higher priority (may be the](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa523e27f8b9ae7438cfc7f/html5/thumbnails/18.jpg)
Basics of SchedulingScheduling algorithms
Scheduling in Windows, Linux and Android
Batch systemsInteractive systemsMultiprocessor systems
Round-Robin: Explanations
18/35 Fall 2017 Institut Mines-Telecom Operating Systems - Scheduling
![Page 19: Operating Systems III. Scheduling - Eurecomsoc.eurecom.fr/OS/docs/CourseOS_III_Scheduling.pdfI Static priority or dynamic priority I The process with the higher priority (may be the](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa523e27f8b9ae7438cfc7f/html5/thumbnails/19.jpg)
Basics of SchedulingScheduling algorithms
Scheduling in Windows, Linux and Android
Batch systemsInteractive systemsMultiprocessor systems
Round-Robin: Example
Process p1 p2 p3
Duration 24 3 3
@ 0 0 0
Quantum 4 4 4
p1 p2 p3 p1 p1 p1 p1 p1
0 4 7 10 14 18 22 26
AWT=???
19/35 Fall 2017 Institut Mines-Telecom Operating Systems - Scheduling
![Page 20: Operating Systems III. Scheduling - Eurecomsoc.eurecom.fr/OS/docs/CourseOS_III_Scheduling.pdfI Static priority or dynamic priority I The process with the higher priority (may be the](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa523e27f8b9ae7438cfc7f/html5/thumbnails/20.jpg)
Basics of SchedulingScheduling algorithms
Scheduling in Windows, Linux and Android
Batch systemsInteractive systemsMultiprocessor systems
Priority-Based Scheduling
Limitations of RRI RR assumes all processes are of equal importance
I For example, sending of an email vs. playing music
Priority-based scheduling: Priorities are assigned to processes
I Static priority or dynamic priorityI The process with the higher priority (may be the lower value)
is chosenI RR between processes of the same priority
20/35 Fall 2017 Institut Mines-Telecom Operating Systems - Scheduling
![Page 21: Operating Systems III. Scheduling - Eurecomsoc.eurecom.fr/OS/docs/CourseOS_III_Scheduling.pdfI Static priority or dynamic priority I The process with the higher priority (may be the](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa523e27f8b9ae7438cfc7f/html5/thumbnails/21.jpg)
Basics of SchedulingScheduling algorithms
Scheduling in Windows, Linux and Android
Batch systemsInteractive systemsMultiprocessor systems
Priority-Based Scheduling: Dynamic Priorities
Priorities might be re-evaluated
I Avoids high-priority processes to jeopardize the CPU(starvation of low-priority processes)
I For example, priority can be set to priorityn+1 = quantumtn
where tn is the last computation time
Example: 10 ms quantum
I Process used 1ms → new priority = 10
I Process used 5ms → new priority = 2
I Process used 10ms (i.e., all quantum) → new priority = 1
21/35 Fall 2017 Institut Mines-Telecom Operating Systems - Scheduling
![Page 22: Operating Systems III. Scheduling - Eurecomsoc.eurecom.fr/OS/docs/CourseOS_III_Scheduling.pdfI Static priority or dynamic priority I The process with the higher priority (may be the](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa523e27f8b9ae7438cfc7f/html5/thumbnails/22.jpg)
Basics of SchedulingScheduling algorithms
Scheduling in Windows, Linux and Android
Batch systemsInteractive systemsMultiprocessor systems
Priority-Based Scheduling (Cont.)
22/35 Fall 2017 Institut Mines-Telecom Operating Systems - Scheduling
![Page 23: Operating Systems III. Scheduling - Eurecomsoc.eurecom.fr/OS/docs/CourseOS_III_Scheduling.pdfI Static priority or dynamic priority I The process with the higher priority (may be the](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa523e27f8b9ae7438cfc7f/html5/thumbnails/23.jpg)
Basics of SchedulingScheduling algorithms
Scheduling in Windows, Linux and Android
Batch systemsInteractive systemsMultiprocessor systems
Group-based
Scheduling policy is applied accordingto groups of processes
Example: group 1 may have a quantumof 20, and group 2 a quantum of 10
Intra-group scheduling
All algorithms previously presented can be used
Inter-group scheduling
I Fixed-priority preemptive schedulingI Highest priorities for foreground processes (interactivity)
I Time-slice between groupsI e.g., 80% for group 1, 20% for group 2
23/35 Fall 2017 Institut Mines-Telecom Operating Systems - Scheduling
![Page 24: Operating Systems III. Scheduling - Eurecomsoc.eurecom.fr/OS/docs/CourseOS_III_Scheduling.pdfI Static priority or dynamic priority I The process with the higher priority (may be the](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa523e27f8b9ae7438cfc7f/html5/thumbnails/24.jpg)
Basics of SchedulingScheduling algorithms
Scheduling in Windows, Linux and Android
Batch systemsInteractive systemsMultiprocessor systems
Guaranteed Scheduling
I Special case of ”Group-based”
Idea: Give a ratio of the CPU to groups of processes
I For example, users are given a fraction of CPU (e.g., 1n )
I Compute the ratio between actual CPU time consumed andentitled CPU time
I Run the process with the lowest ratio until its ratio has movedabove its closest competitor
24/35 Fall 2017 Institut Mines-Telecom Operating Systems - Scheduling
![Page 25: Operating Systems III. Scheduling - Eurecomsoc.eurecom.fr/OS/docs/CourseOS_III_Scheduling.pdfI Static priority or dynamic priority I The process with the higher priority (may be the](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa523e27f8b9ae7438cfc7f/html5/thumbnails/25.jpg)
Basics of SchedulingScheduling algorithms
Scheduling in Windows, Linux and Android
Batch systemsInteractive systemsMultiprocessor systems
Fair-Share Scheduling
Idea: Fairness between users is taken into account firstI For example, in RR, a user with 9 processes gets more CPU
than a user with 2I Allocates a fraction of CPU to users
I One user = one scheduling group
I Other possible notions of fairnessI Resources, etc.
25/35 Fall 2017 Institut Mines-Telecom Operating Systems - Scheduling
![Page 26: Operating Systems III. Scheduling - Eurecomsoc.eurecom.fr/OS/docs/CourseOS_III_Scheduling.pdfI Static priority or dynamic priority I The process with the higher priority (may be the](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa523e27f8b9ae7438cfc7f/html5/thumbnails/26.jpg)
Basics of SchedulingScheduling algorithms
Scheduling in Windows, Linux and Android
Batch systemsInteractive systemsMultiprocessor systems
Lottery Scheduling
Idea: Lotto tickets are given to processes
I A random ticket is picked up, the winner gets a quantum oftime
I The number of tickets received by a process is equivalent toits importance
I Processes can exchange tickets for cooperation
I Highly responsive
Example
A video server with three video streams at 10, 20, 25 frames / sec,respectively.→ Each process is given a number of tickets equals to the framerate i.e 10, 20 and 25
26/35 Fall 2017 Institut Mines-Telecom Operating Systems - Scheduling
44
9
3
8
33
3
![Page 27: Operating Systems III. Scheduling - Eurecomsoc.eurecom.fr/OS/docs/CourseOS_III_Scheduling.pdfI Static priority or dynamic priority I The process with the higher priority (may be the](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa523e27f8b9ae7438cfc7f/html5/thumbnails/27.jpg)
Basics of SchedulingScheduling algorithms
Scheduling in Windows, Linux and Android
Batch systemsInteractive systemsMultiprocessor systems
Multiprocessor Scheduling
One scheduling queue for each processor
I Symmetric system
A common ready-queue for all processors
I Asymmetric multi-processing
I Danger: synchronization problems because several processorscould access to the scheduling data structures at the sametime
Only one ready-queue accessed by only one processor
I No synchronization issues
I Drawback?
27/35 Fall 2017 Institut Mines-Telecom Operating Systems - Scheduling
![Page 28: Operating Systems III. Scheduling - Eurecomsoc.eurecom.fr/OS/docs/CourseOS_III_Scheduling.pdfI Static priority or dynamic priority I The process with the higher priority (may be the](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa523e27f8b9ae7438cfc7f/html5/thumbnails/28.jpg)
Basics of SchedulingScheduling algorithms
Scheduling in Windows, Linux and Android
WindowsSolaris, LinuxAndroid
Outline
Basics of Scheduling
Scheduling algorithms
Scheduling in Windows, Linux and AndroidWindowsSolaris, LinuxAndroid
28/35 Fall 2017 Institut Mines-Telecom Operating Systems - Scheduling
![Page 29: Operating Systems III. Scheduling - Eurecomsoc.eurecom.fr/OS/docs/CourseOS_III_Scheduling.pdfI Static priority or dynamic priority I The process with the higher priority (may be the](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa523e27f8b9ae7438cfc7f/html5/thumbnails/29.jpg)
Basics of SchedulingScheduling algorithms
Scheduling in Windows, Linux and Android
WindowsSolaris, LinuxAndroid
Windows NT Scheduling
BasicsI Priority-based preemptive round-robin scheduling
I Raises the priority of interactive and I/O bound processes
I CPU cycle-based scheduling (since Vista)
A process runs until ...
I It is preempted by a higher priority process
I It terminates
I Its time quantum expires (12 ms in Windows 2000 - highervalue is used in ”server” versions)
I It calls a blocking system call
29/35 Fall 2017 Institut Mines-Telecom Operating Systems - Scheduling
![Page 30: Operating Systems III. Scheduling - Eurecomsoc.eurecom.fr/OS/docs/CourseOS_III_Scheduling.pdfI Static priority or dynamic priority I The process with the higher priority (may be the](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa523e27f8b9ae7438cfc7f/html5/thumbnails/30.jpg)
Basics of SchedulingScheduling algorithms
Scheduling in Windows, Linux and Android
WindowsSolaris, LinuxAndroid
Windows NT: Priority Classes
30/35 Fall 2017 Institut Mines-Telecom Operating Systems - Scheduling
![Page 31: Operating Systems III. Scheduling - Eurecomsoc.eurecom.fr/OS/docs/CourseOS_III_Scheduling.pdfI Static priority or dynamic priority I The process with the higher priority (may be the](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa523e27f8b9ae7438cfc7f/html5/thumbnails/31.jpg)
Basics of SchedulingScheduling algorithms
Scheduling in Windows, Linux and Android
WindowsSolaris, LinuxAndroid
Windows NT: Changing Classes of Processes
31/35 Fall 2017 Institut Mines-Telecom Operating Systems - Scheduling
![Page 32: Operating Systems III. Scheduling - Eurecomsoc.eurecom.fr/OS/docs/CourseOS_III_Scheduling.pdfI Static priority or dynamic priority I The process with the higher priority (may be the](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa523e27f8b9ae7438cfc7f/html5/thumbnails/32.jpg)
Basics of SchedulingScheduling algorithms
Scheduling in Windows, Linux and Android
WindowsSolaris, LinuxAndroid
Solaris 10: Kernel Architecture
32/35 Fall 2017 Institut Mines-Telecom Operating Systems - Scheduling
source = Oracle/Sun Microsystems
![Page 33: Operating Systems III. Scheduling - Eurecomsoc.eurecom.fr/OS/docs/CourseOS_III_Scheduling.pdfI Static priority or dynamic priority I The process with the higher priority (may be the](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa523e27f8b9ae7438cfc7f/html5/thumbnails/33.jpg)
Basics of SchedulingScheduling algorithms
Scheduling in Windows, Linux and Android
WindowsSolaris, LinuxAndroid
→ Linux 2.6.22: Priority-Based Scheduler
Scheduling classes
I Real-time processes: SCHED FIFO, SCHED RR
I Interactive and batch processes: SCHED OTHER,SCHED BATCH
I Low-priority processes: SCHED IDLEI One active queue for each of the 140 priorities and for each
processorI Cross-CPU scheduling regularly performed (e.g., every 200 ms)
SCHED OTHER
Round-Robin time-sharing policy with dynamic priorities
I Processes running for a long time are penalized
33/35 Fall 2017 Institut Mines-Telecom Operating Systems - Scheduling
![Page 34: Operating Systems III. Scheduling - Eurecomsoc.eurecom.fr/OS/docs/CourseOS_III_Scheduling.pdfI Static priority or dynamic priority I The process with the higher priority (may be the](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa523e27f8b9ae7438cfc7f/html5/thumbnails/34.jpg)
Basics of SchedulingScheduling algorithms
Scheduling in Windows, Linux and Android
WindowsSolaris, LinuxAndroid
Linux 2.6.23 → . . . : Completely FairScheduler
I ”Out of balance” tasks are given time to executeI Out of balance task = task has not been given a fair amount
of time relative to others
I Preemption time is variable: it depends upon the time balanceof the task w.r.t. other tasks
I The amount of time provided to a given task is called thevirtual runtime
I Group-based: the virtual runtime can also be computed for awhole group
I Priorities are used as a decay factor for the time a task ispermitted to execute
34/35 Fall 2017 Institut Mines-Telecom Operating Systems - Scheduling
![Page 35: Operating Systems III. Scheduling - Eurecomsoc.eurecom.fr/OS/docs/CourseOS_III_Scheduling.pdfI Static priority or dynamic priority I The process with the higher priority (may be the](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa523e27f8b9ae7438cfc7f/html5/thumbnails/35.jpg)
Basics of SchedulingScheduling algorithms
Scheduling in Windows, Linux and Android
WindowsSolaris, LinuxAndroid
Android
I Roughly, the scheduler is based onthe Linux one
I → Fair scheduling approach
I BUT: fairness according to Groupsof processes
I Foreground/Active, visible,service, background, empty
I To reclaim resources, Android maykill processes according to theirrunning priority
Foreground
Visible
Service
Background
Empty
High priority
Low priority
35/35 Fall 2017 Institut Mines-Telecom Operating Systems - Scheduling