Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What Use are Threads Outside of Parallel Problems on MultiCore Systems?

Threads make the design, implementation and debugging of a program significantly more difficult.

Yet many people seem to think that every task in a program that can be threaded should be threaded, even on a single core system.

I can understand threading something like an MPEG2 decoder that's going to run on a multicore cpu ( which I've done ), but what can justify the significant development costs threading entails when you're talking about a single core system or even a multicore system if your task doesn't gain significant performance from a parallel implementation?

Or more succinctly, what kinds of non-performance related problems justify threading?

Edit

Well I just ran across one instance that's not CPU limited but threads make a big difference:

TCP, HTTP and the Multi-Threading Sweet Spot

Multiple threads are pretty useful when trying to max out your bandwidth to another peer over a high latency network connection. Non-blocking I/O would use significantly less local CPU resources, but would be much more difficult to design and implement.

like image 677
Robert S. Barnes Avatar asked Dec 30 '25 07:12

Robert S. Barnes


1 Answers

Performing a CPU intensive task without blocking the user interface, for example.

like image 95
Konamiman Avatar answered Jan 02 '26 01:01

Konamiman



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!