文件名称:fork_textcanjian
- 所属分类:
- Linux/Unix编程
- 资源属性:
- [C/C++] [源码]
- 上传时间:
- 2012-11-26
- 文件大小:
- 8kb
- 下载次数:
- 0次
- 提 供 者:
- 相关连接:
- 无
- 下载说明:
- 别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容均来自于网络,请自行研究使用
1、 了解系统调用fork()、execl()、exit()、getpid()和waitpid()的功能和实现过程
2、 编写一段程序实现以下功能:
a) 使用系统调用fork()创建两个子进程
b) 父进程重复显示字符串”parent:”,并使用函数getpid()显示自己的进程ID。
c) 两个子进程分别重复显示字符串”child:”,并使用函数getpid()显示自己的进程ID
3、 编写一段程序实现以下功能:
a) 使用系统调用fork()创建一个子进程
b) 子进程显示自己的进程ID和字符串": The child is calling an exec.\n",然后通过execl()调用系统命令ps显示当前运行的进程情况,从而更换自己的执行代码,最后调用exit()结束。
c) 父进程显示自己的进程ID和字符串” ": The parent is waiting for child to exit.\n ",然后调用waitpid()等待子进程结束,并在子进程结束后显示”The parent exit.\n
-1, the understanding of the system call fork (), execl (), exit (), getpid (), and waitpid () function and process 2, write a procedure to achieve the following functions : a) The use of system calls fork () to create two child process b) the parent process repeated string "parent : ", and the use of function getpid () show their ID process. C) two separate child process repeated string "child :" and the use of function getpid () show their ID 3 process, to prepare a process to achieve the following functions : a) The use of system calls fork () to create a child process b) children show their ID process, and the string " : The child is calling an exec. \ n " Then execl () call system commands ps shows currently running process, thereby replacing the execution
2、 编写一段程序实现以下功能:
a) 使用系统调用fork()创建两个子进程
b) 父进程重复显示字符串”parent:”,并使用函数getpid()显示自己的进程ID。
c) 两个子进程分别重复显示字符串”child:”,并使用函数getpid()显示自己的进程ID
3、 编写一段程序实现以下功能:
a) 使用系统调用fork()创建一个子进程
b) 子进程显示自己的进程ID和字符串": The child is calling an exec.\n",然后通过execl()调用系统命令ps显示当前运行的进程情况,从而更换自己的执行代码,最后调用exit()结束。
c) 父进程显示自己的进程ID和字符串” ": The parent is waiting for child to exit.\n ",然后调用waitpid()等待子进程结束,并在子进程结束后显示”The parent exit.\n
-1, the understanding of the system call fork (), execl (), exit (), getpid (), and waitpid () function and process 2, write a procedure to achieve the following functions : a) The use of system calls fork () to create two child process b) the parent process repeated string "parent : ", and the use of function getpid () show their ID process. C) two separate child process repeated string "child :" and the use of function getpid () show their ID 3 process, to prepare a process to achieve the following functions : a) The use of system calls fork () to create a child process b) children show their ID process, and the string " : The child is calling an exec. \ n " Then execl () call system commands ps shows currently running process, thereby replacing the execution
(系统自动生成,下载前可以参看下载内容)
下载文件列表
forktest.c
forktest.exe
fork_test.c
fork_test.exe
forktest.exe
fork_test.c
fork_test.exe