Return to BSD News archive
Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!nntp.coast.net!chi-news.cic.net!newsfeed.internetmci.com!howland.reston.ans.net!Germany.EU.net!netmbx.de!bb-data.de!news!mib From: mib@bb-data.de (Martin Ibert) Newsgroups: comp.unix.bsd.freebsd.misc,comp.unix.advocacy Subject: Re: Win32 CreateThread() vs Unix fork() Date: 12 Dec 1995 09:26:57 GMT Organization: BB-DATA GmbH, Berlin, Germany Lines: 37 Message-ID: <MIB.95Dec12102657@laforge.bb-data.de> References: <4ab85f$idq@news.voicenet.com> NNTP-Posting-Host: laforge.ppe.bb-data.de In-reply-to: 900RR's message of Sat, 09 Dec 1995 05:45:50 GMT Xref: euryale.cc.adfa.oz.au comp.unix.bsd.freebsd.misc:10308 comp.unix.advocacy:12106 In article <4ab85f$idq@news.voicenet.com> 900RR (900RR) writes: By contrast, Unix uses fork() to start an entire new process to service client requests. MP unixes could then run these whole processes on different CPU's. So could different threads. In any case, does anyone know how much more efficient a server application could run under an NT system than the same app, same hardware on something like FreeBSD or Linux? On modern UNIXoids, fork(2) is cheap. Only some internal memory management structures are copied, the actual memory pages are shared. Only data space that is written to is actually copied. Do veteran Unix programmers avoid fork() like the plague? No. Definitely not. While implementing a threaded server may, on occasion, be a little more efficient, it is also way more complex because you need to do a lot of the cleanup stuff yourself that you could leave to the operating system (using fork(2)). It is _really_ easy to program a threaded server that leaks memory. So in many cases, I'd much rather use fork(2) than threads, if only to reduce complexity in the server code. -- --------------------------------------------------------------------------- Dipl.-Inform. Martin Ibert, BB-DATA GmbH, Brunnenstraße 111, D-13355 Berlin >> e-mail <mib@bb-data.de>, phone +49-30-245-56582, fax +49-30-245-56577 <<