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

If you need to process a bitmap in parallel, it's a pain to use processes, since there's a significant amount of memory that has to be passed around. And it's inefficient, as you would always have to copy memory to the other process.

That's what threads are for - parallel paths that need to share memory. Processes are for parallel paths that rarely need to access the same data or to synchronize between them.

Don't forget also that when your CPU shares time, it divides up the time equally among the processes. So if your application creates 20 processes, it takes a disproportionate amount of CPU time (I believe, someone correct me if I'm wrong).



Don't forget also that when your CPU shares time, it divides up the time equally among the processes. So if your application creates 20 processes, it takes a disproportionate amount of CPU time (I believe, someone correct me if I'm wrong).

It depends on the OS. In most cases, threads are the only schedulable entity (think of a classic process as containing one thread), so there is no difference between 20 single-threaded processes and one process with 20 threads.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

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

Search: