[distcc] Re: distcc on Cygwin w/o fork()
mbp at sourcefrog.net
Tue Apr 4 01:24:42 GMT 2006
On 4 Apr 2006, at 10:20 , Steven Solie wrote:
> On 03/04/2006, Laine Stump wrote:
>> Awhile back I corresponded with someone on this list who said they
>> had patched distcc for Cygwin to eliminate the use of fork(). I've
>> been unsuccessful at contacting him again, though, so I thought I'd
>> ask: Has anyone else done this, and have the patches (or better yet,
>> a binary) available?
> I have done a port of distcc which eliminates fork() for AmigaOS.
> Of course it has AmigaOS-specific pieces in it but it may be a good
> starting point to get you going on your own non-fork() version for
> Windoze or whatever.
> I was actually wondering if the distcc maintainers would be moving
> away from fork() now that the world seems to be going thread crazy?
> Last I read distcc wanted to be as compatible as possible which
> means the dreaded fork() will remain for a long time to come.
> --Steven Solie
(I was just reminiscing about my A500 this morning... :-)
distcc uses fork() in two quite different places:
1 - to run several server processes concurrently, so that a server
can use multiple CPUs and overlap network traffic.
2 - to spawn the real compiler, on both the client and the server.
Starting the server processes using fork works well on Unix but
poorly elsewhere. It's a bit better than using threads in this case
because it gives better isolation between different jobs, though the
practical value is debatable. It shouldn't be hard to use threads
there instead -- we just need to be careful of any global state which
may be used. Perhaps the AmigaOS port could be adapted.
For simplicity's sake perhaps we should just use pthreads
everywhere. (Will pthreads work well on windows, amigaos, etc?)
When running the compiler we need to redirect stdout and various
other things like that. fork/exec is the only way to do this on
unix; on Windows we will want to use spawn instead. So that should
just require a small bit of platform-specific code.
More information about the distcc