Process structure
Each process in the Linux0.12 has the following structure:
-
< Span style= "Font-family:courier New; Font-size:18px "> occupies two of the GDT, one is the TSS segment descriptor and one is the LDT segment descriptor.
-
occupies one item in the task array, pointing to a page of physical memory, the low end of the physical memory is the Process Control block Task_struct (which includes the TSS segment and the LDT segment), and the remainder is the process's kernel-state stack.
-
There are related items set up in the page catalog table and in the page table.
In Linux0.12, there are up to 64 processes, the task array size is also defined as 64, and each process corresponds to item one by one in a task array. Although there are 256 items in the GDT, they are not used. The first GDT item is reserved, the kernel uses 2 items, and the system retains 2 items for each process. Such a process corresponds to 2 GDT item one by one. That is, the assignment of the task array and the GDT in linux0.12 is dead, such as the task array of a process is a NR, i.e. its process control block is pointed by Task[nr], then its TSS descriptor and LDT descriptor are located in Gdtr+3*8+nr*16 and gdtr+3 *8+nr*16+8 Place.
Linux0.12 Memory Physical Address 0 starts with a page of table of contents and a four-page table. This page catalog table is shared by all processes. The subsequent four page table maps the 16M physical memory, which is the page table for the kernel and process 0. The page table needs to be requested from the main memory area at a later time when the process is created, and the page catalog entries are taken directly from the page catalog table. Such processes and page catalogs table pages exist with these one by one correspondence, the task number is the NR process, the corresponding page directory of nr*16~ (nr+1) *16 altogether 16 directory entries. This allows 4G of linear space to be shared by 64 processes, with each process being divided into 64M.
One by one correspondence between three structures