Note: In the following post child process is the process created after first fork() and grand child process is the process created after second fork(). In one of my projects recently I had to run a shell command as a background process. The system was performance intensive, so I had to run a child process and continue execution on the parent process. We were using Python on Ubuntu so initially it seemed very easy. I thought of just using the subprocess library available for python. I started a background process with subprocess.Popen() and not call a Popen.wait() for it because I had to run the shell command in the background. PROBLEM: Initially I thought it worked but when I checked the process tree. I noticed that the child processes completed and entered a < defunct> state were not releasing memory. SOLUTION: After ...
Junaid Baghdadi earned his livelihood as a professional wrestler. As was the norm, the Leader of Baghdad announced one day, "Today, Junaid Baghdadi will demonstrate his skills as a wrestler, is there anyone to challenge him." An elderly man shakily stood up with his neck quivering and said, "I will enter the contest with him." Whoever was witness to this scene could not contain themselves, they burst out howling with laughter, clapping their hands. The King was bound by the law. He could not stop someone who of his own free will entered the bout. The elderly man was given the permission to enter the ring. He was about sixty-five years old. When Junaid Baghdadi entered the ring, he was dumbfounded as was the King and all the spectators of the Kingdom who were present. The single thought that occupied their minds was, "How will this old man be able to fight?" The old man addressed Junaid with these words, "Lend me your ears." He then whispered, ...