The process is during execution.ProgramAnd other resources.
Process passedFork ()System Call generation. This system call creates a new process by copying an existing process.Fork ()Two responses are returned for one call: one for the parent process and one for the newly created child process.
Process Descriptor and Task Structure
The kernel places the process inTask ListIn a two-way circular linked list, each of which isTask_structStructure (process descriptor ).Task_structLarge Structure (32About1.7 KContains all the information required by the kernel management process.
LinuxPassSlabDistributor allocationTask_structStructure to achieve Object reuse and cache coloring.
Each process passes throughPID. The default maximum value is32768, You can use/Proc/sys/kernel/pid_maxModify.
Thread_infoStructure
Struct Thread_info {
struct task_struct * task ; /* Main Task Structure */
struct exec_domain * exec_domain ; /* execution domain */
unsigned long flags ; /* low level flags */
unsigned long Status ; /* thread-synchronous flags */
_ u32 CPU ; /* Current CPU */
IntPreempt_count ; /* 0 => preemptable, <0 => bug */
Mm_segment_t addr_limit ; /* Thread address space:
0-0xbfffff for user-thead
0-0xffffffff for Kernel-Thread
*/
void * sysenter_return ;
Struct Restart_block ;
unsigned long previus_esp ; /* esp of the previous stack in case
Of nested (IRQ) stacks
*/
_ U8 supervisor_stack [0];
};
This structure is allocated at the end of the kernel stack.
How to find the process descriptor of the currently running process
Why shield 13 lower bits (when thread_size is 8192 ):
the stack in the kernel is from high address to low address. thread_info and kernel stack ( kernel state stack ) share the same memory , and thread_info allocation at the end of the kernel stack .