3 ms·
Yes, poor choice of words on my part. The IO calls themselves still block but each is in its own OS thread and GVL releases when the thread blocks. If you can
by Lio 6y ago
Yes, poor choice of words on my part. The IO calls themselves still block but each is in its own OS thread and GVL releases when the thread blocks.
If you can only do parallel IO in a thread why not use a light weight fibre (green thread) instead of an OS thread? Hence this new scheduler and fibres.
- jashmatthews 6y ago> each is in its own OS thread and GVL releases when the thread blocks. The GVL isn't automatically released when a thread blocks on IO. Each bit of native code performing IO has to explicitly release it like in the pg gem here: https://github.com/ged/ruby-pg/blob/fb465855ce1dd12cf7eb69c92af222052aa956ce/ext/gvl_wrappers.h#L4 https://github.com/ged/ruby-pg/blob/fb465855ce1dd12cf7eb69c9... If you don't need high concurrency then using threads is simpler.