code:proc - ikarishinjieva/unixV6-code-analyze-chs GitHub Wiki
0350 /*
0351 * One structure allocated per active
0352 * process. It contains all data needed
0353 * about the process while the
0354 * process may be swapped out.
0355 * Other per process data (user.h)
0356 * is swapped with the process.
0357 */
0358 struct proc
0359 {
0360 char p_stat;
0361 char p_flag;
- 进程状态,常量定义在proc.h
0362 char p_pri; /* priority, negative is high */
- 进程标志,常量定义在proc.h
0363 char p_sig; /* signal number sent to this process */
0364 char p_uid; /* user id, used to direct tty signals */
- 发送给该进程的信号
0365 char p_time; /* resident time for scheduling */
- 进程的用户ID(UID)
0366 char p_cpu; /* cpu usage for scheduling */
- 进程 驻留时间
0367 char p_nice; /* nice for scheduling */
- 进程 CPU 使用程度
0368 int p_ttyp; /* controlling tty */
- 进程优先级
0369 int p_pid; /* unique process id */
- 进程 所属的tty
0370 int p_ppid; /* process id of parent */
- 进程 的进程号
0371 int p_addr; /* address of swappable image */
- 进程父进程 的进程号
0372 int p_size; /* size of swappable image (*64 bytes) */
- 该进程 可交换图像 的地址
- 该地址 为物理实地址,不经过pdp11虚实地址转换,可以直接赋给KISA6(参看KISA6寻址)
0373 int p_wchan;/* event process is awaiting */
- 可交换的进程图像 的大小 (块数,64字节/块)
0374 int *p_textp;/* pointer to text structure */
- 进程睡眠原因
- 常量定义 参看睡眠原因
0375struct text
- 指向 进程的正文段的控制块
0376 } proc[NPROC];
0377 /* ------------------------- */
- NPROC定义在param.h 的0144行,值为50