I am having some trouble understanding how to use Unix\'s fork()
. I am used to, when in need of parallelization, spawining threads in my application. It\'s always s
It would be more valid to ask why CreateNewThread
doesn't just return a thread id like fork() does... after all fork()
set a precedent. Your opinion's just coloured by you having seen one before the other. Take a step back and consider that fork()
duplicates the process and continues execution... what better place than at the next instruction? Why complicate things by adding a function call into the bargain (and then one what only takes void*
)?
Your comment to Mike says "I can't understand is in which contexts you'd want to use it.". Basically, you use it when you want to:
BTW / using UNIX/Linux doesn't mean you have to give up threads for fork()
ing processes... you can use pthread_create() and related functions if you're more comfortable with the threading paradigm.