One of the Linux kernel guidelines-general Linux technology-Linux programming and kernel information. The following is a detailed description. In LINUX, threads are processes that share CONTEXT. They can be processed by non-standard system calling clone.
The context is simply an environment. Compared with a process, it is the environment in which the process is executed. Specifically, it refers to various variables and data, including all register variables, files opened by processes, and memory information. The context of a process can be divided into three parts: user-level context, register context and system-level context.
User-level context: body, Data, user stack, and shared storage zone; register context: General registers, program registers (IP), processor status registers (EFLAGS), and stack pointers (ESP ); system-level context: Process Control Block (task_struct), memory management information (mm_struct, vm_area_struct, pgd, pmd, pte, etc.), and core stack.
When a process is scheduled, the context switch is used. The operating system must switch all the context information mentioned above before the new scheduling can run.
The system calls mode switch ). Compared with process switching, mode switching is much easier and saves time, because the main task of mode switching is to perform context switching at the register level.
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