[第七章linux进程.pptVIP

  • 2
  • 0
  • 约9.23千字
  • 约 38页
  • 2017-01-06 发布于北京
  • 举报
[第七章linux进程

2-2 创建进程 调用fork 子进程为父进程的副本 子进程和父进程都从调用fork的地方继续执行 #include unistd.h pid_t fork(void); 1.成功:在父进程中返回子进程的PID,在子进程中返回0 2.失败,返回-1,子进程没有创建。 Evaluation only. Created with Aspose.Slides for .NET 3.5 Client Profile 5.2.0.0. Copyright 2004-2011 Aspose Pty Ltd. 2-2 fork系统调用 #include stdio.h #include sys/types.h #include unistd.h int main () { pid_t child_pid; printf (“the main program process ID is %d\n, (int) getpid ()); child_pid = fork (); if (child_pid != 0) { printf (“this is the parent process, with id %d\n, (int) getpid ()); printf (the

文档评论(0)

1亿VIP精品文档

相关文档