Analysis on multi-task of Linux (II.)

Source: Internet
Author: User

In one we talked about multitasking where different processes have their own separate code snippets, data segments, and stack segments. Seemingly using this principle can be multi-task isolation, but their starting address of each paragraph is 0, which is very silent, but it doesn't matter, the page will continue to talk. This article says a multi-tasking switch.

The x86 system supports switching between tasks on the hardware, and it says that Linux is actually running a task at the same time, but because he can switch between different tasks in a very short time, we feel that he is doing it with multiple tasks. Since it is necessary to switch back and forth between tasks, it is necessary to record the status of each process being switched so that it can be restored when it is switched. Each process has its own segment of a record process state TSS (taskstate segment). Since there is a paragraph then there is a paragraph start address and the size of the paragraph, etc., OK, the natural paragraph descriptor (TSSD) The appearance, since the paragraph descriptor is out of the total need to have a paragraph descriptor place, the famous GDT came out. This goes back to the principle that was mentioned in the previous blog post. But wait here the TSS only gives a few task states, and a large portion of the task status is recorded in the TSSD (Task status descriptor), TSSD has a thread field of type Thread_struct, which is dedicated to storing this information. So the hardware switching process only need to keep the status of the current process, and then the switch to the process state to get back on it. Status you can understand the values in each register. Reference: http://oss.org.cn/kernel-book/ch05/5.4.1.htmhttp://guojing.me/linux-kernel-architecture/posts/process-switch/

Analysis on multi-task of Linux (II.)

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.