> I need some help in understnading the difference
> between proccreate() and threadcreate(). What
> are the scenario where usage of one is better than
> the other?

see http://plan9.bell-labs.com/~rsc/thread/ and
read the introduction to alef by bob flandrena
linked there.

in terms of trite academic examples,

int x;
void inc(void*) { x=x+1; }
void
main(void)
{
    int i;
    for(i=0; i<10; i++) 
        threadcreate(inc, nil, STACK);
    while(x < 10)
        yield();
    print("everyone finished\n");
}

is correct (though tortuous) code.
using proccreate would introduce
the usual race.

russ

Reply via email to