Linux Process Management Linux Implementation of Threads Threads enable concurrent programming true parallelism Linux implementation of threads PCS vs SCS http:www.cs.uic.edujbellCourseNotesOperatingSystems5CPUScheduling.html
"Linux Process Management Linux Implementation of" is the property of its rightful owner. Permission is granted to
download and print the materials on this website for personal, non-commercial use only, and to display it
on your personal computer provided you do not modify the materials and that you retain all copyright
notices contained in the materials. By downloading content from our website, you accept the terms of this
agreement.
Presentation Transcript
01
Linux Process Management<br>
02
Linux Implementation of Threads Threads enable concurrent programming / true parallelism
Linux implementation of threads<br>
03
PCS vs SCS http://www.cs.uic.edu/~jbell/CourseNotes/OperatingSystems/5_CPU_Scheduling.html<br>
04
Linux Process Scheduling Policy
Policy is the behavior of the scheduler that determines what runs when. A scheduler’s policy often determines the overall feel of a system.
I/O-Bound vs. Processor-Bound Processes
Scheduler policy in Unix systems tends to explicitly favor I/O-bound processes
Linux..<br>
05
Process priority 2 ranges
nice value
-20 to +19 with default of 0
Larger nice values correspond to lower priority
ps –el
real-time priority
0 -99
Higher values correspond to higher priority
Used for real-time processes – always higher than normal processes.<br>
06
The scheduling policy in action<br>
07
Process Scheduling in Unix Based on traditional methods
Timeslice
Priority (Priority exported to user in nice values)
Problematic
Two low priority processes swap to much
Timeslice / priority correlation
Timeslice measurement (timer click)<br>
08
The scheduling policy in action Linux: Completely Fair Scheduling
Model process scheduling as if the system had an ideal perfectly multitasking processor.
That is, each process receives 1/n of the processor’s time, where n is the number of runnable processes and we’d schedule them for intimately small durations, so that in any measureable period we’d have urn all n processes for the same time.
Conceptually: we are running 2 processes simultaneously each using 50% of CPU<br>
09
Completely Fair Scheduling (CFS) CFS will run each process for some amount of time, round-robin, selecting next the process that has run the least.<br>
10
Completely Fair Scheduling (CFS)Determine Time allotted to run CFS calculates how long a process should run as a function of the total number of runnable processes
CFS uses the nice value to weight the proportion of the processor a process should receive.<br>
11
Completely Fair Scheduling (CFS)Determine Time allotted to run Each process then runs for a “time-slice” proportional to its weight divided by the total weight of all runnable threads.<br>
12
Completely Fair Scheduling (CFS)Picking the next task Red/black trees
Balanced tree
Leftmost leaf contains process with the smallest runtime (time spent running) normalized by the number of runnable processes and by its ‘weight’<br>
13
Kernel Preemption Unix kernel is non-preemptive
Linux kernel is pre-emptive<br>
14
Real-Time Scheduling Policies SCHED_FIFO and SCHED_RR
Not managed by CFS, but by a separate real-time scheduler.