What is a Thread? (and Why Do I Care?)

Sewing thread by a mat with scissors Photo by Vladimir Proskurovskiy on Unsplash

In this module, we will begin learning how we can gain concurrent execution within a single process by creating multiple threads of control---and why we might want to do so.

Learning Objectives

We've learned about the process. Now we'll learn about threads of control and what happens when we have more than one in a process.

Upon completion of this module, you will be able to:

Learning

Note that these videos have embedded formative assessments---you'll want to watch the videos and complete those before class, so that you can earn participation credit.

Recommended Readings

Completing the readings in this class is highly recommended---it can be very helpful to see how the concepts are explained by a different person, and the extra details can help the pieces fit together.

OSTEP: Concurrency and Threads API (up to 27.3)

Fun Insights

From Class

Evaluating Your Understanding

We are providing these rubrics for each module so that you can better understand what is expected and evaluate your understanding against those expectations. The hope is that, if you find yourself earning a 3 or below, you will continue to enhance your understanding until you find yourself earning a 4 or a 5.

Standards 5 4 3 2
Thread Implementation and Behavior Student accurately analyzes the effect of multiple threads on the data in a process's address space, and accurately breaks down the different types of threads and accurately analyzes the consequences of those states, including considering a thread's interactions with the operating system. Student accurately analyzes the effect of multiple threads on the data in a process's address space, and satisfactorily breaks down the different types of threads and satisfactorily analyzes the consequences of those states, including considering a thread's interactions with the operating system. Student satisfactorily analyzes the effect of multiple threads on the data in a process's address space, but unsatisfactorily breaks down the different types of threads and unsatisfactorily analyzes the consequences of those states, including considering a thread's interactions with the operating system. Student does not submit the work OR student unsatisfactorily analyzes the effect of multiple threads on the data in a process's address space, and unsatisfactorily breaks down the different types of threads and unsatisfactorily analyzes the consequences of those states, including considering a thread's interactions with the operating system.
Short Answer Questions: Thread-Specific Student submitted answers to given questions that accurately and succinctly answer the questions. Student submitted answers to given questions that satisfactorily and succinctly answer the questions. Student submitted answers to given questions that unsatisfactorily answer the questions. Student does not submit the answers OR submitted answers to given questions that incorrectly answer the questions.
Short Answer Questions: Threads as part of the larger system Student submitted answers to given questions that accurately and succinctly answer the questions. Student submitted answers to given questions that satisfactorily and succinctly answer the questions. Student submitted answers to given questions that unsatisfactorily answer the questions. Student does not submit the answers OR submitted answers to given questions that incorrectly answer the questions.