TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

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

214 pointsby ksmlover 4 years ago

10 comments

ksmlover 4 years ago
Hi HN, I spent last spring working on a new class at Stanford that&#x27;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: <a href="http:&#x2F;&#x2F;cs110l.stanford.edu&#x2F;" rel="nofollow">http:&#x2F;&#x2F;cs110l.stanford.edu&#x2F;</a><p>I&#x27;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 comments and suggestions!
评论 #24712609 未加载
评论 #24712572 未加载
评论 #24712560 未加载
评论 #24715352 未加载
评论 #24718058 未加载
评论 #24713642 未加载
评论 #24711671 未加载
评论 #24711614 未加载
mjbover 4 years ago
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&#x27;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).<p>&gt; 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?<p>That&#x27;s an interesting take, because I don&#x27;t see Rust as being more abstracted in this way than C++ is. Obviously it&#x27;s more abstracted than C, but by the time you get to &quot;modern&quot; C++ you&#x27;re programming in a much higher-level language than C.<p>&gt; I also think it’s hard for students to appreciate Rust without having first experienced C and C++.<p>This part does make sense. Explaining the &quot;why can&#x27;t we just write C really carefully?&quot; piece to people who haven&#x27;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.<p>&gt; that looks at what is often going wrong in systems and how we can improve practices to build better systems.<p>I&#x27;d love to see more research here too. There&#x27;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&#x27;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.
评论 #24713531 未加载
评论 #24712934 未加载
slaymaker1907over 4 years ago
I think another big benefit of Rust for systems is that you can explicitly mark functions&#x2F;traits as unsafe if they require some preconditions to work correctly or if the trait must guarantee something that can&#x27;t be checked by the compiler. That&#x27;s a big benefit over C++ where the best you can do is documentation since the warnings in the documentation don&#x27;t appear at the call site unlike how using an unsafe API requires an unsafe block&#x2F;another unsafe function.
musicaleover 4 years ago
These comments struck me as particularly damning:<p>&gt; As people usually say, Rust has a steep learning curve, and it’s really hard to get productive with it in a short amount of time. This is reflected in the 2019 Rust language survey, and it’s also reflected in the student frustration in the first few weeks of our weekly survey responses<p>&gt; While I think Rust would be poorly motivated in CS 107, I think it is extra poorly suited for CS 110.<p>I have essentially no experience with Rust, and I want to like it. But I get the feeling that it isn&#x27;t very user-friendly and that I would enjoy it much less than other memory safe languages like Swift, Go or Java or even sharper-edged languages like C++ with smart pointers or Objective-C with ARC.<p>Also given the large body of legacy C&#x2F;C++ code still in use and development, I&#x27;m disappointed that clang still doesn&#x27;t seem to support a memory-safe mode&#x2F;ABI, as it could eliminate a large class of errors.<p>Maybe Unix made a critical error by adopting and promoting unsafe C; its predecessor Multics, written in PL&#x2F;I, had essentially zero buffer, heap, or stack overflows over its entire lifetime (though it probably still had race conditions and concurrency errors.) ;-)
评论 #24715554 未加载
评论 #24715247 未加载
moonchildover 4 years ago
Rust is nice enough, but I&#x27;m not sure it&#x27;s worth a university-level course on safe systems programming. There&#x27;s a lot more of interest about ats[1]; f*[2] (specifically its &#x27;low&#x27; subset); isabelle[3] (most notably used by the sel4 microkernel); et al.<p>1. <a href="http:&#x2F;&#x2F;www.ats-lang.org&#x2F;" rel="nofollow">http:&#x2F;&#x2F;www.ats-lang.org&#x2F;</a><p>2. <a href="https:&#x2F;&#x2F;fstar-lang.org&#x2F;" rel="nofollow">https:&#x2F;&#x2F;fstar-lang.org&#x2F;</a><p>3. <a href="http:&#x2F;&#x2F;isabelle.in.tum.de&#x2F;" rel="nofollow">http:&#x2F;&#x2F;isabelle.in.tum.de&#x2F;</a>
评论 #24716168 未加载
vikiomega9over 4 years ago
I don&#x27;t see a focus on testing in this course. Was that by design? I feel like a lot of design out there forgets this important implementation detail.
评论 #24713983 未加载
feichangleiover 4 years ago
Unfortunately it seems Zoom failed to record Armin&#x27;s voice in the first video, FYI.
评论 #24713701 未加载
google234123over 4 years ago
I wonder if either of the two teachers have actually worked on a large system before.
评论 #24713411 未加载
评论 #24712144 未加载
评论 #24712198 未加载
评论 #24712830 未加载
dangover 4 years ago
This is a fine article but not a Show HN, so I&#x27;ve taken that out of the title. Please see <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;showhn.html" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;showhn.html</a>.
评论 #24713451 未加载
评论 #24711940 未加载
renoxover 4 years ago
There&#x27;s more to safety in system programming than &quot;use Rust&quot;..<p>What about Ada&#x2F;Spark ? Fuzzing?
评论 #24713374 未加载