Save this video free

ECE344 Fall 2026 (Sec 1) Lec 14 - Threading Models

Jon Eyolfson · 47:13 · 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 compares user, kernel, and many-to-many threading models, explaining how scheduling, blocking system calls, and parallelism differ. He then demonstrates many-to-one user threads with C's ucontext_t APIs, separately allocated stacks, and context-switch traces that show how Lab 4's thread creation and scheduling work.

Key takeaways

Chapters

0:00 Thread State and Who Manages the Thread Table
4:00 Many-to-One and One-to-One Scheduling Tradeoffs
11:10 Many-to-Many Maps User Threads onto Multiple Kernel Threads
14:20 Building User Threads with ucontext_t and Separate Stacks
18:20 getcontext Saves a Resume Point, setcontext Restores It
22:30 makecontext Starts a Thread on Its Own Stack
29:30 swapcontext, uc_link, and Returning from T1 to Main
36:00 Tracing Shared State Across Two ucontext Threads
44:50 Threading Model Recap and Lab 4 Connection

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

Transcript excerpt

3:10 All right. So let's restart at threading model. So this will be the fun part which you'll need for also lab four. So recall let's go back to an hour ago. So here we now have multiple threads. So a thread lives within a process should be its own registers and own stack. Again they're created independently whether or not since the stack lives in virtual memory you can give pointers to each other's stacks as we saw before not a good idea. Generally do not do that.

3:58 So there's multiple ways to implement threads in a process and you have to answer the question who keeps track of the table of threads. There'll be a table of threads just like there is a table of processes and then who switches between them and unlike processes that have to be managed by the kernel, threads can be managed by the kernel or a library or a combination of both. And libraries run in user mode. So they're called user threads or kernel threads. So we have either user threads or kernel threads. User threads are defined in a library. They live entirely in user space. So from the kernel's point of view, it only sees the one thread that it created with the process. Just like

4:48 any other process, it doesn't know about your threads within your process. So there's entirely a U thing. So that means the kernel cannot schedule and your user threads in parallel because it doesn't know about them. So it only schedules your one main thread that it knows about and nothing else. So the best you can do is have all of your user threads run concurrently. You will never get parallelism. Colonel only knows about the one main thread. On the other hand, there are kernel threads that as

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.