Why Rust?

Why Systems Programming Languages Matter

Importance of Systems Languages:

  • Essential for building operating systems, databases, and infrastructure
  • Provide fine-grained control over system resources
  • Enable optimization for performance-critical applications
  • Foundation for higher-level languages and frameworks

Performance Advantages:

  • Generally compiled languages like Rust are needed to scale to large, efficient deployments
  • Can be 10x to 100x faster than equivalent Python code
  • Better memory management and resource utilization
  • Reduced runtime overhead compared to interpreted languages

Memory Safety: A Critical Advantage

What is Memory Safety?

Memory safety prevents common programming errors that can lead to security vulnerabilities:

  • Buffer overflows
  • Use-after-free errors
  • Memory leaks
  • Null pointer dereferences

Industry Recognition:

Major technology companies and government agencies are actively moving to memory-safe languages:

  • Google, Microsoft, Meta have efforts underway to move infrastructure code from C/C++ to Rust
  • U.S. Government agencies recommend memory-safe languages for critical infrastructure
  • DARPA has programs focused on translating C to Rust
  • CISA (Cybersecurity and Infrastructure Security Agency) advocates for memory-safe roadmaps

image.png Whitehouse Press Release


image-2.png Darpa Program


image-3.png CISA -- The case for memory safe roadmaps CISA -- Cybersecurity and Infrastructure Security Agency


Programming Paradigms: Interpreted vs. Compiled

Interpreted Languages (e.g., Python):

Advantages:

  • Interactive development environment
  • Quick iteration and testing
  • Rich ecosystem for data science (Jupyter, numpy, pandas)
  • Easy to learn and prototype with

Compiled Languages (e.g., Rust):

Advantages:

  • Superior performance and efficiency
  • Early error detection at compile time
  • Optimized machine code generation
  • Better for production systems

Development Process:

  1. Write a program
  2. Compile it (catch errors early)
  3. Run and debug optimized code
  4. Deploy efficient executables

Using Rust in a Jupyter Notebook

The project EvCxR (Evaluation Context for Rust) creates a Rust kernel that you can use in Jupyter notebooks.

  • Can be helpful for interactive learning
  • There are some quirks when creating Rust code cells in a notebook
    • Variables and functions are kept in global state
    • Order of cell execution matters!
  • Previous versions of the course notes used this format

We use Rust mdbook with code cells that get executed on the Rust playground.

Same format that the Rust language book is written.

Technical Coding Interviews

And finally...

If you are considering technical coding interviews, they sometimes ask you to solve problems in a language other than python.

Many of the in-class activities and early homework questions will be Leetcode/HackerRank style challenges.

This is good practice!