Lecture 19: Nonblocking I/O and Event-Driven Programming

Thursday, June 11th Lecture 19: [slides] [pdf]

Today, Chris Gregg finishes up nonblocking I/O with two hip examples: and Both methods use a single thread to support a server able to quickly respond to multiple client requests, though the efficient server does so using the epoll system calls to leverage the OS's ability to support waiting for changes to file descriptors.

Lecture 18: Introduction to Nonblocking I/O

Monday, June 8th Lecture 18: [slides] [pdf]

Today and Wednesday, we'll introduce the idea of I/O event-driven programming and how it can be used to complement nonblocking I/O techniques. Linux provides I/O event detection facilities via its epoll (short for event polling) library. We'll spend today's lecture discussing three key epoll functions and the various ways they can be combined with nonblocking descriptors to build singly-threaded web servers that can handle tens of thousands of connections. We will discuss the pros and cons of nonblocking I/O while comparing it to blocking I/O approaches relying on multithreading and multiprocessing.

Lab 08: proxy Thought Questions

Wednesday, June 3rd Lab 08: proxy Thought Questions
Lab 08 Solution: proxy Thought Questions Solution

This week's section is completely optional and you get credit for just being you whether or not you participate. We'll adopt a hybrid model where the students decide how much traditional discussion section they want, and how much should operate as traditional office hours. I'm posting the solutions immediately, as they might very well inform how you approach your final programming assignment.

This is the last week of section, so you're off the hook for next week. :)

Older Lectures


  • Ryan Wins Centennial, CS110 Students Soft Launch Sesame

    Friday, June 12th

    I'm happy to announce that CS110's very own Ryan Eberhardt is receiving the 2020 Centennial Teaching Assistant Award for his work as a CS106AJ, CS106AX, CS110, and CS110L teaching assistant and instructor. He could have easily graduated a year ago had he wanted to, but he's been sticking around in part because he wants to teach as much as possible before departing. Hit Ryan up on Slack or over email to congratulate him, because he deserves to be congratulated.

    Another happy announcement: Three CS110 graduates (one from 2018, but two from this quarter!) have been working on a Mac and Windows desktop application—and no, Glen, no Linux version yet, and don't tell me you weren't about to ask—called Sesame. Maddie Wang, Lainey Wang, and Rachel Naidich have been working on various projects over the course of the year, and Sesame represents the accumulation of all that work so far.

    Here's Rachel's elevator pitch:

    Sesame recreates the feeling of being with your friends all day, every day, even when we're apart. You're in a house filled with all your closest friends, some with their doors open and some with their doors closed. If it's open, click to hang out instantly. If it's closed, knock to talk later.

    CS110 Relevance Alert: they couldn't wait to tell me they needed execvp to get a key portion of the platform working. Cool. Even Doris (@doris on Sesame) was impressed.

  • Shut Down STEM

    Wednesday, June 10th

    CS110 is recognizing #ShutDownSTEM, #ShutDownAcademia, and #Strike4BlackLives with the goal of prompting Stanford and all other higher education institutions to pursue immediate solutions to their own anti-Black racism that don't rely solely on the demands and activism of their communities but also the demands and activism of their top administrators.

    There is no daily briefing today, and whatever materials would have been presented today will be presented tomorrow on June 11th. We will still provide support via CS110 channels where students opt in for help, e.g. Piazza, Slack, and office hours.

  • CS110 and the End of the Quarter

    Friday, June 5th

    If you didn't read the two announcements posted to Piazza earlier today, please read them when you get a chance. Those announcements are right here and right here.

    The first message mentioned I was relaxing the requirement that you get at least half the points on Assignments 5 or 6. Provided your overall avearge in the course is a 70% or higher, you still meet the requirements needed to pass the course. The second message, posted about an hour later, mentioned that I decided to drop the lowest assignment score and retain the other five. Your top five assignments are weighted equally, and your lowest assignment—even if it's a 0—will be dropped.

  • Older Announcements