On Sat, Sep 29, 2001 at 11:55:31PM +1000, Scott Howard wrote: > Huh? Does linux even implement vfork() yet?
Yes. It's an extra kludge on top of the existing clone functionality. > In any OS with a good kernel-level implementation of threads (such as, say, > Solaris) threading is always going to win hands-down over forking for > applications where it suits (and it doesnt always suit). The overhead of > a context switch is always going to be greater than that of switching > between threads (which all occur within the same context). Apples and oranges. The oft quoted statistic is that a Solaris thread switch is slower than a Linux process switch. The Solaris thread model is only good by contrast to their process model. > In a single CPU setup the difference is there, but small. In an OS which > supports up to 106 CPUs, there's a real difference. Interesting. Why exactly does the number of CPUs make a difference? > One day Linux will get a worthwhile implementation of kernel threads, and > then there will be a reason to use them, but until that happends unless > you want the IPC (ITC?) benefits that threads give you, then stick with > fork()ing. Boggle. What would you like to see done to Linux kernel threads to make you happy? To answer the original poster's question, multithreading (under the popular definition thereof) and forking are two very different things. Your reasons for choosing a threading model very rarely come down to a personal choice based on relative technical merits. It's typically a question of interfacing with external software (*cough*openh323*cough), seeking cross-platform portability, etc. If you are, however, in the privileged position of starting with a clean slate, then you may want to consider the following rules of thumb. 1) If you think your program requires multithreading, 99% of the time, you're wrong. 2) If you /still/ think your program requires multithreading, see point 1. m. -- SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/ More Info: http://lists.slug.org.au/listinfo/slug
