Program structure and threads

Threads were initially used for telephony systems where each request to connect could be given to a new thread to manage. The simplification was, in theory, dramatic. The programmer could just write the code for handling a single line, and the OS and network code would multiplex operation over 100,000 calls. The programmer does not have to worry about what operations block and delay time since each particular call could operate sequentially as fast as possible.

Imagine writing this same code using some sort of request queue. The only way to do it would be to make extensive use of asynchronous I/O, something that was uncommon when threads became popular: back before the world wide web and event driven systems became ubiquitous.  In fact, any multi-threading design seems convertible into a single threaded design via use of asynchronous events and asynchronous I/O. But these methods are not noticeably easier than threads.

Edited and simplified 2/17/2016

 

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *