CS 140e Opera&ng Systems from the Ground Up CS 140e Goals - - PowerPoint PPT Presentation

cs 140e
SMART_READER_LITE
LIVE PREVIEW

CS 140e Opera&ng Systems from the Ground Up CS 140e Goals - - PowerPoint PPT Presentation

CS 140e Opera&ng Systems from the Ground Up CS 140e Goals Learn OS fundamentals. Disks, File systems, I/O Threads & Processes Scheduling Virtual Memory Protection & Security Interrupts


slide-1
SLIDE 1

CS 140e

Opera&ng Systems from the Ground Up

slide-2
SLIDE 2

CS 140e Goals

  • Learn OS fundamentals.
  • Disks, File systems, I/O
  • Threads & Processes
  • Scheduling
  • Virtual Memory
  • Protection & Security
  • Interrupts
  • Concurrency & Synchronization
  • Build an OS from scratch.
  • Learn embedded development fundamentals.
  • Write low-level embedded soBware and drivers.
slide-3
SLIDE 3

About CS 140e: Why?

  • Brand new Opera&ng Systems course!
  • All course material is new.
  • Not based off any existing course.
  • …expect rough edges.
  • Everything is real.
  • No virtual machines. All software runs on Raspberry Pi 3.
  • A boFom-up, from scratch approach.
  • You write vast majority of software.
  • A modern approach.
  • Multicore, 64-bit ARMv8 platform.
  • Modern programming languages and tools.
slide-4
SLIDE 4

About CS 140e: Why?

slide-5
SLIDE 5

Who We Are

Jennifer Lin

Your TA!

slide-6
SLIDE 6

Who We Are

Dawson Engler

Professor, Instructor

slide-7
SLIDE 7

Who We Are

Sergio Benitez

Ph.D., Instructor

slide-8
SLIDE 8

Who You Are

43% 50% 4% 4%

Yes, Many Yes, Several Yes, A Few No

Have you implemented any opera1ng system mechanisms such as virtual memory support, processes, or threads?

slide-9
SLIDE 9

Who You Are

71% 14% 11% 4%

Yes, Many Yes, Several Yes, A Few No

Have you implemented any bare metal so>ware such as bootloaders or device drivers?

slide-10
SLIDE 10

Who You Are

32% 43% 11% 14%

Yes, A Lot Yes, Some Yes, A Little No

Do you have any experience with embedded so>ware development?

slide-11
SLIDE 11

Administrivia

  • Lectures
  • Mondays and Wednesday, 3:00pm - 4:20pm (160-124)
  • Focus on theoretical/conceptual OS concepts
  • Labs (op&onal but encouraged)
  • Mondays and Wednesday, 5:30pm - 6:30pm (Gates 463a)
  • Focus on assignments.
  • Course Website: hFps:/

/cs140e.stanford.edu

  • News, assignments, policies, etc.
  • Still a work in progress.
  • Q&A on Piazza (see course website for link)
  • Office Hours TBA.
slide-12
SLIDE 12

Assignments and Exams

  • Midterm and Final Exam
  • Focus primarily on lecture material.
  • Open notes. Anything written/printed is allowed.
  • 5 Heavy (!!) Programming Assignments
  • Budget about 10 - 15 hours per week per assignment.
  • First assignment out on Wednesday.
  • Writing component: answer questions.
  • Individual, but collaboration on ideas is encouraged.
  • All code must be your own. Please don’t cheat.
  • Start early. Don’t procrastinate!
  • Late Policy: 100 penalized hours per assignment
  • Does not apply to last assignment.
  • Score capped at max(0, 100 - n)% for n hours late
slide-13
SLIDE 13

Assignment Schedule

  • Assignment 0: Ge^ng Started
  • Set-up Raspberry Pi. Write first program.
  • Out on Wednesday. Due Monday.
  • Assignment 1: The Shell
  • Write a bash-like shell that runs on your machine and Pi.
  • Write a shell command that loads program over UART: “bootloader”.
  • Assignment 2: File System
  • Write SD card driver and FAT32 file system.
  • Assignment 3: Spawn
  • Load and execute programs from SD card in separate processes.
  • Assignment 4: Preemp&ve Mul&core Mul&tasking
  • Run multiple programs at once on multiple cores.
slide-14
SLIDE 14

Grading

  • Grading Breakdown
  • 55% assignments
  • 20% midterm
  • 25% final exam
  • (+/-) 5% participation
  • We hope to gives lots of As!
slide-15
SLIDE 15

Who You Are

In which programming languages do you feel comfortable and confident wri1ng so>ware? C, C++, Java, Python, JavaScript

slide-16
SLIDE 16
slide-17
SLIDE 17

Rust!

In which programming languages do you feel comfortable and confident wri1ng so>ware? C, C++, Java, Python, JavaScript

slide-18
SLIDE 18

Rust!

  • Memory-safe without a GC.
  • No data races, guaranteed!
  • Minimal runtime.
  • Static, strong types.
  • Package manager.
slide-19
SLIDE 19

C: Undefined Behavior

int main(int argc, char **argv) { unsigned long a[1]; a[2] = 0x7ffff7b36cebUL; return 0; }

slide-20
SLIDE 20

C: Undefined Behavior

int main(int argc, char **argv) { unsigned long a[1]; a[2] = 0x7ffff7b36cebUL; return 0; }

ret sp a[0]

addresses

stack

slide-21
SLIDE 21

C: Undefined Behavior

int main(int argc, char **argv) { unsigned long a[1]; a[2] = 0x7ffff7b36cebUL; return 0; }

ret 0x7ffff7.. sp a[0]

addresses

stack

slide-22
SLIDE 22

C: Undefined Behavior

int main(int argc, char **argv) { unsigned long a[1]; a[2] = 0x7ffff7b36cebUL; return 0; }

ret 0x7ffff7.. sp a[0]

addresses

stack

undef: Error: .netrc file is readable by others. undef: Remove password or make file unreadable by others.

slide-23
SLIDE 23

Rusty Types for Solid Safety (PLAS’16)

Aliasing is Hard!

int main() { std::vector<std::string> v; v.push_back("Hello, "); std::string &x = v[0]; v.push_back(" world!"); std::cout << x; }

slide-24
SLIDE 24

Rusty Types for Solid Safety (PLAS’16)

Aliasing is Hard!

int main() { std::vector<std::string> v; v.push_back("Hello, "); std::string &x = v[0]; v.push_back(" world!"); std::cout << x; }

v v[0]

slide-25
SLIDE 25

Rusty Types for Solid Safety (PLAS’16)

Aliasing is Hard!

int main() { std::vector<std::string> v; v.push_back("Hello, "); std::string &x = v[0]; v.push_back(" world!"); std::cout << x; }

v v[0] x

slide-26
SLIDE 26

Rusty Types for Solid Safety (PLAS’16)

Aliasing is Hard!

int main() { std::vector<std::string> v; v.push_back("Hello, "); std::string &x = v[0]; v.push_back(" world!"); std::cout << x; }

v v[0] x

slide-27
SLIDE 27

Rusty Types for Solid Safety (PLAS’16)

Aliasing is Hard!

v v[0] x

int main() { std::vector<std::string> v; v.push_back("Hello, "); std::string &x = v[0]; v.push_back(" world!"); std::cout << x; }

slide-28
SLIDE 28

Rusty Types for Solid Safety (PLAS’16)

Aliasing is Hard!

int main() { std::vector<std::string> v; v.push_back("Hello, "); std::string &x = v[0]; v.push_back(" world!"); std::cout << x; }

v v[0] x v[0] v[1]

slide-29
SLIDE 29

Rusty Types for Solid Safety (PLAS’16)

Aliasing is Hard!

int main() { std::vector<std::string> v; v.push_back("Hello, "); std::string &x = v[0]; v.push_back(" world!"); std::cout << x; }

v v[0] x v[0] v[1]

slide-30
SLIDE 30

Rusty Types for Solid Safety (PLAS’16)

Aliasing is Hard!

int main() { std::vector<std::string> v; v.push_back("Hello, "); std::string &x = v[0]; v.push_back(" world!"); std::cout << x; }

v v[0] x

slide-31
SLIDE 31

Rusty Types for Solid Safety (PLAS’16)

Restricted Aliasing

int main() { vector<string> v; v.push_back("Hello, "); string &x = v[0]; v.push_back(" world!"); cout << x; } fn main() { let mut v = Vec::new(); v.push("Hello, "); let x = &v[0]; v.push(" world!"); println!("{}", x); }

C++ Rust

slide-32
SLIDE 32

Rusty Types for Solid Safety (PLAS’16)

Restricted Aliasing

v v[0]

fn main() { let mut v = Vec::new(); v.push("Hello, "); let x = &v[0]; v.push(" world!"); println!("{}", x); }

slide-33
SLIDE 33

Rusty Types for Solid Safety (PLAS’16)

Restricted Aliasing

fn main() { let mut v = Vec::new(); v.push("Hello, "); let x = &v[0]; v.push(" world!"); println!("{}", x); }

v v[0] x

slide-34
SLIDE 34

Rusty Types for Solid Safety (PLAS’16)

Restricted Aliasing

fn main() { let mut v = Vec::new(); v.push("Hello, "); let x = &v[0]; v.push(" world!"); println!("{}", x); }

v v[0] x

slide-35
SLIDE 35

Rusty Types for Solid Safety (PLAS’16)

Restricted Aliasing

fn main() { let mut v = Vec::new(); v.push("Hello, "); let x = &v[0]; v.push(" world!"); println!("{}", x); }

v v[0] x

b r e a k s i n v a r i a n t = > s t a t i c a l l y d i s a l l

  • w

e d