Save this video free

ECE344 Fall 2026 (Sec 1) Lec 8 - Event Loops and Process Groups

Jon Eyolfson · 53:34 · 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 shows how Linux programs can wait efficiently for multiple events without busy polling or unsafe signal handlers: block SIGCHLD, expose it through signalfd, and use poll alongside standard input. A working event loop then reaps all terminated children, while the lecture also explains how process groups let shells signal related processes together and how systemd cgroups provide stronger grouping.

Key takeaways

Chapters

0:00 Why Child-Exit Polling and Signal Handlers Fall Short
7:14 Block SIGCHLD and Convert Pending Signals with signalfd
14:38 Use poll to Sleep Until a File Descriptor Is Ready
22:54 Design an Event Loop for Input and Child Termination
27:29 Build the poll Loop and Launch sleep Processes
31:39 Restore Child Signal State and Reap Every Exited Process
40:42 Event Loops and the Node.js Single-Threaded Model
44:23 Signal Masks and Handlers Across execve
47:02 Signal Related Processes with Process Groups
51:27 Why systemd Uses Cgroups for Stronger Process Grouping

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

Transcript excerpt

3:26 All righty, welcome back to operating systems. Definitely a Friday. So, you should be able to start, if you haven't looked at lab two yet, everyone's looked and finished lab two, right? Yeah, no. All right, so when it was posted, you could have done all the week one tasks that I separated out for you. You couldn't have done week two. After this lecture, you should be able to do the week two stuff and complete the lab, and understand it more importantly. So, we were talking about event loops and process groups. So, recall we were waiting for a child. If I want to like in lecture six, we were want to react to the child exiting. So,

4:13 there were few options we had. We could just poll. We could constantly call waitpid with that no hang and just ask over and over again. That's bad. That will keep the CPU busy. If we try and fix it by sleeping, then we're sacrificing response time for actually just burning CPU cycles. And then we saw the interrupt version of that, which was waitpid in that sigchild handler, because we know now that our operating system, when our child terminates, it will send us a signal. We can react to it. And we can handle it there if we want. But, writing code in a signal handler or an interrupt handler is notoriously difficult to get right. Like, for example, that signal close example, it

5:01 accidentally closed its file twice, because with signal handlers, well, the operating system might just run another signal handler in the middle of your first signal handler, introducing concurrency, which I'm sorry to tell you you are not good enough programmers to handle yet. So, you might have tried that in another course. Have How many How many of you

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.