Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

fork is really handy when you actually want multiple copies of your program (sharing only initial state) -- it can be used like creating a working thread, but you don't have to worry about sharing (subsequent) state. This means you can exploit multiple cores without the complexity (and bugs) of shared memory threads.

Actually, fork(2) has now evolved into clone(2) on Linux, so you can choose in quite a fine grained way what the threads/processes will share.

The separation of the functionality of spawn between fork and exec is surprisingly handy (even though people occasionally still come up with vfork(2)).



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: