Program execution models

"An evolving system increases its complexity unless work is done to reduce it."                                                                                                                    

- Meir Lehman

In the early 1960s, before multitasking was even a thing, programs written for computers were limited to a sequential execution model, where they were able to run instructions one after the other in chronological order. This was mainly due to limitations in how many instructions the hardware could process during that time. As we shifted from vacuum tubes to transistors, then to integrated chips, the modern day computer opened up possibilities to support multiple points of execution in programs. Gone are the days of sequential programming model where computers had to wait for an instruction to finish before executing the next one. Today, it's more common for computers to be able to do more than one thing at a time and do it correctly.

The modern day computer models a concurrent execution model, where a bunch of instructions can execute independently of each other with overlapping time periods. In this model, instructions need not wait for each other and run nearly at the same time, except when they need to share or coordinate with some data. If you look at the modern day software, it does many things that appear to happen at the same time, as in the following examples:

  • The user interface of a desktop application continues to work normally even though the application connects to the network in the background
  • A game updates the state of thousands of entities at the same time, while playing a soundtrack in the background and keeping a consistent frame rate
  • A scientific, compute-heavy program splits computation in order to take full advantage of all of the cores in the machine
  • A web server handles more than one request at a time in order to maximize throughput

These are some really compelling examples that propel the need to model our program as concurrent processes. But what does concurrency really mean? In the next section, let's define that.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset