Path: utzoo!attcan!uunet!virtech!cpcahil From: cpcahil@virtech.uucp (Conor P. Cahill) Newsgroups: comp.unix.questions Subject: Re: Orphaned processes : Please explain Message-ID: <1990Sep15.133135.28744@virtech.uucp> Date: 15 Sep 90 13:31:35 GMT References: <2140001@hpnmdla.HP.COM> Reply-To: cpcahil@virtech.UUCP (Conor P. Cahill) Organization: Virtual Technologies Inc., Sterling VA Lines: 26 In article <2140001@hpnmdla.HP.COM> rajeev@hpnmdla.HP.COM (Rajeev Menon) writes: > [ questions about pids, ppids, etc with forking processes deleted] The key to your problem is that you can't be sure what process will run first following a fork (maybe the parent, maybe the child). >Sometimes (as in case 2),the file "junk" does not contain output from all >the processes. Why ? Now I do The problem you had with missing output is that you have several files opening & writing to the file at the same time, but you did not set append mode on the file. >Some PPIDs show up as 1, showing that they have been orphaned, which could >be expected since I am not synchonizing the processes. But it really puzzles >me as to why this happens when I do "a.out ; cat junk" and not when I do >"cc fork.c ; a.out ; cat junk". Can someone explain what is going on ? Pure chance (or actually scheduling priorities in the kernel & the effect of other processes on cpu availability for your processes). -- Conor P. Cahill (703)430-9247 Virtual Technologies, Inc., uunet!virtech!cpcahil 46030 Manekin Plaza, Suite 160 Sterling, VA 22170