Introduction to Locks

This lesson gives a brief introduction to​ this chapter on locks and its contents.

From the introduction to concurrency, you saw one of the fundamental problems in concurrent programming. You would like to execute a series of instructions atomically, but due to the presence of interrupts on a single processor (or multiple threads executing on multiple processors concurrently), you couldn’t. In this chapter, we thus attack this problem directly, with the introduction of something referred to as a lock. Programmers annotate source code with locks, putting them around critical sections, and thus ensure that any such critical section executes as if it were a single atomic instruction.

Get hands-on with 1400+ tech skills courses.