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.
On 12/1/06, Shane E. [email protected] 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
Thanks for the information, hopefully Ruby threads will be good enough.