I have noticed that when I use cruby to run a muli-threaded java program via Open3.capture3('java -jar multi-threaded.jar'), most java threads are idle and the CPU is only busy on a single core. However, if I run the same javaprogram from bash, the CPU has near 100% utilization.
Does the cruby GIL have an effect on programs run by capture3?
No. First off, the YARV Giant VM Lock (GVL) only prevents multiple Ruby threads from entering the bytecode interpreter at the same time. In YARV,
Open3::capture3is written in C, not Ruby, so the GVL doesn't even apply.Secondly, the Java process isn't a thread, it's an entirely separate process. It doesn't care a bit what YARV's threading implementation does, because it's a process, not a thread.