CS 444544 Operating Systems II Yeongjin Jang 040219

  • Slides: 26
Download presentation
CS 444/544 Operating Systems II Yeongjin Jang 04/02/19 II

CS 444/544 Operating Systems II Yeongjin Jang 04/02/19 II

Ring 3 Course Description • Goal: Learn how modern operating systems work • Lecture

Ring 3 Course Description • Goal: Learn how modern operating systems work • Lecture Lab 0) OS Kernel&(Ring • • Learn high-level fundamental concepts of OS in the lecture Practice engineering details with Labs You will build your operating system (JOS) Lab sessions: TAs will help you • Topics • • • Virtual memory, Segmentation, Paging Process, Isolation, Kernel, User Interrupt, Exceptions, Synchronization, Concurrency Filesystem etc. Image from: https: //www 3. nd. edu/~pbui/teaching/cse. 30341. fa 17/

Course Objective • Understand how modern computer systems work • Be able to answer

Course Objective • Understand how modern computer systems work • Be able to answer the following questions: • • • What happens when we turn on the computer? How does it boot? How an OS runs an application? How an OS runs application that requires memory more than its physical memory? How multiple applications can run on the system? How an OS enforces privilege separation? How an OS protects itself from malicious software? How multiple programs synchronize? How can we implement a lock? How an OS stores a file? How my keyclicks shown on the screen?

Logistics • Website: https: //os. unexploitable. systems • Instructor: Dr. Yeongjin Jang (yeongjin. jang@oregonstate.

Logistics • Website: https: //os. unexploitable. systems • Instructor: Dr. Yeongjin Jang (yeongjin. jang@oregonstate. edu) • TAs: • • Ping-Jui Liao Hadi Rahal-Arabi Kimia Tajik Zixuan Feng Gitlab: https: //gitlab. unexploitable. systems Piazza: https: //piazza. com/class/jtumxajv 58 g 7 mv Discord: https: //discord. gg/y. Hn 52 Np Assignment server: flip

Course Structure • 10 weeks schedule • Virtualization (Week 1 -4) • Concurrency (Week

Course Structure • 10 weeks schedule • Virtualization (Week 1 -4) • Concurrency (Week 5 -8) • Persistence (Week 9 -10) • Textbook • http: //pages. cs. wisc. edu/~remzi/OSTEP/ • ~60 min lecture, ~10 min Q&A • 30~45 min tutorial in lab sessions • 35~50 min exercise in lab sessions

Meeting Time (with me) • Lecture • Tu/Th 8: 30 am – 9: 50

Meeting Time (with me) • Lecture • Tu/Th 8: 30 am – 9: 50 am • Withycombe 109 • Office hour • Wed 5: 00 pm – 6: 30 pm (walk-in) • yeongjin. jang@oregonstate. edu • KEC 3079 • No class on 5/21 and 5/23, no office hour on 5/22 • Travel to a conference (IEEE S&P)… • Please work on labs assignments

Lab Sessions (TAs) • Four sessions • • Lab 1: TUE 10: 00 –

Lab Sessions (TAs) • Four sessions • • Lab 1: TUE 10: 00 – 11: 20 (Handled by me) Lab 2: TUE 12: 00 – 13: 20 (TAs: TBD) Lab 3: WED 15: 00 – 16: 20 (TAs: TBD) Lab 4: FRI 14: 00 – 15: 50 (TAs: TBD) • Will teach technical details of OS via labs • Tutorials • Q&A for lab exercises • TA Office Hours will be announced later. . • No lab sessions in the week of 5/20 • Majority of TAs also travels to the conference. . • Please work on lab assignments • We will be online

Grading • 50% lab assignment • JOS Lab 1, 2, 3 and Concurrency Lab

Grading • 50% lab assignment • JOS Lab 1, 2, 3 and Concurrency Lab 1, 2 • 20% Quizzes (mini exam during lab sessions) • Quiz dates will be announced at least a week before. . • 30% Final Exam • Exam date not determined yet, but will be in the final week. • Example grading scheme (we will have + / -) • • • A: 85% <= Score <= 100% B: 70% <= Score < 85% C: 60% <= Score < 70% D: 50% <= Score < 60% F: Score < 50%. . .

The Lab (50%) • Five labs • JOS Lab 1: Booting a PC (2

The Lab (50%) • Five labs • JOS Lab 1: Booting a PC (2 weeks) • Bootloader, protected mode, etc. • JOS Lab 2: Memory Management (2 weeks) • Virtual memory, paging, etc. • JOS Lab 3: User Environment (2 weeks) • Process, user, kernel, system call, etc. • Concurrency Lab 1: Locks and Semaphores (1 week, TBA) • Implement synchronization mechanisms • Concurrency Lab 2: Deadlocks and Thread-safe issues (1 week, TBA) • Avoiding deadlocks, implementing thread-safe datastructures

An Exercise Example in Lab 1

An Exercise Example in Lab 1

The Lab Could be Difficult • Coding KERNEL code in C • Any memory

The Lab Could be Difficult • Coding KERNEL code in C • Any memory error -> Triple fault… • Use GDB for debugging OS Kernel • Get familiar to tools ASAP. . Come to lab sessions and learn! • Assembly Languages • Intel x 86 • Control hardware specific data • Page table • Global descriptor table (GDT) • Interrupt descriptor table (IDT)

Lab Rules • DO NOT SHARE YOUR CODE WITH OTHER STUDENTS • You are

Lab Rules • DO NOT SHARE YOUR CODE WITH OTHER STUDENTS • You are encouraged to discuss with others about the assignments but do not ask/give the code to the others • Do not copy other students’ code or code available in online • Do not publish your code online • You will be asked to submit a simple write-up for the assignment • • Describe how you solve each exercise/questions Mention your collaborators in the write-up Do not copy other students’ write-up Do not publish your write-up online

Lab Rules • You can have five (5) tokens • Each token let you

Lab Rules • You can have five (5) tokens • Each token let you push the deadline of a lab for 1 day • Plagiarism will be punished via the Office of Student Life. . • E. g. , getting F or zero point for an entire week’s assignment • Please refer the Code of Student Conduct • https: //studentlife. oregonstate. edu/studentconduct/academicmisconduct • https: //studentlife. oregonstate. edu/sites/studentlife. oregonstate. edu/files/c ode-of-student-conduct-102218. pdf

Extra Credit Labs -- JOS Lab 4 (15%) and 5 (15%) Due: 6/13, no

Extra Credit Labs -- JOS Lab 4 (15%) and 5 (15%) Due: 6/13, no Tokens! • JOS Lab is designed to teach students in semester systems (16 weeks) • Taught at MIT, Yale, Georgia Tech, etc. • Handling all labs within 10 weeks could be very tight… • But not impossible, some folks finish this within a month • Caffeinated 6. 828 @ MIT • In addition to booting (Lab 1), virtual memory (Lab 2), and user environment (Lab 3), JOS Lab is also available for: • Lab 4: Preemptive Multitasking • Time-sharing, Multi-thread, Multi-processor, concurrency, etc. • Lab 5: Filesystems • Files, spawns process, run applications via a shell! • Lab 6: Networking • Extra credits (due 6/13) for finishing Lab 4 / Lab 5 • 15% credits each

NORMAL OPTION • 50% lab assignment • JOS Lab 1, 2, 3 and Concurrency

NORMAL OPTION • 50% lab assignment • JOS Lab 1, 2, 3 and Concurrency Lab 1, 2 • 20% Quizzes (mini exam during lab sessions) • 30% Final Exam

A HARDCORE OPTION • 50% lab assignment • JOS Lab 1, 2, 3 and

A HARDCORE OPTION • 50% lab assignment • JOS Lab 1, 2, 3 and Concurrency Lab 1, 2 • 20% Quizzes (mini exam during lab sessions) • 15% JOS Lab 4 • 15% JOS Lab 5 • Total: 100% • 30% Final Exam • Or you may take the final exam to fill missing credits from labs/quizzes

CS 544 Students • 50% Lab assignments for CS 444 • 40% Lab assignments

CS 544 Students • 50% Lab assignments for CS 444 • 40% Lab assignments for CS 544 • Students will be asked to provide academic paper critiques • 2% each, five times (total 10%), and due in 1 week after posting date • Instructions will be posted later

Tips to the Lab • Study in a group (do discussions!) • But please

Tips to the Lab • Study in a group (do discussions!) • But please write the code individually! • Come to the class and lab sessions and follow tutorials/exercise! • Ask questions (Piazza, Discord, and Office Hour) • Understand your time budget (Debugging will take lots of your time!) • Plan ahead to finish the labs on time • Learn basic tools (e. g. , C, gdb, assembly, editors, tmux, etc. ) ASAP • This will help you earn more time on doing labs…

What is an OS? Applications OS Hardware

What is an OS? Applications OS Hardware

OS is a software layer that connects application and hardware • Abstraction • Different

OS is a software layer that connects application and hardware • Abstraction • Different hardware speaks different language (protocols) • Intel CPU / AMD CPU / ARM CPU • NVIDIA GPU (Ge. Force) / AMD GPU (Radeon) • HDD, SSD, Floppy Disk, CD-ROM, DVD-ROM, etc. • Application runs without knowing such details • One source code, compile, then runs on Intel/AMD/ARM… • Open/read/write, send/recv • Open. GL, Open. CL, etc.

OS Manages System Resources • Resource Management • Sharing • Multiple apps shares one

OS Manages System Resources • Resource Management • Sharing • Multiple apps shares one CPU’s execution time • Apps sharing disk, network, graphics, etc. • Security • Privilege separation • Administrator vs regular user, among each users, etc. • Isolation • A process to another process…

OSTEP: OS Three Easy Pieces • Virtualization • Concurrency • Persistence

OSTEP: OS Three Easy Pieces • Virtualization • Concurrency • Persistence

Virtualization Ring 3 • Virtualize Memory • Virtualize CPU • Virtualize Disk and other

Virtualization Ring 3 • Virtualize Memory • Virtualize CPU • Virtualize Disk and other hardware OS Kernel (Ring 0) • Security

Concurrency Ring 3 • Multi-threading • Run multiple apps at the same time •

Concurrency Ring 3 • Multi-threading • Run multiple apps at the same time • Symmetric Multi-processor Environment • Multi-cores! • Concurrent hardware (resource) access! OS Kernel (Ring 0)

Persistence • How to store data? • How to manage permanent system state? •

Persistence • How to store data? • How to manage permanent system state? • How to run a program from a disk?

Q&A?

Q&A?