# Need for threads

**URL:** <https://www.ruby-forum.com/t/need-for-threads/54053>\
**Category:** Ruby\
**Created:** [February 21, 2006, 7:00pm UTC](https://www.ruby-forum.com/t/need-for-threads/54053 "2006-02-21T19:00:40Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![tony\_summerfelt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/b9bd4f/32.png) [@tony\_summerfelt](https://www.ruby-forum.com/u/tony_summerfelt)\
**Post date:** [February 21, 2006, 7:00pm UTC](https://www.ruby-forum.com/t/need-for-threads/54053/1 "2006-02-21T19:00:40Z")

</div>

a discussion of tcl threads came up in that newsgroup.

one of the posts stopped me cold. the msg boiled down to:

on a single non-ht cpu if your program can’t do soemthnig while  
waiting on a resource there’s no real need for threaded code.

threading will actually slow down your program overall.

[http://home.cogeco.ca/~tsummerfelt1](http://home.cogeco.ca/~tsummerfelt1)  
telnet://ventedspleen.dyndns.org

---

<div class="post-metadata">

**Author:** ![tony\_summerfelt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/b9bd4f/32.png) [@tony\_summerfelt](https://www.ruby-forum.com/u/tony_summerfelt)\
**Post date:** [February 21, 2006, 7:12pm UTC](https://www.ruby-forum.com/t/need-for-threads/54053/2 "2006-02-21T19:12:52Z")

</div>

Uh, yeah, that’s pretty much why not all code is threaded.

On the other hand, in programs above a certain size, or ones that have  
graphical user interface, there usually is something else that you can  
do while you’re waiting on that resource.

---

<div class="post-metadata">

**Author:** ![tony\_summerfelt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/b9bd4f/32.png) [@tony\_summerfelt](https://www.ruby-forum.com/u/tony_summerfelt)\
**Post date:** [February 21, 2006, 7:09pm UTC](https://www.ruby-forum.com/t/need-for-threads/54053/3 "2006-02-21T19:09:49Z")

</div>

On 2/21/06, tony summerfelt [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> telnet://ventedspleen.dyndns.org

This is accurate, of course threads _may_ simplify your design, which  
is a virtue as well.

pth

---

<div class="post-metadata">

**Author:** ![tony\_summerfelt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/b9bd4f/32.png) [@tony\_summerfelt](https://www.ruby-forum.com/u/tony_summerfelt)\
**Post date:** [February 22, 2006, 1:27am UTC](https://www.ruby-forum.com/t/need-for-threads/54053/4 "2006-02-22T01:27:44Z")

</div>

DÅ?a Utorok 21 FebruÃ¡r 2006 19:10 Daniel N. napÃ­sal:

> Uh, yeah, that’s pretty much why not all code is threaded.
> 
> On the other hand, in programs above a certain size, or ones that have  
> graphical user interface, there usually is something else that you can  
> do while you’re waiting on that resource.

This is pretty much one of the few good reasons to use threads on a  
single-core processor - to keep an interactive user interface  
responsive. And  
to give people that can’t wrap their heads around parallel processing  
headaches making them code Dining Philosophers _mutter_

They also make life simpler in some scenarios - it’s definately easier  
to make  
a multithreaded application with parallel asynchronous input (think  
packet  
sniffing on multiple network interfaces) by hogging each with a thread  
you  
couldn’t care less about if it blocks, than using standard asynchronous  
IO,  
which isn’t even available for all input sources.

David V.

---

<div class="post-metadata">

**Author:** ![tony\_summerfelt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/b9bd4f/32.png) [@tony\_summerfelt](https://www.ruby-forum.com/u/tony_summerfelt)\
**Post date:** [February 22, 2006, 1:39pm UTC](https://www.ruby-forum.com/t/need-for-threads/54053/5 "2006-02-22T13:39:04Z")

</div>

On Wed, 22 Feb 2006 03:09:22 +0900, you wrote:

> This is accurate, of course threads _may_ simplify your design, which  
> is a virtue as well.

that’s what i find. threading helps keep track of things that should  
be happening at the same time. and who knows, maybe i’ll have a  
multi-cpu in the future 🙂  
[http://home.cogeco.ca/~tsummerfelt1](http://home.cogeco.ca/~tsummerfelt1)  
telnet://ventedspleen.dyndns.org

---

<div class="post-metadata">

**Author:** ![tony\_summerfelt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/b9bd4f/32.png) [@tony\_summerfelt](https://www.ruby-forum.com/u/tony_summerfelt)\
**Post date:** [February 22, 2006, 1:51pm UTC](https://www.ruby-forum.com/t/need-for-threads/54053/6 "2006-02-22T13:51:30Z")

</div>

Daniel N. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Uh, yeah, that’s pretty much why not all code is threaded.
> 
> On the other hand, in programs above a certain size, or ones that have  
> graphical user interface, there usually is something else that you can  
> do while you’re waiting on that resource.

Like reading from or writing to another resource. Exactly. Ruby’s  
multithreading is only at a loss on a multi CPU machine with heavy  
computation because it doesn’t use more than one CPU.

Kind regards

```
robert

```
