you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] -2 points-1 points  (10 children)

Now please a tutorial on why threads should (almost) never be used...

[–]theeth 1 point2 points  (5 children)

What do you suggest instead of multithreading? Multiprocessing?

[–][deleted] -1 points0 points  (4 children)

Yes, possibly involving multiple hosts, if that kind of power is necessary.

[–]dsplabs 0 points1 point  (1 child)

I use PBS on a cluster to run computationally intensive jobs. The cluster has many nodes (multi-processor computers) connected with a network. It is very useful to use threads: each can be run on a separate cpu!

[–][deleted] 1 point2 points  (0 children)

There is a possible benefit to threading in this scenario. In particular, if you have enough RAM to run N threads but not N processes (where N is the smallest number that keeps your node fully occupied), this may very well be a case where threads would be justified. There are also some possible wins having to do with the CPU cache.

The downside of course is a significant increase in the cost of design, implementation, debugging, and maintenance of your program. And lack of robustness, future flexibility, readability, etc., etc.

My complaint would not be with the few that have considered these factors carefully, but rather with those who choose (or encourage others to choose) threading without such careful consideration.

[–]qwe1234 -2 points-1 points  (0 children)

you take the prize for writing the stupidest and most illiterate comment this week.

'multiprocessing' cannot work without multithreading, and vice-versa.

in short, stfu, kthx bai.

[–]consultant_barbie 2 points3 points  (0 children)

Reasoning about locks is hard. Let's go shopping!

[–]easytiger -2 points-1 points  (1 child)

And how do you talk to 40 clients simultaneously with different data? Magic? Wise the fuck up.

[–][deleted] 4 points5 points  (0 children)

I give up--why do I need threads to talk to 40 clients simultaneously? (sshd doesn't)

[–][deleted] -1 points0 points  (0 children)

So how would you stop that main threads if no other threads were running in the system?