Process scheduling and process switching in the process scheduling and tracking analysis

Source: Internet
Author: User

1 Understanding process scheduling timing and process switching processes:

      1. Schedule () calls occur during interrupt processing (including clock interrupts, I/O interrupts, system calls, and exceptions), call schedule () directly, or call schedule () from the need_resched tag when returning to the user state;

      2. Kernel threads can directly call schedule () for process switching, or in the process of interrupt processing, which means that kernel threads as a special kind of process can be active scheduling, but also can be passively dispatched;
      3. The user-state process cannot implement the active scheduling, but can only be dispatched by a point in time after the kernel state, that is, scheduling during interrupt processing.
    1. Analyze a schedule () function to verify your understanding of Linux system process scheduling and process switching process, and recommend to complete the experiment in the lab Building Linux virtual Machine environment.

    2. Switch_to prev points to the current process, and next points to the scheduled process. Switching mechanism of the process context:

      • The process context contains all the information required for the execution of the

        • User address space: Includes program code, data, user stack, etc.

        • Control information: Process descriptor, kernel stack, etc.

        • Hardware context (note that interrupts are also saved by the hardware context only if the method is saved differently)

    3. Interrupt Context Switch relationship: Before and after the interrupt is in the same process context, only by the user state to the kernel state execution. Switch_to is a function that indicates the content of the next specific instruction to be executed.   

      1. Timing of process scheduling and timing of process switching scheduling: Occurs during interrupt processing, such as I/O interruption, clock interrupt, etc., or in the execution of the return user state is called schedule ().

        1. The switch_to stack state is processed at the save site of the currently executing process x content, and then restore_all the contents of the process Y that is about to be executed. Summary part: Linux system General execution process, can be abstracted into the executing process x switch to process y and then switch to process Z ... And so on, between the various states to be involved in the preservation of the scene, the resumption of the scene, the context of the switch, there are a series of process scheduling timing, algorithm selection, and so on, is the core of the computer is a key part of a very central part.

Process scheduling and process switching in the process scheduling and tracking analysis

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.