Linux Process Management (1)

Source: Internet
Author: User

 

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 .



 

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.