Operating system process scheduling strategy, which has several?

FCFS ( FCFS ) , priority, round-robin, multiple feedback - scheduling algorithm.

  FCFS scheduling algorithm: is one of the most simple scheduling algorithm, each scheduling process is to select one of the first to enter the queue, whom allocate resources put into operation from the process queue. The process has been completed or a running event and continue processing after blocking the back of the process.

  Priority scheduling algorithm: short process priority, the priority of high priority, in response to higher priority than other, priority scheduling is performed in accordance with the process of the ready queue.  (High response ratio :( waiting time + service uptime) / service uptime)

  Round-robin scheduling algorithm: the system time or in accordance with FCFS scheduling process is ready, but every time scheduling, the CPU will allocate and execute a time slice (a few for the team's first process ms ~ one hundred MS ). Execution time slice that is generated by the clock after the timer interrupt, stop the process and send it to the tail, the other in sequence. This ensures that the system can execute the request for all user processes within a given time.

  Multilevel Feedback Scheduling Algorithm: The front has limitations, integrated -> Multilevel feedback scheduling algorithm is not necessary to know in advance that the execution time required for each process, but also to meet the needs of various types of processes, so it is now being recognized as a kind of a good process scheduling algorithm.

(1) providing a plurality of ready queues, each priority order is reduced. The smaller the time slice allocated for each different size queues, the higher priority queue, which predetermined process execution time slice.

(2) queue or in accordance with the FCFS principle waiting, if the first queue is the first team process is not be executed within a predetermined time slice, directly transferred to the second queue tail, a sequentially put back end of the queue. So long a job will be assigned to process n queues slice execution time.

(3) are executed in the queue has, if new entrants are to be treated with higher priority processes, the new process will preempt a running process, the process is preempted placing the tail is running.

 

1. preemptive and non-preemptive kernel kernel

  1.1.UNIX preemptive kernel, Windows, Linux non-preemptive multitasking kernel.

Preemptive:  kernel space, when there is a higher priority task occurs, can the current task suspended the implementation of a higher priority process .

Non-preemptive: high-priority process can not abort a low-priority process is running in the kernel and grab CPU operation. Unless the process voluntarily give up the CPU , otherwise the process will run forever, until the completion or exit core .

Multitasking system , the kernel is responsible for managing the various tasks , or tasks assigned to each CPU time , and is responsible for communication between tasks.

  1. 2.Linux the CPU preemption two cases:

1 ) User Preemption (occurs when: from the call to return to user space systems, from interrupt ( an exception ) handler returns to user space when);

2 ) kernel preemption (refers to the process that runs in the kernel , probably during the execution of the kernel function to be replaced by another process if the kernel: the timing of the occurrence of the task blockage , tasks initiative to give up CPU usage rights Shi)

  . 1.3 requires kernel preemption reasons:

When the kernel in a relatively time-consuming operation , such as the relevant file system or memory management tasks , while other processes can not be performed , not schedule ,  which resulted in the system latency increasesusers experience a "slow" response

2. priority inversion problem:

  High-priority task to access shared resources, at a time when low-priority task is occupied, this time after the arrival of the first medium-priority task is finished, the low-priority task to release resources was a high priority task to be performed, which happened priority flip-level problem.

Solution: Priority ceiling, priority inheritance

Priority Ceiling:

  When the task of applying for a resource will increase the priority of the current task to the highest priority task can access the resource.

Priority inheritance:

  When the task of applying for a resource that is already occupied, it is judged whether the current task is higher than the priority of resource intensive tasks, if high, then the resource-priority task to raise the priority of the current task, such as after the release of resources then resume the priority of its own.

Guess you like

Origin www.cnblogs.com/hjh-666/p/11449470.html