Understand the linux kernel-ch3-Process descriptor

Chapter 3. Processes
a process is an instance of a program in execution
From the kernel's point of view, the purpose of a process is to act 
as an entity to which system resources (CPU time, memory, etc.) are allocated
lightweight processes to offer better support for multithreaded applications
Process Descriptor
task_struct
Process State
#define TASK_RUNNING0
#define TASK_INTERRUPTIBLE1
#define TASK_UNINTERRUPTIBLE2
#define TASK_STOPPED4
#define TASK_ZOMBIE8
#define TASK_DEAD16
EXIT_ZOMBIE
EXIT_DEAD
set_task_state
set_current_state
Identifying a Process
PID
tgid
Process descriptors handling
task
movl $0xffffe000,%ecx /* or 0xfffff000 for 4KB stacks */thread_infotask_struct
andl %esp,%ecx 
movl %ecx,pkernel stack
 
esp
current macro//current.h
static inline struct thread_info *current_thread_info(void)
{
struct thread_info *ti;
__asm__("andl %%esp,%0; ":"=r" (ti) : "0" (~8191UL));
return ti;
}
static inline struct task_struct * get_current(void)
{
return current_thread_info()->task;
}
#define current get_current()
Doubly linked lists
LIST_HEAD_INIT//include/linux/list.h
LIST_HEAD
INIT_LIST_HEAD
HLIST_HEAD_INIT
HLIST_HEAD
       
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值