Save this video free

ECE344 Fall 2026 (Sec 1) Lec 13 - Threads

Jon Eyolfson · 1:06:38 · Watch on YouTube

Part of University of Toronto ECE 344. See all 26 lectures and search them

These notes were made with YouTube Collector. Paste any YouTube link and get the same: a summary, chapters and a searchable transcript.

Overview

Jon Eyolfson explains how threads differ from processes and how concurrency differs from parallelism, then demonstrates thread creation, scheduling, termination, and cleanup with POSIX Pthreads. The lecture emphasizes the trade-off between threads’ shared memory and low context-switch cost and processes’ isolation, and uses runnable C examples to show why joining threads and passing arguments with safe lifetimes matter.

Key takeaways

Chapters

0:00 From Processes to the Threads Unit
6:50 Concurrency vs. Parallelism Through Dinner Tasks
11:26 A Thread Is a Process’s Execution Context
13:15 Thread-Local State, Concurrency, and Multicore Execution
19:30 Choosing Between Processes and Threads
24:24 Pthreads Setup and the `pthread_create` Interface
30:10 Scheduling Order and Why Returning from `main` Matters
36:50 Joining Threads and Reclaiming Their Results
43:00 Linux `clone` and the Different Meanings of Thread Exit
49:00 Detached Threads and Pthread Stack Attributes
54:10 Creating Four Workers and Passing Each an ID
1:00:00 Why Passing a Stack Variable’s Address Breaks
1:04:50 Why Casting Integer IDs to Pointers Is Not Portable

Keep these chapters and the full searchable transcript in your own library.

Transcript excerpt

6:50 Alrighty, welcome back to operating system. So, we survived test one just in time to go to the next hardest topic, threads. Yay. So, we are going to start talking about threads today. It will be a magical journey that will take us quite a long time to understand. If you've already used threads, you've probably used them wrong. So, we will get into that. So, as a preamble to this, concurrency and parallelism to normal humans, they're synonyms. They mean the same thing. To us, they do not mean the same thing. They have very, very specific meanings in software. So, concurrency is being able to switch between two or more things. Think of them just as tasks. So

7:38 the question you are answering here is can you be interrupted and make progress. So the goal is to make progress in all of them. But at any one time instant you can only do one thing. So you can juggle them but you can only still do one thing at a single time instant. Well parallelism is running two or more things at the same time. The question you have to ask here are they independent? Can I do them at the exact same time instant? And the goal here is usually to run as fast as possible. So far, we've only argued about concurrency. So, one CPU or just one thing executing your process, and the kernel just switches on a timer. That's what the context switch we saw last

8:24 lecture is. And today, we get to see what else we get to switch between. So we're going to start off with a real life analogy to get the difference between parallelism and concurrency. One does not imply the other. So let us assume we are sitting at a table for dinner. We are not

This is the start of the transcript. Save this video free for the whole transcript, searchable and time-coded.

In this course

Related notes

Summary, takeaways, and chapters were generated by AI from the video's transcript and may contain errors. The video belongs to its creator, Jon Eyolfson.

Want the full transcript?

Save this video in YouTube Collector to get its complete searchable transcript, your own AI summaries, and a library that keeps every video you collect in one place.