3
Process Control Block in Linux A process in an operating system is represented by a data structure known as a process control block (PCB/ Task Controlling Block / Task Struct). The PCB contains important information about the specific process including the current state of the process i.e., whether it is ready, running, waiting, or whatever. This is the snapshot of Task Struct I found in Linux/sched.h Task_struct { Volatile long state; This contains the current state of the process Long counter; This value acts like a reference count on the task structure of a process Long priority This handles the priority number of the different Processes Unsigned long signals; This handles the pending signals involved during processes Unsigned long blocked; This handles the masked signals involved during Processing Int pid, pgrp, uid, euid, gid, egid; Struct linux_binfmt; Struct task_struct p_opptr; This is the pointer to the original parent Struct task_struct p_pptr; This is the pointer to the intermediate parent Struct task_struct p_cptr; This is the parent to the most recent child available

Process Control Block in Linux

Embed Size (px)

DESCRIPTION

It's about the TCB in Linux

Citation preview

Page 1: Process Control Block in Linux

Process Control Block in Linux

A process in an operating system is represented by a data structure known as a process control block (PCB/ Task Controlling Block / Task Struct). The PCB contains important information about the specific process including the current state of the process i.e., whether it is ready, running, waiting, or whatever.

This is the snapshot of Task Struct I found in Linux/sched.h

Task_struct {

• Volatile long state; This contains the current state of the process

• Long counter; This value acts like a reference count on the task structure of a process

• Long priority This handles the priority number of the different Processes

• Unsigned long signals; This handles the pending signals involved during processes

• Unsigned long blocked; This handles the masked signals involved during Processing

• Int pid, pgrp, uid, euid, gid, egid;• Struct linux_binfmt;• Struct task_struct p_opptr;

This is the pointer to the original parent• Struct task_struct p_pptr;

This is the pointer to the intermediate parent• Struct task_struct p_cptr;

This is the parent to the most recent child available• Struct task_struct p_ysptr;

This is the pointer to the current/following sibling• Struct task_struct p_osptr;

This is the pointer to the previous sibling• Struct task_struct *next_task;

This is the structure of the next task in queue of processes• Struct task_struct *prev_task;

Page 2: Process Control Block in Linux

This conatins the structure of the previous tasks in the process list• Struct task_struct *next_run;

This contains the structure of the the next process which are ready to run in ready queue

• Struct task_struct *prev_run; This is the structure of the previous executed processes in the read queue

• Struct mm_struct mm[1];

• Unsigned long kernel_stack_page;

• Unsigned long saved_kernel_stack;

• Struct fs_struct fs[1];

• Long utime, stime, cutime, cstime, start_time;

• Struct sem_queue *semsleeping;

• Struct wait_queue *wait_chldexit;

• Struct sigaction sigaction[32];

• Struct rlimit rlim[RLIM_NLIMITS];

• Struct thread_struct tss;

This includes saved registers

• Unsigned long policy;

• Unsigned long rt_priority;

• Int processor, last processor;

• Int lock_depth;

It indicates how many times has been acquired the kernel lock. This lock protects some of the kernel data structures.

}

Abdul Rehman

L11-4065

OS: Section B