0% found this document useful (0 votes)
26 views

Module 2.3 Linux Scheduling

Uploaded by

ps9473013
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views

Module 2.3 Linux Scheduling

Uploaded by

ps9473013
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 14

Linux Scheduling

Nirmala Shinde Baloorkar


Assistant Professor
Department of Computer Engineering
Outline
• Fair Share Scheduling
• Traditional UNIX Scheduling
Fair-Share Scheduling
• Scheduling decisions based on the process sets
• Each user is assigned a share of the processor
• Objective is to monitor usage to give fewer resources to users who
have had more than their fair share and more to those who have had
less than their fair share
r-Share Scheduler
Traditional UNIX Scheduling
• Used in both SVR3 and 4.3 BSD UNIX
• these systems are primarily targeted at the time-sharing interactive
environment
• Designed to provide good response time for interactive users while
ensuring that low-priority background jobs do not starve
• Employs multilevel feedback using round robin within each of the
priority queues
• Makes use of one-second preemption
• Priority is based on process type and execution history
Scheduling Formula
Bands
• Used to optimize access to block devices and to allow the operating
system to respond quickly to system calls Swapper
• In decreasing order of priority, the bands are:
Block I/O
device control

File
manipulation

Character I/O
device control

User
processes
Example of
Traditional
UNIX Process
Scheduling
Linux Scheduling Through Version 2.5

• Prior to kernel version 2.5, ran variation of standard UNIX scheduling


algorithm
• Version 2.5 moved to constant order O(1) scheduling time
• Preemptive, priority based
• Two priority ranges: time-sharing and real-time
• Real-time range from 0 to 99 and nice value from 100 to 140
• Map into global priority with numerically lower values indicating higher priority
• Higher priority gets larger q
• Task run-able as long as time left in time slice (active)
• If no time left (expired), not run-able until all other tasks use their slices
• All run-able tasks tracked in per-CPU runqueue data structure
• Two priority arrays (active, expired)
• Tasks indexed by priority
• When no more active, arrays are exchanged
• Worked well, but poor response times for interactive processes
Linux Scheduling in Version 2.6.23 +

• Completely Fair Scheduler (CFS)


• Scheduling classes
• Each has specific priority
• Scheduler picks highest priority task in highest scheduling class
• Rather than quantum based on fixed time allotments, based on proportion of
CPU time
• 2 scheduling classes included, others can be added
1.default
2.real-time
Linux Scheduling in Version 2.6.23 + (cont…)

• Quantum calculated based on nice value from -20 to +19


• Lower value is higher priority
• Calculates target latency – interval of time during which task should run at least
once
• Target latency can increase if say number of active tasks increases
• CFS scheduler maintains per task virtual run time in variable vruntime
• Associated with decay factor based on priority of task – lower priority is higher
decay rate
• Normal default priority yields virtual run time = actual run time
• To decide next task to run, scheduler picks task with lowest virtual run
time
CFS Performance
Linux Scheduling (Cont.)
• Real-time scheduling according to POSIX.1b
• Real-time tasks have static priorities
• Real-time plus normal map into global priority scheme
• Nice value of -20 maps to global priority 100
• Nice value of +19 maps to priority 139
Question ?

You might also like