Unix程设计基础.pptVIP

  • 4
  • 0
  • 约6.14千字
  • 约 48页
  • 2019-01-03 发布于浙江
  • 举报
Unix程设计基础

Unix程序设计基础 第二讲;上一讲回顾;上一讲回顾;操作系统的重要概念:进程;什么是进程?;“独立地址空间”很重要;进程的并发性;并发带来的好处与挑战;并发带来的好处与挑战;数据的不一致性;数据的不一致性;数据的不一致性;Unix下的进程;状态之间的转换;进程ID与进程间的关系;Unix下的多进程编程;进程控制;进程创建;#include unistd.h #include stdlib.h #include stdio.h int main(void) { pid_t pid; if ((pid = fork()) 0) printf(“I am the parent, my pid = %u, my child’s pid = %u\n”, getpid(), pid); else if (pid == 0) printf(“I am the child, my pid = %u, my parent’s pid = %u\n”, getpid(), getppid()); else { perror(“fork”); return 1; } return 0; } ;进程创建;进程创建;执行一个新程序;执行一个

文档评论(0)

1亿VIP精品文档

相关文档