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

Threads are the same as processes to the Linux scheduler.

When the alternative is using a shared bus all the time, it works out nicely this way.

Most programs are single threaded, and even most multithreaded programs don't share that much between threads. Of course the scheduler is going to schedule across CPUs in a reasonable way, but if it makes sense to keep it on the same CPU, it does that. The point is to keep bus contention to a minimum, and this does that in the average case.



Yes, but the typical data access patterns differ between threads and processes.

Again, this architecture makes sense for the "lots of totally independent processes" case. The problem is that this case isn't as common as you'd expect. on Linux, if you fork a process, you're sharing memory between them until you write to it. in threads, you're sharing all read-only data unless you've explicitly duplicated it.




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

Search: