Greetings.
I’m developing a TCP server that serves multiple
clients by multiplexing the input using
Kernel::select. I chose not to use threads because I
doubted my ability to synchronize everything properly.
Most of the data is stored in a (mySQL) database that
I access using DBI. However, as disk seeks are a slow
thing, I’m thinking of using a separate thread for
database reads/writes so that the server can go on
processing whatever it needs to process without
waiting for the database query to complete.
Now, my question is: is it possible for a separate
thread to handle database access? Here’s what I’m
concerned about. The Programming Ruby book states:
“…if some thread happens to make a call to the
operating system that takes a long time to complete,
all threads will hang until the interpreter gets
control back”
So, I guess my question is, will a database read or
write that is handled by a single thread cause all the
other threads to hang too?
Thanks,
mk