读书笔记系列 - Operating Systems: Three Easy Pieces - Virtualization - Chapter 5: Process API

5. Process API

  1. UNIX presents one of the most intriguing ways to create a new process with a pair of system calls: fork() and exec().

5.1 The fork()System Call

  1. The fork() system call is used to create a new process.
  2. The CPU scheduler determines which process runs at a given moment in time.

5.2 The wait() System Call

5.3 Finally, The exec() System Call

  1. This exec() system call is useful when you want to run a program that is different from the calling program.

5.4 Why? Motivating The API

5.5 Process Control And Users

  1. Beyond fork(), exec(), and wait(), there are a lot of other interfaces for interacting with processes in UNIX systems.
  2. The kill() system call is used to send signals to a process, including directives to pause, die, and other useful imperatives.

5.6 Useful Tools

5.7 Summary

  1. Each process has a name; in most systems, that name is a number known as aprocess ID (PID).
  2. The fork() system call is used in UNIX systems to create a new process. The creator is called the parent; the newly created process is called the child. As sometimes occurs in real life, the child process is a nearly identical copy of the parent.
  3. The wait() system call allows a parent to wait for its child to complete execution.
  4. The exec() family of system calls allows a child to break free from its similarity to its parent and execute an entirely new program.
  5. A UNIX shell commonly uses fork(), wait(), and exec() to launch user commands; the sparation of fork and exec enables features like input/output redirection, pipes, and other cool features, all without changing anything about the programs being run.
  6. Process control is available in the form of signals, which can cause jobs to stop, continue, or even terminate.
  7. Which processes can be controlled by a particular person is encapsulated in the notion of a user; the operating system allows multiple users onto the system, and ensures users can only control their own processes.
  8. A super user can control all processes (and indeed do many other things); this role should be assumed infrequently and with caution for security reasons.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Kuo-Teng

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值