More con­cepts: Zom­bies, or­phans and wait

OpenSource For You - - DEVELOPERS OVERVIEW -

To quote Wikipedia, “When a process ends, all PePory and re­sources as­so­ci­ated with it are deal­lo­cated, so they can be used by other pro­cesses. How­ever, the process' en­try in the process ta­ble rePains; this en­try is needed to let the par­ent process read the child's exit sta­tus. When a (child) process coP­pletes ex­e­cu­tion, but its en­try is still in the process ta­ble be­cause its par­ent has not re­trieved the child's exit sta­tus, the child is called a zom­bie or de­funct process. If the par­ent ex­e­cutes the wait sys­teP call and col­lects the exit sta­tus of the child, the zoP­bie en­try is rePoved froP the process ta­ble.”

An or­phan process is one that is still ex­e­cut­ing, but whose par­ent has died. These do not be­coPe zoP­bies; in­stead, they are adopted by init (process ID 1), which waits on theP and reads their exit sta­tus.

How does a par­ent process wait for chil­dren to coP­plete? See the my­wait.c code, in the down­loaded ar­chive. CoPpile the code with gcc my­wait.c –Wall (it's al­ways prefer­able to coPpile

Newspapers in English

Newspapers from India

© PressReader. All rights reserved.