CSC/ECE 517 Fall 2013/ch1 1w13 aa: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
(Created page with "==Introduction== Traditional programs have a single-thread of execution. The statements or instructions that comprise the program are executed sequentially until the program ter...")
 
No edit summary
Line 1: Line 1:
==Introduction==
=Multithreading in Rails=
Traditional programs have a single-thread of execution.  The statements or instructions that comprise the program are executed sequentially until the program terminates. The threads are in-process and are implemented by the Ruby interpreter. As interpreted code is independent of the operating system, ruby threads are completely portable. On the other hand, there are some disadvantages when compared to native threads, such as deadlock and starvation. If a thread makes a call to the operating system that takes a long time to complete, all threads will hang until the interpreter gets control back. As the threads run within a single process, it cannot take advantage of multiple processors to achieve parallelism.  Despite having so many disadvantages, Ruby threads are an efficient and lightweight way of achieving parallelism in code.
Traditional programs have a single-thread of execution.  The statements or instructions that comprise the program are executed sequentially until the program terminates. The threads are in-process and are implemented by the Ruby interpreter. As interpreted code is independent of the operating system, ruby threads are completely portable. On the other hand, there are some disadvantages when compared to native threads, such as deadlock and starvation. If a thread makes a call to the operating system that takes a long time to complete, all threads will hang until the interpreter gets control back. As the threads run within a single process, it cannot take advantage of multiple processors to achieve parallelism.  Despite having so many disadvantages, Ruby threads are an efficient and lightweight way of achieving parallelism in code.
__TOC__

Revision as of 21:47, 17 September 2013

Multithreading in Rails

Traditional programs have a single-thread of execution. The statements or instructions that comprise the program are executed sequentially until the program terminates. The threads are in-process and are implemented by the Ruby interpreter. As interpreted code is independent of the operating system, ruby threads are completely portable. On the other hand, there are some disadvantages when compared to native threads, such as deadlock and starvation. If a thread makes a call to the operating system that takes a long time to complete, all threads will hang until the interpreter gets control back. As the threads run within a single process, it cannot take advantage of multiple processors to achieve parallelism. Despite having so many disadvantages, Ruby threads are an efficient and lightweight way of achieving parallelism in code.