Re: Forking (fwd)

Martin von Loewis (
Sat, 14 Jun 1997 00:48:26 +0200

> So why is clone() not meant to be used in applications? If I want
> full control over how my program is parallelized across multiple processors,
> I'm going to want use clone(). If you claim that we shouldn't use clone()
> for "portability" reasons, that's a bunch of BS - if you want your
> application to all-out perform on SMP machines, you have to hand-tune
> it for each architecture, making portability pointless anyway.

Well, you can use it in applications. However, you need to add some assembly.
This is because you need to setup the return stack for the newly-created
thread, and you also have to fiddle with the registers in the way gcc
expects them.
If the C library provides an interface to clone, why not use it? If it
increases the application portability (removing the need for assembly,
allowing portability to other pthread implementations), why is this BS?
There are other reasons why you want threads than performance on an SMP
machine, like a simplification in the control flow or I/O completion.