Process-related data structures in the Linux kernel (based on LINUX-MAINLINE-RC4)

Source: Internet
Author: User

1. Process Descriptor

struct Task_struct {

volatile long state;

.......

struct List_head tasks;

.......

struct mm_struct *mm, *active_mm;

.......

struct vm_area_struct *vmacache[vmacache_size];

......

pid_t pid;
pid_t Tgid;

.......
}
File: Include/linux/sched.h

2. The thread descriptor (current points to the descriptor, and the process descriptor is found by this descriptor)

struct Thread_info {
struct Task_struct *task; /* Main task structure */
Struct2.              Exec_domain *exec_domain; /* Execution Domain */
__U32 flags; /* Low Level flags */
__U32 status; /* Thread Synchronous Flags */
__U32 CPU; /* Current CPU */
int saved_preempt_count;
mm_segment_t Addr_limit;
struct Restart_block restart_block;
void __user *sysenter_return;
unsigned int sig_on_uaccess_error:1;
unsigned int uaccess_err:1; /* Uaccess failed */
};

File: arch/x86/include/asm/thread_info.h

3. Kernel stack of the process

Union thread_union {

struct Thread_info thread_info;

unsigned long stack[thread_size/sizeof (long)];

}

File: Include/linux/sched.h

    

4. Running queue for a process

 struct Rt_prio_array {

Declare_bitmap (BITMAP, max_rt_prio+1);

struct List_head Queue[max_rt_prio];

}

File: Kernel/sched/sched.h

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.