# Pthreads

**URL:** <https://www.ruby-forum.com/t/pthreads/77928>\
**Category:** Ruby\
**Created:** [December 1, 2006, 4:38pm UTC](https://www.ruby-forum.com/t/pthreads/77928 "2006-12-01T16:38:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![semmons99](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/f1d935/32.png) [@semmons99](https://www.ruby-forum.com/u/semmons99)\
**Post date:** [December 1, 2006, 4:38pm UTC](https://www.ruby-forum.com/t/pthreads/77928/1 "2006-12-01T16:38:23Z")

</div>

I need to write a quicksort using pthreads, and was hoping to use Ruby  
to do  
so (the Prof. just loves C/C++). Can anyone shed some light on what  
compiling ruby with pthreads actually does, and what I need to do to  
write  
pthreads in Ruby? Thanks for any help.

---

<div class="post-metadata">

**Author:** ![semmons99](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/f1d935/32.png) [@semmons99](https://www.ruby-forum.com/u/semmons99)\
**Post date:** [December 1, 2006, 5:36pm UTC](https://www.ruby-forum.com/t/pthreads/77928/2 "2006-12-01T17:36:45Z")

</div>

On 12/1/06, Shane E. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I need to write a quicksort using pthreads, and was hoping to use Ruby to do  
> so (the Prof. just loves C/C++). Can anyone shed some light on what  
> compiling ruby with pthreads actually does, and what I need to do to write  
> pthreads in Ruby? Thanks for any help.

The pthreads option when compiling Ruby is there to make it play nice  
with the Tcl/Tk widget set. If your Tcl/Tk is compiled with the  
pthreads option, then Ruby needs to be compiled with the pthreads  
option. If this is not the case then you could get segmentation faults  
when you try to use the Tcll/Tk widgets.

Ruby does not use pthreads internally. All threads are implemented as  
green threads – i.e. there is only one Ruby process and all threads  
are scheduled internal to that process.

If your professor truly wants pthreads for your quicksort assignment,  
then Ruby is not going to make him happy. However, if you can convince  
him that the Ruby Thread object is good enough (close enough) to a  
pthread, then more power to ya!

Blessings,  
TwP

---

<div class="post-metadata">

**Author:** ![semmons99](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/f1d935/32.png) [@semmons99](https://www.ruby-forum.com/u/semmons99)\
**Post date:** [December 1, 2006, 7:23pm UTC](https://www.ruby-forum.com/t/pthreads/77928/3 "2006-12-01T19:23:12Z")

</div>

Thanks for the information, hopefully Ruby threads will be good enough.
