3 ms·
AFAIK, Ruby marks I/O blocked threads and does not schedule them. However, if you have a native extension that's blocked on I/O, it may be scheduled--so there i
by vasi 17y ago
AFAIK, Ruby marks I/O blocked threads and does not schedule them. However, if you have a native extension that's blocked on I/O, it may be scheduled--so there is a potential problem.
- kscaldef 17y agopresumably threads that are sleeping are similarly marked?
- FooBarWidget 17y agoRuby 1.8 implements threads in userspace, so if a native extension is blocked on I/O then no context switching is possible in the first place (unless the native extension is using Ruby's own I/O functions, in which case Ruby will relinquish control to another Ruby thread). Ruby 1.9 implements native threads, so a native extension blocked on I/O will be rescheduled by the kernel, assuming that the native extension unlocks the GIL before performing the I/O operation.