Somethings about the Process scheduler in Linux
2017-11-21 17:37
344 查看
Some concepts
The process scheduler decides which process runs and for how long.it is responsible for best utilizing the system and giving users the impression that multiple processes are executing simultaneously.Multitasking
The Multitasking systems come in two flavors:cooperative multitasking and preemptive multitasking.Linux is preemptive multitasking,the system uses timeslice to mange the processes but in the cooperative multitasking,a process doesn’t stop running until it voluntary decides to do so,the scheduler can’t make global decisions regarding how long processes run.So now most of the systems are designed with preemptive multitasking.Linux’s Process Scheduler
the 2.5 kernel updates a new scheduler called o(1) scheduler,introducing a constant-time algorithm for timeslice calculation and per-processor runqueues .But it lacks interactive processes.2.6 kernel aims at improving the interactive performance of the o(1) scheduler and the most notable is Rotating Staircase Deadline scheduler which introduced the concept of fair scheduler.
Policy
The policy is the behavior of the scheduler that determines what runs when.The scheduling policy in a system must attempt to satisfy two conflicting goals:fast process time(low latency) and maximal system utilization(high throughput)
The Linux aims to provide good interactive response and desktop performance,optimizes for process response(low latency),thus favoring I/O bound process over processor-bound.
I/O bound and Processor-bound Processes
I/O Bound:the process that spends lots of time submitting and waiting the I/O request.Most graphical user interface(GUI)applications are I/O BoundProcessor bound:spend much of its time in executing code.A scheduler policy for processor-bound processes tends to run such processes less frequently but for longer durations.
Process priority
a common type of scheduling algorithm is priority-based scheduling.The higher priority ones also have a longer time slice.But the shortcoming is that the low priority ones will be starved all the timeThe Linux implements two separate priority ranges:
- the first is nice value,default value is 0,range is -20 to 19.the larger the value,the priority lower,the possibility to be executed by the kernel is lower.
- the second range is real-time-priority,range from 0 to 99,higher real-time priority values correspond to a greater priority
The kernel will compute the final priority depend on nice value and real-time-priority.
Timeslice
The I/O Bound processes want a shorter timeslice but the processor-Bound want the longer one.The linux’s CFS assigns processes a proportion of the processor and the timeslice is affected by the nice value,Higher the nice value(a lower priority),smaller proportion of the processor.
The linux is preemptive,under the new CFS scheduler,if the newly runnable processor consumed a smaller proportion of the processor than the currently executing process,it runs immediately,preempting the current process.If not,it is to run at a later time.
相关文章推荐
- Somethings about the Process in the Linux
- about to search or kill the process and the port in the linux
- Describe the process of opening a file in Linux system, what actions the operating system w
- Implement a New Process Scheduler in Linux Kernel
- A log about Reading the memroy of Other Process in C++/WIN API--ReadProcessMemory()
- how the process using the hard disk in linux
- the diary about awk scp in linux
- linux内核——Learning about the linux process 进程的遍历
- Beginning Linux Programming----Knowledge about compiling the C files in Linux
- How to count the number of threads in a process on Linux
- Somethings about the coding in Python
- About Segmentation Fault in Linux ( SIGSEGV )
- sendBroadcastAsUser——Calling a method in the system process without a qualified user
- Failed to generate a user instance of SQL Server due to a failure in starting the process for the user instance. The connection
- The commpression command in the linux (gzip , tar)
- The RealPlayer install process in Ubuntu
- The process of installing debian in my T61
- 【Linux学习】Linux报“xxx is not in the sudoers file.This incident will be reported” 错误解决方法
- About the Monitor object in .NET framework