From: <er...@he...> - 2003-06-26 17:12:21
|
On Thu, Jun 26, 2003 at 12:50:43PM -0400, Nicholas Henke wrote: > When running vfork, it appears that only the first node in the nodelist > has the stdio redirected correctly. The rest of the nodes output appears > to go to /dev/null. Is this the expected behavior ? > > BTW -- I am running 3.2.0 Umm... Yeah. It's certainly a quirk and it should probably be fixed but that's normal. Here's what's going on: Normally, when you move to a node, bproc will setup a socket connection between the two processes to move the process information. As a nice hack to provide basic support for printf, the socket is kept around and attached to the process's STDOUT, STDERR. This works out because the socket connection is usually back to the front end where bproc can do some mostly sane IO forwarding. In the vrfork case, only the first process gets the process image from the front end. The rest of the processes get their process image from one of the previous proceses. This adds parallelism which makes it go faster and blah blah blah... The upshot is that the sockets which were used for the built-in forwarding don't go back to the front end anymore so it doesn't work. If you look at the bpsh source, you'll see that it provides explicit instructions to vexecmove on how to wire up STDIN, STDOUT, STDERR. bpsh itself becomes the IO forwarder in that case. This makes things like bpsh much more complicated than they might otherwise be. On the bright side, bpsh is a MUCH better IO forwarder than what's built into BProc at this point. I've been wanting to get rid fo the IO forwarding daemon in BProc since the very first version. It's one of those thing that's lingered because it's a nice crutch which does an ok job simple prints. - Erik |