

Language is not only used by people but even websites are using it. The language is one of the main problems that programmers are facing especially when Ruby’s is the matter. The performance that Ruby’s gives can be one of the reasons why programmers would not want to use the language. Because of the complaints about the performance about Ruby’s, it only shows that the framework is getting behind from other frameworks that are used by programmers today. Even though those issues have happened because of Ruby’s, it is easy to use.

The question will always be, how can you reach parallelism with Ruby’s MRI?

To answer, the best solution is to have the 1/0 bound threads. The threads can influence the parallelism that is seen in the processors today. The Ruby MRI is known to be a non-supporter of parallelism. Even though you have lots of threads, with Ruby MRI, only one thread will continuously run and it is because of GIL.

There are statements found that Ruby MRI will not help in reaching parallelism and it is all because of GIL, that is responsible for imposing restrictions on threads. Because of this, people think the Ruby is useless and is a not a good help in reaching parallelism. These statements may be true enough if you are using the CPU-bound operations. Why? When you use the CPU-bound operations, a great performance will never be evident and will always have low performance and it is all because the thread scheduling is handled by the user space and GIL plays a big role since it is the one that limits the threads.

In contrary to these statements, the I/O bound threads are the ones that help in letting Ruby MRI reach parallelism. The I/O bound threads’ speed is limited by the I/O found in computers. The one that handles the I/O bound threads is the Ruby interpreter which is found in the kernel space. Because the Ruby interpreter is located externally, the I/O bound threads can run freely since restrictions are not present and will be able to run in parallel because the GIL is not present. The kernel space is the one responsible for scheduling the I/O bound threads which will let them run continuously on numerous hubs.

If you want your threads to run and reach parallelism without any restrictions, the Ruby MRI with I/O bound threads is the best option. Unlike using the CPU-bound operations, you can likely encounter a lot of restrictions in your thread because GIL is present. No matter how a great number of threads that you, if the GIL exists, only one thread can run simultaneously. Nevertheless, if you use the Ruby MRI with I/O bound threads, your performance can improve and will definitely reach parallelism. Also, if you are working on an I/O bound task, the Ruby MRI with I/O bound threads is the for you because it can run in parallelism and will not stop you from having multiple threads. Just remember that your threads should be safe at all times.


Pin It on Pinterest

Share This