Mark Gray wrote:
Kolja Kauder
writes: [snip] I wrote:
On a single processor it is wasteful of machine cycles, but does allow the programmer to background process things in a slightly more efficient manner than forking allows for.
If I understand this right that's not true: man fork: ... Under Linux, fork is implemented using copy-on-write pages, so the only penalty incurred by fork is the time and memory required to duplicate the parent's page tables, and to create a unique task structure for the child.
I take this to mean that fork()'ing and pthread_create()'ing are essentially the same. I have no clue though about native pthreads. Again, I'm only optio, if that much.
pthreads continue to share the same data even after it is modified by one or the other (apart from the stack of course) -- the threads can communicate using the shared data without the need for IPC.
Yes, of course. Didn't think that far. KK