Lesson 18Concurrency

In this lesson, we'll look at the concept of concurrency and show you how to apply it to your Go applications. We'll spend extra time explaining concurrency concepts and parallelism before writing Go code.

USING CONCURRENCY

Before we go into details about how Go handles concurrency, let's look at the concept of concurrency itself. In the early days of computing, a computer system had one processor that was responsible for executing all instructions. Because of this architecture, computer programs were written to run in a serial fashion, where the program was sequentially executed instruction by instruction in a predefined order. Figure 18.1 illustrates this use of serial programming by a computer program.

Snapshot of serial programming

Figure 18.1: Serial programming

As computer programs became increasingly complex, the use of serial programming introduced some limitations because a program could only execute one instruction at a time. The more instructions a computer program had, the longer it would take to execute. This resulted in the need for faster and more efficient ways to execute computer programs.

The Role of the Operating System

Get Job Ready Go now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.