-
Linux process scheduling uses preemptive multitasking, so there is no need for processes to suspend and resume running without the need for collaboration between them.
In a multitasking system like Linux, where multiple programs may compete for the same resource, we believe that it is better to perform a program that performs short, bursty work and pauses to wait for input than a program that continuously occupies the processor for calculations or constantly polls the system to see if input arrives. We call a program that performs well a nice program, and in a sense, this nice can be calculated. The operating system determines the priority of a process based on its nice value, which defaults to 0 and will change continuously based on the performance of the program.
Programs that run uninterrupted for a long time will generally have a lower priority.
-
Scheduling algorithm refers to the resource allocation algorithm specified according to the resource allocation policy of the system. Common process scheduling algorithms are:
1.First come, first served.
2.Time slice rotation method.
3.Multi-level feedback queue algorithm.
4.The shortest process takes precedence.
5.The shortest remaining time takes precedence.
6.The highest response ratio takes precedence.
7.Multi-level feedback queue scheduling algorithm.
First, first-come, first-served service.
The first-come-first-go service scheduling algorithm is one of the simplest scheduling algorithms, also known as first-in, first-out or strict queuing schemes. When each process is ready, it joins the readiness queue. The currently running process stops executing, and the process that has been in the ready queue for the longest time is selected.
The algorithm can be used for both job scheduling and process scheduling. First-come-first-go services are more suitable for regular jobs (processes) than for segment jobs (processes).
Second, the time slice rotation method.
The rotation method is based on a modest preemption strategy, which generates clock interrupts at periodic intervals, and when the interrupt occurs, the currently running process is placed in a ready queue, and then the next ready job is selected to run based on the first-come, first-go service policy. This technique is also known as time slicing because each process is given a piece of time before it is preempted.
3. Priority is given to the shortest process.
Shortest process priority is a non-preemptive strategy that is based on the principle that the next time the process is selected with the shortest expected processing time, the short process will skip the long job and jump to the head of the queue. This algorithm can be used for job scheduling and process scheduling. However, he is not good for long jobs, and there is no guarantee that urgent jobs (processes) will be processed in a timely manner, and the length of the jobs is only estimated.
Fourth, the shortest remaining time is preferred.
The shortest remaining time is the version that preferentially adds the preemption mechanism for the shortest process. In this case, the process scheduling always chooses the process with the shortest expected time remaining. When a process joins the ready queue, it may have a shorter time remaining than the currently running process, so the scheduler can potentially preempt the currently running process as soon as the new process is ready.
Like the shortest process first, the dispatcher is executing a selection function that must have an estimate of the processing time, and there is a danger of long process starvation.
-
1. First-come, first-served closed service: It is the simplest scheduling algorithm, which is scheduled in a first-come, first-served order.
2. Rotation method: The waiting time of each process in the ready queue is proportional to the time to enjoy the service.
3. Short job priority scheduling algorithm: Select one or several jobs with the shortest estimated running time from the backup queue and call them into memory for running.
4. High priority priority scheduling algorithm: refers to a calculation and pin calling machine algorithm that can be prioritized after the urgent operation enters the system.
5. High response ratio optimization and ant-you first scheduling algorithm: It is an algorithm for the allocation of the response ratio of the CPU controller. Considering both the job waiting time and the job running time, it not only takes care of short jobs but also does not make long job waiting time, which improves scheduling performance.
Time slice rotation scheduling is one of the oldest, simplest, fairest, and most widely used algorithms. >>>More
First: Pipeline communication.
When two processes communicate through a pipeline, the process that sends the information is called the write process; The process that receives the information is called the read process. The intermediate medium of the pipeline communication mode is the file, which is usually called the pipe file, which connects a write process and a read process together like a pipe to achieve communication between the two processes. The write process writes information to the pipeline file through the write end; The read process reads information from the pipeline file through the readout. >>>More
What is a thread?It is a path executed in a process and is the smallest unit of system scheduling. >>>More
Use the pstree command to see the relationship between the processes, all processes are created by the initial init, and the parent process creates child processes one by one. >>>More
sudo is a Linux system administration directive, which is a tool that allows system administrators to let ordinary users execute some or all of the root commands. >>>More