Linux 进程创建
作者:李智敏,华清远见嵌入式学院上海分中心讲师。
在 Linux 内核内,进程是由相当大的一个称为 task_struct 的结构表示的。此结构包含所有表示此进程所必需的数据,此外,还包含了大量的其他数据用来统计(accounting)和维护与其他进程的关系(父和子)。下面给出了 task_struct 的一小部分。task_struct 位于 ./linux/include/linux/sched.h。
struct task_struct {
volatile long state;
void *stack;
unsigned int flags;
int prio, static_prio;
struct list_head tasks;
struct mm_struct *mm, *active_mm;
pid_t pid;
pid_t tgid;
struct task_struct *real_parent;
char comm[TASK_COMM_LEN];
struct thread_struct thread;
struct files_struct *files;
...
};
在task_struct中,可以看到几个预料之中的项,比如执行的状态、堆栈、一组标志、父进程、执行的线程(可以有很多)以及开放文件。对其做简单声明如下
<1> state 变量是一些表明任务状态的比特位。最常见的状态有:
1.TASK_RUNNING 表示进程正在运行,或是排在运行队列中正要运行
2.TASK_INTERRUPTIBLE 表示进程正在休眠
3.TASK_UNINTERRUPTIBLE 表示进程正在休眠但不能叫醒
4.TASK_STOPPED 表示进程停止
注:这
相关文档:
一、在linux下实现文件的共享有很多的方式如:nfs,samba,ftp,Apahce下面分别描述:
一、nfs的使用:
一、Linux 服务器端NFS 服务器的配置
以root 身份登陆Linux 服务器,编辑/etc 目录下的共享目录配置文件exports,指定共享目录及权限等。
执行 ......
Linux下jboss 5.1安装配置步骤
一、下载jboss 5.1和jdk1.6(我把他下载到/usr/local/src/tarbag)
jboss 5.1ZIP包 http://sourceforge.net/projects/jboss/files/JBoss/JBoss-5.1.0.GA/
java jdk包 http://java.sun.com/javase/downloads/widget/jdk6.jsp
二、解压
#cd /usr/lo ......
Q. How can I add a user to a group under Linux operating system?
A. You can use useradd or usermod commands to add a user to a group. useradd command creates a new user or update default new user information. usermod command modifies a user account i.e. it is useful to add user to existin ......
安装与使用MySQL
一 、下载MySQL的安装文件
安装MySQL需要下面两个文件:
MySQL-server-4.0.16-0.i386.rpm
MySQL-client-4.0.16-0.i386.rpm
下载地址为:http://www.mysql.com/downloads/mysql-4.0.html, 打开此网页,下拉网页找到“Linux x86 RPM downloads”项,找到“Server&rdquo ......