Contact Us
Blog / How to Utilize Linux Procedure to Manage Block PCB

How to Utilize Linux Procedure to Manage Block PCB

Posted:10:59 AM May 17, 2021 writer: louise

The significance of the procedure


Firstly, what is the procedure?

  • 1 > A procedure is a circumstance of an implementation of a program;
  • 2 > Refine is the program being performed
  • 3 > A procedure is an entity that can assign a CPU as well as be performed by the CPU to discuss the procedure from the viewpoint of the bit: it functions as an entity that allows system sources (CPU time, memory).

Both standard aspects of the procedure are as complies with :
Initially, the program code (might be shared by various other procedures implementing the very same program).
Second, the information collection is related to the code. The information collection related to the code right here describes the information section as well as the procedure control block PCB. A procedure is a vibrant summary, however, it does not imply that all procedures are running. (Procedures remain in different states in memory because of plan or organizing needs).


Refine control block PCB

Mentioning PCB is not strange, initial consider what aspects are consisted of in the PCB:

  • Identifier: A special identifier connected with a procedure that compares procedures being carried out as well as various other procedures.
  • Standing: Defines the state of the procedure. Since the procedure has several states, such as put on hold, obstruct, as well as run, there is an identifier to tape the implementation state of the procedure.
  • Top priority: If several procedures are performing, it entails the order in which the procedures are carried out, which relates to the identifier of the procedure's top priority.
  • Program counter: the address of the following guideline to be carried out in the program.
  • Memory guideline: A reminder to program code and also process-related information.
  • Context information: The information in the CPU signs up at the time the procedure is implemented.
  • I/O condition details: consisting of the shown I/O demand, the I/O tool appointed to the procedure, as well as the listing of data utilized by the procedure.
  • Audit info: consisting of the amount of the moment of the CPU, accounting account number, and more.

This information framework is a framework, produced as well as handled by the os. Allow's have a look at the task_struct to see exactly how the os controls as well as routines the procedure with the procedure control block.


Task_struct resource participant resolution

This information framework, which is specified in the Linux-2.6.38.8/ include/Linux/sched. h documents. Allow's present the complicated participants of tast_struct:


Refine standing

1. volatile long state;/* -1 unrunnable, 0 runnable, >0 stopped */

The above variable is a member explaining the state of the procedure. The expertise that we found out along with the C language unpredictable keywords is to decrease the compiler's optimization of the code. The state variable constantly reviews the material from the variable's memory as opposed to the register; hence guaranteeing the procedure. The security of real-time access to system condition.

The feasible worths of the state participant are as adheres to.

#define TASK_RUNNING 0
#define TASK_INTERRUPTIBLE 1
#define TASK_UNINTERRUPTIBLE 2
#define TASK_STOPPED 4
#define TASK_TRACED 8

/*in tsk->exit_state */
#define EXIT_DEAD 16
#define EXIT_ZOMBIE 32
#define EXIT_TRACE ( EXIT_ZOMBIE | EXIT_DEAD )

/* in tsk->state again */
#define TASK_DEAD 64
#define TASK_WAKEKILL 128     /**wake on signals that are deadly**/
#define TASK_WAKING 256
#define TASK_PARKED 512
#define TASK_NOLOAD 1024
#define TASK_STATE_MAX 2048

/* Convenience macros for the sake of set_task_state */
#define TASK_KILLABLE (TASK_WAKEKILL | TASK_UNINTERRUPTIBLE)
#define TASK_STOPPED            (TASK_WAKEKILL | __TASK_STOPPED)
#define TASK_TRACED             (TASK_WAKEKILL | __TASK_TRACED)


We can see the remark after the variable meaning, which reveals that the variable web content <0 is not running, 0 is the running state, and >0 is the quitting state. Listed below we present a couple of generally made use of worths:
lunix common used values
Process identifier


Pid_t pid; //identifier of the process
Pid_t tgid //thread group identifier


The procedure identifier is to differentiate each procedure; this is presented since Unix designers desire the same collection of strings to have the very same PID, so tgid is presented.


Procedure Tag

unsigned int flags;   /* per process flags,defined below*/

The condition details of the flags response procedure, utilized by the bit to recognize the condition of the existing procedure.
Frequently utilized states are as adheres to:

lunix current process used states

a participant standing for a procedure kinship

unsigned int flags;       /* per process flags,defined below*/
a participant standing for a procedure kinship.
/*
 * pointers to (original) parent process, youngest child, younger sibling,
 * older sibling, respectively.  (p->father can be replaced with
 * p->real_parent->pid)
 */
struct task_struct __rcu *real_parent;     /* real parent process */
struct task_struct __rcu *parent;       /* recipient of SIGCHLD, wait4() reports */

/*children/sibling forms the list of my natural children*/

struct list_head children;      /* list of my children */
struct list_head sibling;       /* linkage in my parent's children list */
struct task_struct *group_leader;       /* threadgroup leader */

a member representing a process kinship

Place system phone call

The place offers mom and dad procedures that can be utilized to manage the procedure of a kid procedure. It is commonly utilized for breakpoint debugging. When it is readied to 0, it indicates no trace is needed.

Process scheduling

top priority

int prio, static_prio, normal_prio;
unsigned int rt_priority;

Process scheduling Lunix
Fixed concern:
Meaning: He does not transform with time, the bit will certainly not change it proactively, just the system phone call great to customize static_prio.
Dynamic top priority:
Interpretation: The scheduler awards the IO-consuming procedure or punishes the CPU usage procedure by or decreasing the fixed-top priority of the procedure. The modified top priority is the vibrant concern (prio).
Real-time top priority:
Meaning: Real-time concern is just legitimate for real-time procedures.
In the variety of real-time concerns as well as a fixed top priority, the bigger the worth, the reduced the concern.

Tag: Linux Procedure Block PCB
  • PCB
    Prototype
  • PCB
    Assembly
  • SMD
    Stencil

Dimensions: (mm)

×

Quantity: (pcs)

5
5
10
15
20
25
30
40
50
75
100
120
150
200
250
300
350
400
450
500
600
700
800
900
1000
1500
2000
2500
3000
3500
4000
4500
5000
5500
6000
6500
7000
7500
8000
9000
10000

Other Quantities:(quantity*length*width is greater than 10㎡)

OK

Layers:

Thickness:

Quote now