Quote:
So you're telling me theres no possible way to do multitasking without forking?
|
No! That's not at all what wje_lq is saying!
Quote:
You have either to fork() or to use threads of some sort. Unless you have special requirements, fork() is the way to go.
|
Did you catch the "or" in there?
He and I disagree: I suggested "unless you have special requirements, 'pthread_create()' is the way to go". But there are pros and cons on either side, and there's no "right" or "wrong" answer. Wje_lq correctly points out some very good reasons for preferring "fork" over "pthread_create()".
SUGGESTION:
Look up "threads" and "processes" in Wikipedia (or something like that).
In general, a "process" is what you get from "fork()".
In general, a "thread" is what you get from "pthread_create()".
There are many different kinds of "concurrency", and lots of subtle (and not-so-subtle) issues involved.
BOTTOM LINE:
"fork()" and "pthread_create()" are different .. and there's a place for both in your toolbox!
Please post back with more questions once you've had a chance to look at the distinction between "process" and "thread".