introduction to computer science
play

Introduction to Computer Science CSCI 109 China Tianhe-2 Andrew - PowerPoint PPT Presentation

Introduction to Computer Science CSCI 109 China Tianhe-2 Andrew Goodney Spring 2018 Lecture 8: Operating Systems March 5 th , 2018 Operating Systems Working Together 1 Schedule Date


  1. Introduction to Computer Science CSCI 109 China – Tianhe-2 Andrew Goodney Spring 2018 Lecture 8: Operating Systems March 5 th , 2018

  2. ì Operating Systems Working Together 1

  3. Schedule Date Topic Assigned Due Quizzes/Midterm/Final What is computing, how did computers 8-Jan Introduction HW1 come to be? 15-Jan MLK Holiday How is a modern computer built? Basic 22-Jan Computer architecture architecture and assembly Why organize data? Basic structures for Quiz 1 on material taught in 29-Jan Data structures HW1 organizing data class 1/8 and 1/22 Last day to drop a Monday-only class without a mark of “W” and receive a 30-Jan refund or change to Pass/No Pass or Audit for Session 001 5-Feb Data structures HW2 Trees, Graphs and Traversals 12-Feb More Algorithms/Data Structures, Quiz 2 on material taught in Complexity and Combinatorics Recursion and run-time class 1/29, 2/5 19-Feb Presidents Day Last day to drop a course without a mark of “W” on the transcript 23-Feb (Somewhat) More complicated algorithms Quiz 3 on material taught in 26-Feb Algorithms and programming and simple programming constructs, HW2 class 2/12 compilers Quiz 4 on material taught in 5-Mar Operating systems What is an OS? Why do you need one? HW3 class 2/26 12-Mar Spring Break Midterm on all material 19-Mar Midterm Midterm taught so far. How are networks organized? How is the 26-Mar Computer networks HW3 Internet organized? What is AI? Search, plannning and a quick Quiz 5 on material taught in 2-Apr Artificial intelligence HW4 introduction to machine learning class 3/26 Last day to drop a class with a mark of “W” for Session 001 6-Apr Quiz 6 on material taught in 9-Apr The limits of computation What can (and can't) be computed? class 4/2 Robotics: background and modern Quiz 7 on material taught in 16-Apr Robotics HW4 systems (e.g., self-driving cars) class 4/9 Quiz 8 on material taught in 23-Apr Summary, recap, review Summary, recap, review for final class 4/16 Final on all material covered 4-May Final exam 11 am - 1 pm in SAL 101 2 in the semester

  4. Agenda u Talk about operating systems u Review quizzes 1-3 (midterm studying) u Take quiz 4 3

  5. Operating Systems u What is an OS? Reading: u The kernel, processes and St. Amant Ch. 6 resources u Protection/Isolation/Security u Competing for time u Competing for space 4

  6. The need for an OS Problem Low-level instructions Solution: Algorithm + Executes on Data Structures Pseudocode CPU, Memory, Disk, I/O Compiles Program to 5

  7. The OS as a executive manager Problem s Low-level Low-level Low-level instructions instructions instructions Solution: Executions Algorithm s + managed by Data Structures Operating System Pseudocode CPU, Memory, Disk, I/O Compile Program Program to Program Program 6

  8. What is an Operating System? u An executive manager for the computer u Manages resources v Space (i.e. memory) v Time (i.e. CPU compute time) v Peripherals (i.e. input and output) u OS is a program that starts, runs, pauses, restarts, and ends other programs u (some content from the following slides is courtesy of Mark Redekopp and CS350) 7

  9. Definition • A piece of software that manages a computer’s User App User App User mode resources System System Library Library • What resources need Processes & File managing? Scheduling Systems Kernel Mode – CPU (threads and processes) I/O Drivers Memory & Protocols Translation – Memory (Virtual memory, protection) Processor Network Hardware – I/O (Abstraction, interrupts, DISK Mem. Graphics protection) Management Unit 8

  10. Examples of Operating Systems u Microsoft Family v MSDOS, Windows 3.1 – 98, WindowsNT -> Windows 10 v Predominately x86 (Intel) hardware, some PowerPC, some ARM v FreeDOS u POSIX (UNIX/like) v macOS, FreeBSD, openBSD, netBSD, Solaris, AIX, and others u Run on most processor architectures v iOS v Linux u Little side project of university student u ”UNIX clone” that won the war u 20+ popular distributions u Android: heavily customized Linux and Java on phone/tablet u Others v PlaystationOS, VxWorks 9

  11. 10

  12. 11

  13. Important Vocabulary u Resource v Some part of the computer that programs use: u Memory, CPU, Input/Output devices u Policy v Rules enforced by algorithms that share access to resources u OS Developers (humans) write policies that achieve some set of goals for the operating systems 12

  14. What does an Operating System do? u A bare computer is just hardware u Programs are written to use that hardware, but exclusive use is inefficient u In simple terms, the OS: v Enables more than one program at a time to use the computer hardware v Present computer resources (CPU, disk, I/O) through abstract interfaces to allow sharing v Enforce policies to manage/regulate the sharing of resources 13

  15. Roles • • Referee – Protection against other applications – Enforce fair resource sharing • Why doesn't an infinite loop require a reboot? • Illusionist (Virtualization) – Each program thinks it is running separately – Each program thinks it has full access to computer's resources (or unlimited resources) • Glue – Common services (such as copy/paste) – Files can be read by any application – UI routines for look & feel – Separate applications from hardware • so you don’t need to know which keyboard, disk drive, etc 14

  16. OS Design Criteria u Reliability (and availability) u Security & Privacy u Performance u Portability 15

  17. Reliability and Availably u Reliable systems work properly v Correct (or expected) outputs are generated for a set of inputs v If this is not the case, the system has failed u Examples? u Available systems are available to do work u Available does not imply reliable v System can be available but not reliable (system has bugs, generates wrong results) v System can be reliable but not available u Crash every 5 minutes, but saves results and restarts 5 minutes later 16

  18. Privacy, Security, Isolation u For an OS security means the OS does not run unintended code or get into a compromised state v No virus/malware u OS privacy means programs should not get access to data they should not have v Password keychains, files in other users directories u Security and Privacy require some tradeoffs with performance, which is why OS’s are not 100% secure v Some are better than others! 17

  19. Portability u Many machine types exist: x86, x86_64, PPC, ARM, MIPS u Many different motherboards or hardware platforms exist: server with 8 CPUs 12 PCIe slots to RaspberryPi, to AppleTV, etc. u OS with good portability abstracts these differences into a stable API so programmers don’t notice u Also, can the OS itself be ported to new hardware easily? u Good portability leads to wide adoption v Linux, Windows 18

  20. Performance u What does performance mean? v Lots of computation? v Fluid GUI for game? v Low latency disk for database? u OS balances these with policies v Major axis is throughput vs. response time v Different OS’s are tuned based on use case v DB server has different policies than Windows gaming rig 19

  21. Examples of Policies u Tasks are given priorities; higher priority tasks are handled first u Some kind of tasks are never interrupted u All tasks are equal priority; round-robin u Some tasks can only use part of a disk u Some tasks can use network 20

  22. The kernel u The kernel is the core of an OS u Kernel coordinates other programs u When the computer starts up the kernel is copied from the disk to the memory u Kernel runs until some other program needs to use the CPU u Kernel pauses itself to run other program 21

  23. How memory is used User User Kernel program program Start loaded runs done Free Free Free Memory Memory Memory Free Memory Executing Program Kernel Kernel Kernel 22

  24. Multitasking u One program uses the CPU at a time u OS switches CPU usage (rapidly) u Creates an illusion that all the programs are running at the same time u Changeover from one program to another is called a context switch u Examples of context switching? u Can context switching be good for a program? u Can context switching be good for a CPU? 23

  25. Abstractions: Processes and Resources u Resources u OS doesn’t worry v Space (memory) about what each v Time (CPU) program does v Peripherals (printers etc.) u Instead OS cares about u Process: an executing v What resources does a program process need? v Program counter v How long will it run? v Contents of registers v Allocated memory & v How important is it? contents 24

  26. Protection/Isolation u Other processes have to be prevented from writing to the memory used by the kernel u Crash in one program shouldn’t crash OS or other programs u OS has access to all resources: privileged mode u User programs have restricted access: user mode u When a user program needs access to protected resources it makes a system call (e.g., managing files, accessing a printer) u Principle of least privilege (kernel has highest privilege) 25

  27. Competing for time u Think of the time the CPU spends in chunks or blocks u How can blocks of time be allocated to different processes so that work can be done efficiently? u Policy: rules to enforce process prioritization 26

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend