一、进程与信号之概念与结构

认识进程

ps -ef |more

UID         PID   PPID  C STIME TTY          TIME CMD
root          1      0  0 19:06 ?        00:00:04 /sbin/init auto noprompt
root          2      0  0 19:06 ?        00:00:00 [kthreadd]
root          3      2  0 19:06 ?        00:00:00 [ksoftirqd/0]
root          4      2  0 19:06 ?        00:00:00 [kworker/0:0]
root          5      2  0 19:06 ?        00:00:00 [kworker/0:0H]

进程在内核中的结构

内核进程task_struct通过file_struct 操作文件

linux内核源码task_struct

cd /usr/src/linux-headers-4.4.0-28/include/linux

ls sched.h

vim sched.h  

vi 下搜索 进程指针结构体
:/task_struct

1380 struct task_struct {
1381         volatile long state;    /* -1 unrunnable, 0 runnable, >0 stopped */
1382         void *stack;
1383         atomic_t usage;
1384         unsigned int flags;     /* per process flags, defined below */
1385         unsigned int ptrace;

vi 下搜索 文件指针结构体
:/struct file

1564 /* open file information */
1565         struct files_struct *files;

 

 

posted @ 2016-08-27 10:21  jmst  阅读(240)  评论(0编辑  收藏  举报