Hacker News new | ask | show | jobs
by dudul 19 days ago
A process is significantly more expensive than a thread on a Linux system. The main cost is memory. Processes own their memory which forces the system to duplicate resources, as opposed to threads that are able to share resources.

Where have you red that "the cost between a process and a thread is relatively small."? I would be curious to see a link because the most cursory internet search would show you that it is not true.

1 comments

"significantly more expensive" and "relatively small"

Well, both are true of course. You will have to put numbers on those to make sensible decisions.

Historically, creating processes in Linux has been cheaper than in other Unix-like OS (you might find results of an old Byte benchmark) and much cheaper than in Windows. Creating a thread will be undoubtedly cheaper still, but whether that will change the user experience or is worth the cost depends on details (how large the memory footprint is, pagesize, how many files are open, how many threads are to be executed, their lifetime, how many execution units are available, etc.).