cmps 111 introduction to operating systems
play

CMPS 111: Introduction to Operating Systems Professor Scott A. - PowerPoint PPT Presentation

CMPS 111: Introduction to Operating Systems Professor Scott A. Brandt sb rand t@cs .ucsc .edu h t tp : / /www.cse .ucsc .edu /~sb randt / 111 Chapter 1 Class outline Introduction, concepts, review & historical


  1. CMPS 111: Introduction to Operating Systems Professor Scott A. Brandt sb rand t@cs .ucsc .edu h t tp : / /www.cse .ucsc .edu /~sb randt / 111 Chapter 1

  2. Class outline � Introduction, concepts, review & historical perspective � Processes � Synchronization � Scheduling � Deadlock � Memory management, address translation, and virtual memory � Operating system management of I/O � File systems � Security & protection � Distributed systems (as time permits) Chapter 1 CMPS 111, UC Santa Cruz 2

  3. Overview: Chapter 1 � What is an operating system, anyway? � Operating systems history � The zoo of modern operating systems � Review of computer hardware � Operating system concepts � Operating system structure � User interface to the operating system � Anatomy of a system call Chapter 1 CMPS 111, UC Santa Cruz 3

  4. What is an operating system? � A program that runs on the “raw” hardware and supports � Resource Abstraction � Resource Sharing � Abstracts and standardizes the interface to the user across different types of hardware � Virtual machine hides the messy details which must be performed � Manages the hardware resources � Each program gets time with the resource � Each program gets space on the resource � May have potentially conflicting goals: � Use hardware efficiently � Give maximum performance to each user Chapter 1 CMPS 111, UC Santa Cruz 4

  5. Operating system timeline � First generation: 1945 – 1955 � Vacuum tubes � Plug boards � Second generation: 1955 – 1965 � Transistors � Batch systems � Third generation: 1965 – 1980 � Integrated circuits � Multiprogramming � Fourth generation: 1980 – present � Large scale integration � Personal computers � Next generation: ??? � Systems connected by high-speed networks? � Wide area resource management? Chapter 1 CMPS 111, UC Santa Cruz 5

  6. First generation: direct input � Run one job at a time � Enter it into the computer (might require rewiring!) � Run it � Record the results � Problem: lots of wasted computer time! � Computer was idle during first and last steps � Computers were very expensive! � Goal: make better use of an expensive commodity: computer time Chapter 1 CMPS 111, UC Santa Cruz 6

  7. Second generation: batch systems � Bring cards to 1401 � Read cards onto input tape � Put input tape on 7094 � Perform the computation, writing results to output tape � Put output tape on 1401, which prints output Chapter 1 CMPS 111, UC Santa Cruz 7

  8. Structure of a typical 2nd generation job Data for $END program $RUN FORTRAN $LOAD program $FORTRAN $JOB, 10,6610802, ETHAN MILLER Chapter 1 CMPS 111, UC Santa Cruz 8

  9. Spooling � Original batch systems used tape drives � Later batch systems used disks for buffering � Operator read cards onto disk attached to the computer � Computer read jobs from disk � Computer wrote job results to disk � Operator directed that job results be printed from disk � Disks enabled simultaneous peripheral operation on- line (spooling) � Computer overlapped I/O of one job with execution of another � Better utilization of the expensive CPU � Still only one job active at any given time Chapter 1 CMPS 111, UC Santa Cruz 9

  10. Third generation: multiprogramming � Multiple jobs in memory � Protected from one another � Operating system protected Job 3 from each job as well � Resources (time, hardware) Job 2 split between jobs Memory Job 1 � Still not interactive partitions � User submits job � Computer runs it Operating � User gets results minutes system (hours, days) later Chapter 1 CMPS 111, UC Santa Cruz 10

  11. Timesharing � Multiprogramming allowed several jobs to be active at one time � Initially used for batch systems � Cheaper hardware terminals -> interactive use � Computer use got much cheaper and easier � No more “priesthood” � Quick turnaround meant quick fixes for problems Chapter 1 CMPS 111, UC Santa Cruz 11

  12. Types of modern operating systems � Mainframe operating systems: MVS � Server operating systems: FreeBSD, Solaris � Multiprocessor operating systems: Cellular IRIX � Personal computer operating systems: Windows, Unix � Real-time operating systems: VxWorks � Embedded operating systems � Smart card operating systems ⇒ Some operating systems can fit into more than one category Chapter 1 CMPS 111, UC Santa Cruz 12

  13. Components of a simple PC Outside world Video Hard drive USB Network controller controller controller controller CPU Computer internals (inside the “box”) Memory Chapter 1 CMPS 111, UC Santa Cruz 13

  14. CPU internals Execute unit Fetch Decode unit unit Execute Fetch Decode Execute Buffer unit unit unit unit Fetch Decode Execute unit unit unit Pipelined CPU Superscalar CPU Chapter 1 CMPS 111, UC Santa Cruz 14

  15. Storage pyramid Capacity Access latency < 1 KB Better Registers 1 ns 1 MB Cache (SRAM) 2–5 ns 256 MB Main memory (DRAM) 50 ns 40 GB Magnetic disk 5 ms > 1 TB Magnetic tape 50 sec Better � Goal: really large memory with very low latency � Latencies are smaller at the top of the hierarchy � Capacities are larger at the bottom of the hierarchy � Solution: move data between levels to create illusion of large memory with low latency Chapter 1 CMPS 111, UC Santa Cruz 15

  16. Disk drive structure head � Data stored on surfaces sector � Up to two surfaces per platter � One or more platters per disk � Data in concentric tracks platter � Tracks broken into sectors track � 256B-1KB per sector � Cylinder: corresponding cylinder tracks on all surfaces � Data read and written by heads surfaces � Actuator moves heads � Heads move in unison spindle actuator Chapter 1 CMPS 111, UC Santa Cruz 16

  17. Memory Address Address 0x2 f f f f 0x2 f f f f User data User program 0x2d000 and data Limit 2 0x2b000 0x2b f f f User data Base 2 0x29000 Limit 0x27 f f f User program Limit 1 0x24 f f f and data User program 0x23000 Base Base 1 0x23000 0x1d f f f 0x1d f f f Operating Operating system system 0 0 � Single base/limit pair: set for each process � Two base/limit registers: one for program, one for data Chapter 1 CMPS 111, UC Santa Cruz 17

  18. Anatomy of a device request Instruction n 3 2 Instruction n+1 1: Interrupt 5 Interrupt Disk CPU controller controller 1 6 4 Operating system 3: Return Interrupt handler 2: Process interrupt � Left: sequence as seen by hardware � Request sent to controller, then to disk � Disk responds, signals disk controller which tells interrupt controller � Interrupt controller notifies CPU � Right: interrupt handling (software point of view) Chapter 1 CMPS 111, UC Santa Cruz 18

  19. Operating systems concepts � Many of these should be familiar to Unix users… � Processes (and trees of processes) � Deadlock � File systems & directory trees � Pipes � We’ll cover all of these in more depth later on, but it’s useful to have some basic definitions now Chapter 1 CMPS 111, UC Santa Cruz 19

  20. Processes Process: program in execution � � Address space (memory) the A program can use � State (registers, including program counter & stack pointer) B C D OS keeps track of all processes in � a process table Processes can create other � processes � Process tree tracks these E F G relationships � A is the root of the tree � A created three child processes: B, C, and D � C created two child processes: E and F � D created one child process: G Chapter 1 CMPS 111, UC Santa Cruz 20

  21. Inside a (Unix) process � Processes have three 0x7fffffff segments Stack � Text: program code � Data: program data � Statically declared variables � Areas allocated by malloc() or new � Stack � Automatic variables Data � Procedure call information Data � Address space growth � Text: doesn’t grow � Data: grows “up” Text � Stack: grows “down” 0 Chapter 1 CMPS 111, UC Santa Cruz 21

  22. Deadlock Actual deadlock Potential deadlock Chapter 1 CMPS 111, UC Santa Cruz 22

  23. Hierarchical file systems Root directory cse bin faculty grads ls ps cp csh elm sbrandt kag amer4 classes research stuff stuff Chapter 1 CMPS 111, UC Santa Cruz 23

  24. Interprocess communication � Processes want to exchange information with each other � Many ways to do this, including � Network � Pipe (special file): A writes into pipe, and B reads from it A B Chapter 1 CMPS 111, UC Santa Cruz 24

  25. System calls � Programs want the OS to perform a service � Access a file � Create a process � Others… � Accomplished by system call � Program passes relevant information to OS � OS performs the service if � The OS is able to do so � The service is permitted for this program at this time � OS checks information passed to make sure it’s OK � Don’t want programs reading data into other programs’ memory! Chapter 1 CMPS 111, UC Santa Cruz 25

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