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.)