Understand the linux kernel-ch3-Process descriptor
2008-06-19 21:39
381 查看
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_RUNNING | 0 | ||||||||||
#define TASK_INTERRUPTIBLE | 1 | ||||||||||
#define TASK_UNINTERRUPTIBLE | 2 | ||||||||||
#define TASK_STOPPED | 4 | ||||||||||
#define TASK_ZOMBIE | 8 | ||||||||||
#define TASK_DEAD | 16 | ||||||||||
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_info | task_struct | |||||||||
andl %esp,%ecx | |||||||||||
movl %ecx,p | kernel 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 | |||||||||||
: |
相关文章推荐
- Understanding the linux kernel-ch3-Process Switch
- Understanding the linux kernel-ch3-Creating Processes
- Understanding the linux kernel-ch3-Destroying Processes
- Understanding the linux kernel-ch3-Process descriptor
- Linux核心 (The Linux Kernel)
- coding style for the linux kernel
- The Linux kernel analysis
- Notes on Understanding the Linux Kernel
- The Linux Kernel Module Programming Guide
- Building a Linux kernel module without the exact kernel headers
- mini2440内核停在booting the kernel问题以及无法运行linuxrc问题的解决方法
- How much memory is consumed by the Linux kernel per TCP/IP network connection?
- Debugging the Linux Kernel with debugfs
- Kbuild: the Linux Kernel Build System
- High Memory in the Linux Kernel
- debugging the linux kernel under ubuntu 11.04
- The Linux Kernel API
- Understanding the linux kernel-ch1-overview
- Uncompressing Linux..... done, booting the kernel.
- Notes Understanding the Linux kernel