parent: child 1234 is done这种结果是父进程执行到pid = wait()
子进程已经退出 不在运行了 所以只有父进程一个进程在运行 按顺序执行。
exit函数调用退出进程 并且释放进程占用的资源
System call Description
fork() Create process
exit() Terminate current process
wait() Wait for a child process to exit
kill(pid) Terminate process pid
getpid() Return current process’s id
sleep(n) Sleep for n seconds
exec(filename, *argv) Load a file and execute it
sbrk(n) Grow process’s memory by n bytes
open(filename, flags) Open a file; flags indicate read/write
read(fd, buf, n) Read n byes from an open file into buf
write(fd, buf, n) Write n bytes to an open file
close(fd) Release open file fd
dup(fd) Duplicate fd
pipe(p) Create a pipe and return fd’s in p
chdir(dirname) Change the current directory
mkdir(dirname) Create a new directory
mknod(name, major, minor) Create a device file
fstat(fd) Return info about an open file
link(f1, f2) Create another name (f2) for the file f1
unlink(filename) Remove a file