3.12 Including the initial parent process, how many processes are created by the program shown in Figure 3.32? 答案: 共16个进程. 解析: 根据之前所学到的关于fork的知识去画进程图, 要注意的一点就是, fork的子进程的程序计数器里的指令和父进程的相同, 所以每次fork之后, 子进程里i的值都会继续增加.例如, 第一个进程, i=0时, fork的子进程的i会继续++, 从1…
3.2 Including the initial parent process, how many processes are created by the program shown in Figure? 答案: 会创建8个进程. 解析:相关知识: fork函数的执行原理 fork函数执行一次, 返回两次,父进程返回子进程的PID, 子进程返回0(至于返回值为什么不同, 这与do_fork函数有关,具体是怎么一回事我还不太清楚).程序中可利用此性质来区别程序的父进程和子进程. 当一个进程执行…
2015年计划透析10本英文原著,最开始选定的第一本英文书是<Who Moved my Cheese>,可是这本书实在是太短.太简单了,总体的意思就是要顺应变化,要跳出自己的舒适区,全文不认识的单词也不多,所以很快读完后就开始找第其它的适合我的英文书. 根据<把你的英语用起来>作者的推荐,从zyea要到了<Daughter of Deceit>的文本,发送到Kindle上阅读试试.这书对于我来说果然还是有难度的,前面一堆人物的出场,让我实在搞不清楚他们之间的关系.看了不…
https://en.wikipedia.org/wiki/Amdah's_law Amdahl's law is often used in parallel computing to predict the theoretical speedup when using multiple processors. For example, if a program needs 20 hours using a single processor core, and a particular par…
The practice of programming Chapter 4 Interfaces A good programmer should always be good at designing. The essence of design is to balance competing goals and constraints. When we do programming, we need to design a friendly, portable and flexible in…
PAT (Advanced Level) Practice 1035 Password (20 分) 凌宸1642 题目描述: To prepare for PAT, the judge sometimes has to generate random passwords for the users. The problem is that there are always some confusing passwords since it is hard to distinguish 1 (o…