Seminar on Linux Process Management Presentation by Manoj Dhage MTech 1 st Year, SIT, IIT Kharagpur.
Seminar on Linux Process Management
-
Upload
thor-bradshaw -
Category
Documents
-
view
32 -
download
3
description
Transcript of Seminar on Linux Process Management
![Page 1: Seminar on Linux Process Management](https://reader035.fdocuments.us/reader035/viewer/2022062407/56812e8d550346895d943038/html5/thumbnails/1.jpg)
Seminar on
Linux Process Management
Presentation by Tapan Kumar SahooUCE BURLA.
![Page 2: Seminar on Linux Process Management](https://reader035.fdocuments.us/reader035/viewer/2022062407/56812e8d550346895d943038/html5/thumbnails/2.jpg)
Outline
Process
- process descriptor, process state, process switch.
The Linux 2.6.8.1 Scheduler
- Runqueues, priority arrays
- Calcucalation of priorities and timeslices,
- schedule() function
- Scheduler tuning
![Page 3: Seminar on Linux Process Management](https://reader035.fdocuments.us/reader035/viewer/2022062407/56812e8d550346895d943038/html5/thumbnails/3.jpg)
Process
Process Lightweight Process Process Descriptor
![Page 4: Seminar on Linux Process Management](https://reader035.fdocuments.us/reader035/viewer/2022062407/56812e8d550346895d943038/html5/thumbnails/4.jpg)
Process Descriptor
Ref: Understanding the Linux Kernel
![Page 5: Seminar on Linux Process Management](https://reader035.fdocuments.us/reader035/viewer/2022062407/56812e8d550346895d943038/html5/thumbnails/5.jpg)
Process State
TASK_RUNNING TASK_INTERRUPTIBLE TASK_UNINTERRUPTIBLE TASK_STOPPED TASK_ZOMBIE
![Page 6: Seminar on Linux Process Management](https://reader035.fdocuments.us/reader035/viewer/2022062407/56812e8d550346895d943038/html5/thumbnails/6.jpg)
Process Descriptor Handling
The Process List
Ref: Understanding the Linux Kernel
![Page 7: Seminar on Linux Process Management](https://reader035.fdocuments.us/reader035/viewer/2022062407/56812e8d550346895d943038/html5/thumbnails/7.jpg)
continued…
List of Data Structure
Ref: Understanding the Linux Kernel
![Page 8: Seminar on Linux Process Management](https://reader035.fdocuments.us/reader035/viewer/2022062407/56812e8d550346895d943038/html5/thumbnails/8.jpg)
Process Switch
Hardware ContextHappens only in schedule() functionSteps
- switch page global directory
- switch kernel mode stack and H/W context
![Page 9: Seminar on Linux Process Management](https://reader035.fdocuments.us/reader035/viewer/2022062407/56812e8d550346895d943038/html5/thumbnails/9.jpg)
The Linux 2.6.8.1 CPU Scheduler
RunqueuesThe O(1) Scheduling Algorithm
- one Runqueue per CPU
- active priority array
- expired priority array
![Page 10: Seminar on Linux Process Management](https://reader035.fdocuments.us/reader035/viewer/2022062407/56812e8d550346895d943038/html5/thumbnails/10.jpg)
Use Priority Arrays
active priority arraybitmap[BITMAP_SIZE]
![Page 11: Seminar on Linux Process Management](https://reader035.fdocuments.us/reader035/viewer/2022062407/56812e8d550346895d943038/html5/thumbnails/11.jpg)
bitmap[BITMAP_SIZE]
![Page 12: Seminar on Linux Process Management](https://reader035.fdocuments.us/reader035/viewer/2022062407/56812e8d550346895d943038/html5/thumbnails/12.jpg)
Calculating priority
static priority
- nice() system call
- specified by user
- never modified by scheduler
- used to calculate timeslice
![Page 13: Seminar on Linux Process Management](https://reader035.fdocuments.us/reader035/viewer/2022062407/56812e8d550346895d943038/html5/thumbnails/13.jpg)
continued…
dynamic priority
- subtracts –5 to +5 from static priority depending on the time spend in running or waiting
- used for scheduling purpose
![Page 14: Seminar on Linux Process Management](https://reader035.fdocuments.us/reader035/viewer/2022062407/56812e8d550346895d943038/html5/thumbnails/14.jpg)
The schedule() function.
steps involved- find process with maximum dynamic priority- prev and next pointers to process
descriptors- switch to next
switch page global directoryswitch kernel mode stack
![Page 15: Seminar on Linux Process Management](https://reader035.fdocuments.us/reader035/viewer/2022062407/56812e8d550346895d943038/html5/thumbnails/15.jpg)
continued…
Called in prev, return in nextWhy this is O(1) Invoked by
- scheduler_tick()
- system call
![Page 16: Seminar on Linux Process Management](https://reader035.fdocuments.us/reader035/viewer/2022062407/56812e8d550346895d943038/html5/thumbnails/16.jpg)
scheduler_tick()
Invoked every 1 ms by timer interruptDo not always invoke schedule()Whenever a task runs out of time slice,
it is given new time slice and dynamic priority and put in expired array
Reinsert interactive task on active array If there is no active task swap the
pointers of active and expired arrays
![Page 17: Seminar on Linux Process Management](https://reader035.fdocuments.us/reader035/viewer/2022062407/56812e8d550346895d943038/html5/thumbnails/17.jpg)
System calls
Insert current task in a waitqueueChange state to
TASK_INTERRUPTABLE or TASK_UNINTERRUPTABLE
Invoke schedule() If resource available remove from
waitqueue
![Page 18: Seminar on Linux Process Management](https://reader035.fdocuments.us/reader035/viewer/2022062407/56812e8d550346895d943038/html5/thumbnails/18.jpg)
Handling real time tasks
Task priority range -20 to 19SCHED_FIFO SchedulingSCHED_RR Scheduling
![Page 19: Seminar on Linux Process Management](https://reader035.fdocuments.us/reader035/viewer/2022062407/56812e8d550346895d943038/html5/thumbnails/19.jpg)
Scheduler tuning
MIN_TIMESLICE AND MAXI_TIMESLICE
PRIO_BONUS_RATIO STARVATION_LIMIT
![Page 20: Seminar on Linux Process Management](https://reader035.fdocuments.us/reader035/viewer/2022062407/56812e8d550346895d943038/html5/thumbnails/20.jpg)
Future scope
Scheduler modes
- server mode, bigger timeslice
- desktop mode, more responsivenessSwappable schedulers
- different scheduler for different users
- basic kernel scheduler would be round robin
![Page 21: Seminar on Linux Process Management](https://reader035.fdocuments.us/reader035/viewer/2022062407/56812e8d550346895d943038/html5/thumbnails/21.jpg)
3. References
Josh Aas, “Understanding the Linux 2.6.8.1 CPU Scheduler”,
February 2005. Abraham Silberschatz, Greg Gagne, Peter Galvin,
“Operating System Concepts”, Wiley. Daniel P. Bovet, Marco Cesati, “Understanding the Linux Kernel”,
2ndEdition. O’Reilly, July 2003. http://plg.uwaterloo.ca/~itbowman/CS746G/a1/ .
http://josh.trancesoftware.com/linux/ .
![Page 22: Seminar on Linux Process Management](https://reader035.fdocuments.us/reader035/viewer/2022062407/56812e8d550346895d943038/html5/thumbnails/22.jpg)
Thank YouThank You.