Live data from Hacker News

Designing a New Rust Class at Stanford: Safety in Systems Programming

reberhardt.com

11–20 of 53 posts

Re: Designing a New Rust Class at Stanford: Safety in Systems Programming

#11

I wonder if either of the two teachers have actually worked on a large system before.

This comes across as really harsh. Did you mean to come across that way?

You are projecting your intent on the OP. I do not see anything positive or negative in their comment.

Re: Designing a New Rust Class at Stanford: Safety in Systems Programming

#12
post #2

Hi HN, I spent last spring working on a new class at Stanford that's focused on common pitfalls in systems programming and how to avoid them. You can check out all the lecture materials (including recorded lecture videos) and assignments available here: http://cs110l.stanford.edu/ I'm planning on teaching this class again in the winter or spring and am looking for any feedback to improve it. I would love to hear your…

I may be misunderstanding, but it appears that the code for the assignments is in a private GitHub repo that students of the class are invited to. Is there any other way to gain access?

Re: Designing a New Rust Class at Stanford: Safety in Systems Programming

#13
post #2

Hi HN, I spent last spring working on a new class at Stanford that's focused on common pitfalls in systems programming and how to avoid them. You can check out all the lecture materials (including recorded lecture videos) and assignments available here: http://cs110l.stanford.edu/ I'm planning on teaching this class again in the winter or spring and am looking for any feedback to improve it. I would love to hear your…

One aspect of systems programming that doesn't get enough attention involves tracing memory leaks (with valgrind, massif, etc). While it may be challenging for you to create realistic examples, doing so would help expose students to challenges they'll face in the real world.

Re: Designing a New Rust Class at Stanford: Safety in Systems Programming

#14
I think another big benefit of Rust for systems is that you can explicitly mark functions/traits as unsafe if they require some preconditions to work correctly or if the trait must guarantee something that can't be checked by the compiler. That's a big benefit over C++ where the best you can do is documentation since the warnings in the documentation don't appear at the call site unlike how using an unsafe API requires an unsafe block/another unsafe function.

Re: Designing a New Rust Class at Stanford: Safety in Systems Programming

#15
post #2

Hi HN, I spent last spring working on a new class at Stanford that's focused on common pitfalls in systems programming and how to avoid them. You can check out all the lecture materials (including recorded lecture videos) and assignments available here: http://cs110l.stanford.edu/ I'm planning on teaching this class again in the winter or spring and am looking for any feedback to improve it. I would love to hear your…

This is a step forward. I've been pushing for more language safety for what, decades, and it's good to see Stanford teaching it. It's important that students understand ownership concepts, because they exist in C, but the language doesn't give you any help in dealing with ownership. For years, I've been saying about C that the big questions are "how big is it?", "who deletes it?", and "who locks it?". Rust addresses all of those. So teaching Rust is useful to get students thinking in the right direction. Even if they get stuck maintaining old C code.

Looking ahead, new students are going to have to deal in future with huge numbers of CPU cores. So they need to deal with large numbers of threads. That's very hard to do well. This class addresses not just safety, but performance. That's good.

This is so far ahead of what I got from Stanford in 1985.

(I have some arguments with the Rust people, mostly around over-use of "unsafe" and too much language churn, but they're doing great work.)

Re: Designing a New Rust Class at Stanford: Safety in Systems Programming

#16

I wonder if either of the two teachers have actually worked on a large system before.

This comes across as really harsh. Did you mean to come across that way?

I don't think it's harsh. It is a reasonable question to ask. Academia is rife with people who have never worked in the industry, completely disconnected from reality.

Re: Designing a New Rust Class at Stanford: Safety in Systems Programming

#18
post #15
post #2

Hi HN, I spent last spring working on a new class at Stanford that's focused on common pitfalls in systems programming and how to avoid them. You can check out all the lecture materials (including recorded lecture videos) and assignments available here: http://cs110l.stanford.edu/ I'm planning on teaching this class again in the winter or spring and am looking for any feedback to improve it. I would love to hear your…

This is a step forward. I've been pushing for more language safety for what, decades, and it's good to see Stanford teaching it. It's important that students understand ownership concepts, because they exist in C, but the language doesn't give you any help in dealing with ownership. For years, I've been saying about C that the big questions are "how big is it?", "who deletes it?", and "who locks it?". Rust addresses…

Just FYI, Stanford also has a class on parallel programming (which I TA'd at one point). This goes into GPU and distributed programming as well as multi-core. Slides are online though I guess lecture recordings are not: http://cs149.stanford.edu

Re: Designing a New Rust Class at Stanford: Safety in Systems Programming

#19
post #16

Earlier quoted context omitted.

This comes across as really harsh. Did you mean to come across that way?

I don't think it's harsh. It is a reasonable question to ask. Academia is rife with people who have never worked in the industry, completely disconnected from reality.

From what I understand reading the course outline, this is an introductory class. Foundational material in a subject is often "completely disconnected" from the reality of the discipline. If I was an engineer taking a first course in integral calculus, should I worry that my teacher may not be a seasoned practitioner, or should I worry that they are good at getting me to understand the fundamentals? I can definitely see your argument if this was a professional practice class, or something vocational, but it's a 100 level CS class.

Re: Designing a New Rust Class at Stanford: Safety in Systems Programming

#20
Teaching a class about safety in systems code seems like a great idea, and at first glance the class content here seems useful and interesting. I do a lot of OS-level stuff at work (especially around virtualization and Firecracker), and while safety (and security) are obviously a critical topic for industrial systems, they don't tend to be things that new grads have thought about at all. Great to see that changing (even, as with all curriculum additions, it means covering some other stuff less).

> CS 110 [multiprocessing, multithreading, and networking in C++] is not just about how we do things, but also why – why are things designed the way they are, and if we get certain bugs or performance characteristics, why is that?

That's an interesting take, because I don't see Rust as being more abstracted in this way than C++ is. Obviously it's more abstracted than C, but by the time you get to "modern" C++ you're programming in a much higher-level language than C.

> I also think it’s hard for students to appreciate Rust without having first experienced C and C++.

This part does make sense. Explaining the "why can't we just write C really carefully?" piece to people who haven't experienced trying to do that is going to be harder. As we all know, it is possible to write safe C, but it takes a level of discipline and tooling support that is beyond most undergrads.

> that looks at what is often going wrong in systems and how we can improve practices to build better systems.

I'd love to see more research here too. There's some systematic studies of the causes of bugs in systems code, and obviously a lot of well-known bug patterns (see all of C's string handling). On the other hand, there seems to be fairly little research on the causes of more pernicious and subtle problems that become vulnerabilities (and data corruption, crashes, etc) in systems code.

Post reply on HN