设为首页 加入收藏

TOP

Linux系统调用跟我学――进程管理(三)
2010-12-30 20:27:41 】 浏览:11378
Tags:Linux 系统 调用 跟我学 进程 管理
rver
root 1005 0.0 0.5 1584 660 S May15 0:00 crond
wnn 1025 0.0 1.9 3720 2488 S May15 0:00 /usr/bin/tserver
xfs 1079 0.0 2.5 4592 3216 S May15 0:00 xfs -droppriv -da
daemon 1115 0.0 0.4 1444 568 S May15 0:00 /usr/sbin/atd
root 1130 0.0 0.3 1384 448 tty1 S May15 0:00 /sbin/mingetty tt
root 1131 0.0 0.3 1384 448 tty2 S May15 0:00 /sbin/mingetty tt
root 1132 0.0 0.3 1384 448 tty3 S May15 0:00 /sbin/mingetty tt
root 1133 0.0 0.3 1384 448 tty4 S May15 0:00 /sbin/mingetty tt
root 1134 0.0 0.3 1384 448 tty5 S May15 0:00 /sbin/mingetty tt
root 1135 0.0 0.3 1384 448 tty6 S May15 0:00 /sbin/mingetty tt
root 8769 0.0 0.6 1744 812 S 00:08 0:00 in.telnetd: 192.1
root 8770 0.0 0.9 2336 1184 pts/0 S 00:08 0:00 login -- lei
lei 8771 0.1 0.9 2432 1264 pts/0 S 00:08 0:00 -bash
lei 8809 0.0 0.6 2764 808 pts/0 R 00:09 0:00 ps -aux


以上除标题外,每一行都代表一个进程。在各列中,PID一列代表了各进程的进程ID,COMMAND一列代表了进程的名称或在Shell中调用的命令行,对其他列的具体含义,我就不再作解释,有兴趣的读者可以去参考相关书籍。

getpid

在2.4.4版内核中,getpid是第20号系统调用,其在Linux函数库中的原型是:

#include<sys/types.h> /* 提供类型pid_t的定义 */
#include<unistd.h> /* 提供函数的定义 */
pid_t getpid(void);


getpid的作用很简单,就是返回当前进程的进程ID,请大家看以下的例子:

/* getpid_test.c */
#includ
首页 上一页 1 2 3 4 5 6 7 下一页 尾页 3/8/8
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇Linux系统调用跟我学――僵尸进程 下一篇Linux系统调用跟我学

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目