how new processes are generated?
quoted from Mauerer's professional Linux kernel Architecture. p.6
1. fork : generates an exact copy of the current process that differs from the parent only in its PID (process identification).
After the system call has been executed, there are TWO processes in the system, both performing the SAME actions.
The memory contents of the initial process are duplicated -- at least in the view of the program.
Linux uses a well known technique known as copy-on-write that allows it to make the operation much more efficient by deferring the copy operations until either parent or child writes to a page-- read-only accessed can be satisfied from the same page for both.
2. exec : Loads a new program into an existing content and then executes it. The memory pages reserved by the old program are flushed, and their contents are replaced with new data. The new program then starts executing.
2 Kommentare:
http://www.cuhkacs.org/~syaoran/blog/read.php?286
都市博客:中國廢除簡體字、恢復繁體字?
http://www.cuhkacs.org/~syaoran/blog/read.php?359
http://www.dharma-academy.org/wei-shih.htm
Kommentar veröffentlichen