"Linux kernel Analysis" MOOC course complete a simple time slice rotation multi-channel program kernel code

Source: Internet
Author: User

In the previous article, a process was introduced, and the process of stack changes when calling subroutines was analyzed. This article describes the process of multi-process execution, when a process needs to stop to wait for a certain condition or the CPU to allocate the time slice run out need to switch to another process, when the switch first generates an interrupt, then the CPU will perform the corresponding interrupt processing operation, An important operation, for example, is to protect the stack of the current process and the value of the CPU register, and resume the last state when the CPU is dispatched again.

Follow the steps on Mykernel to install the program, perform Qemu-kernel arch/x86/boot/bzimage see such as:

   

The following procedures are executed:

    

    

Executes a process a i++ operation, when i%100000 prints the value of I, when the clock interrupt occurs when the interrupt processing My_timer_handler is performed. We found that the printed I value is always increasing, that is, after the interrupt processing execution after the CPU continues to dispatch to a, I maintain the last time the completion of the dispatch value, this is how to do it, is to interrupt processing , below we pass the program simulation of the process.

   

  

"Linux kernel Analysis" MOOC course complete a simple time slice rotation multi-channel program kernel code

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.