第三章作业
3.1
题目:Using the program shown in Figure 3.30, explain what the output will be at Line A.
回答:
- 结果为:PARENT: value = 5。子进程改变的是子进程的value值,当控制权给回父进程之后,他的值保持为5。
3.2
题目:Including the initial parent process, how many processes are created by the program shown in Figure 3.31?
回答:
8个:2的三次方
3.5
题目:When a process creates a new process using the fork() operation, which of the following state is shared between the parent process and the child process?
a. Stack
b. Heap
c. Shared memory segments
回答:
堆和栈不被共享,而子进程可以从父进程那里获得资源子集。子进程继承了父进程的权限,调度属性以及某些资源。
a. Stack
b. Heap
c. Shared memory segments只有c被共享,a和b由子进程新建。
3.7
题目:Assume that a distributed system is susceptible to server failure. What mechanisms would be required to guarantee the “exactly once” semantic for execution of RPCs?
回答:
首先,需要消除服务器从未收到请求的风险。服务器必须要向客户确认RPC调用已经收到并且已经执行。客户机应该周期性的重发每个RPC调用直到它接收到对该调用的ACK。