From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: Date: Tue, 23 Aug 2005 16:02:14 -0400 From: Russ Cox To: Fans of the OS Plan 9 from Bell Labs <9fans@cse.psu.edu> Subject: Re: [9fans] procreate vs threadcreate? In-Reply-To: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <599f06db05082310444813ef7f@mail.gmail.com> <884f180ed6b216fe6efd9b3178634ce6@quintile.net> <599f06db050823122656a21290@mail.gmail.com> <20050823194856.GA8185@ionkov.net> Topicbox-Message-UUID: 7bb8e22e-ead0-11e9-9d60-3106f5b1d025 > 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=3Dx+1; } void main(void) { int i; for(i=3D0; i<10; i++)=20 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