Os Intro

Uploaded from authorPOINT Lite
Download as
 PPT
Presentation Description 

No description available

Happy Thanksgiving
What's up on authorSTREAM?
Views: 618
Like it  ( Likes) Dislike it  ( Dislikes)
Added: December 13, 2007 This Presentation is Public 
Presentation Category : Entertainment All Rights Reserved
Presentation Transcript

CS 1550: Introduction to Operating Systems: CS 1550: Introduction to Operating Systems Prof. José Carlos Brustoloni jcb@cs.pitt.edu http://www.cs.pitt.edu/~jcb/


Course motivation and goals: Course motivation and goals Programming computer hardware directly is difficult Operating systems provide a layer between applications and computer hardware: abstract computer hardware details promote portability enable efficient and safe shared use of hardware resources Understanding operating system concepts is essential to many advanced programming tasks In this course, students will gain familiarity and hands-on experience with the main components of modern operating systems


Class outline: Class outline Overview Processes and threads Scheduling Synchronization and deadlock Memory management and protection Inter-process communication File systems Security


Textbooks and course material: Textbooks and course material Andrew S. Tanenbaum. “Modern Operating Systems,” 2nd ed., Prentice Hall, 2001. Slides, assignments, and other course materials will be available at http://www.cs.pitt.edu/courses/1550/ You should check the course’s Web site frequently for announcements


Schedule: Schedule Class: SENSQ 5129 – T H 1:00 p.m. – 2:15 p.m. Instructor: José Brustoloni Recitations: SENSQ 5502 – F 10:00 – 10:50 a.m. or F 11:00 – 11:50 a.m. TA: Matt Craven Attendance is mandatory


Personnel and office hours: Personnel and office hours Instructor: Prof. José Carlos Brustoloni (jcb@cs.pitt.edu) Office hours: SENSQ 6111 – T 2:15 – 4:30 p.m. and H 2:15 – 4:00 p.m. Recitations: Matt Craven (mcraven@cs.pitt.edu Office hours: SENSQ 6059 – MWF 1:00 – 3:00 p.m. Grader: Qinglan Li (qinglan@cs.pitt.edu) Office hours: SENSQ 6803 – MW 9:00 a.m. – 12:00 noon


Grading: Grading 30% First Midterm Exam (Feb. 24) 30% Second Midterm Exam (Apr. 21) 30% Programming Assignments 10% Pop Quizzes Up to 5% extra based on class participation The exams will be held jointly for both sections of the course, in SENSQ 5502, from 8:00 p.m. to 9:30 p.m.


Policies: Policies All your answers to quizzes, exams, and assignments must be your own. Do discuss course materials and assignments with other students at a conceptual level, but: Don’t copy answers from others. Don’t let others copy your answers. Students caught cheating will fail the course. Except in case of documented emergency, there will be no make-up quizzes or exams. Late assignments will be penalized 10% per day (except weekends).


Overview: Chapter 1: 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


What is an operating system?: 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 (e.g. maximize throughput) Give maximum performance to each user (e.g. minimize response time)


Operating system timeline: 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?


First generation: direct input: 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


Second generation: batch systems: 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


Structure of a typical 2nd generation job: Structure of a typical 2nd generation job FORTRAN program Data for program


Spooling: 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 CPU potentially idle if not all I/O at beginning and end of a job


Third generation: multiprogramming: Third generation: multiprogramming Multiple jobs in memory Protected from one another Operating system protected from each job as well Resources (time, hardware) split between jobs Still not interactive User submits job Computer runs it User gets results minutes (hours, days) later Memory partitions


Timesharing: 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


Types of modern operating systems: Types of modern operating systems Mainframe operating systems: MVS Server operating systems: FreeBSD, Solaris Multiprocessor operating systems: Cellular IRIX Personal computer operating systems: Windows XP, Linux PDA operating systems: PalmOS, PocketPC Real-time/embedded operating systems: VxWorks, QNX, Chorus Some operating systems can fit into more than one category


Components of a simple PC: Components of a simple PC Memory Outside world CPU Computer internals (inside the “box”)


CPU internals: Buffer CPU internals Pipelined CPU Superscalar CPU


Memory: Memory User 2 program and data User 1 program and data Operating system Address 0x1dfff 0x23000 0x27fff 0x2b000 0x2ffff 0 Single base/limit pair: set for each process Two base/limit registers: one for program, one for data Base Limit User 2 data User program Operating system User 1 data Base1 Limit2 Limit1 Base2 Address 0x1dfff 0x23000 0x29000 0x2bfff 0x2ffff 0 0x2d000 0x24fff


Storage pyramid: Access latency 1 ns 2–5 ns 50 ns 5 ms 50 sec 1 TB Capacity Storage pyramid 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 Better Better


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


Anatomy of a device request: Anatomy of a device request 5 3 2 6 1 4 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) Instructionn Operating system Instructionn+1 Interrupt handler 1: Interrupt 2: Process interrupt 3: Return


Operating systems concepts: Operating systems concepts Many of these should be familiar to Unix users… Processes (and trees of processes) Synchronization and 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


Processes: Processes Process: program in execution Address space (memory) the program can use State (registers, including program counter & stack pointer) OS keeps track of all processes in a process table Processes can create other processes Process tree tracks these 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 A B E F C D G


Memory image of a Unix process: Memory image of a Unix process Processes have three segments Text: program code Data: program data Statically declared variables Areas allocated by malloc() or new (heap) Stack Automatic variables Procedure call information Address space growth Text: doesn’t grow Data: grows “up” Stack: grows “down” Stack Data Text 0x7fffffff 0 Data


Synchronization and deadlock: Synchronization and deadlock Potential deadlock Actual deadlock


Hierarchical file systems: Root directory bin faculty grads ls ps cp csh Hierarchical file systems amer jcb john jane stuff classes research stuff


Inter-process communication: Inter-process communication Processes may 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


System calls: 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!


Making a system call: Making a system call System call: read(fd,buffer,length) Program pushes arguments, calls library Library sets up trap, calls OS OS handles system call Control returns to library Library returns to user program Return to caller Trap to kernel Trap code in register Increment SP Call read Push arguments Dispatch Sys call handler Kernel space (OS) User space 0 0xffffffff 1 3 9 Library (read call) User code


System calls for files & directories: System calls for files & directories


More system calls: More system calls


A simple shell: A simple shell


Monolithic OS structure: Monolithic OS structure Main procedure Service routines Utility routines


Virtual machines: Virtual machines First widely used in VM/370 with CMS Available today in VMware Allows users to run any x86-based OS on top of Linux or NT “Guest” OS can crash without harming underlying OS Only virtual machine fails—rest of underlying OS is fine “Guest” OS can even use raw hardware Virtual machine keeps things separated Bare hardware Linux VMware Linux App1 App2 App3 VMware VMware Windows NT FreeBSD I/O instructions System calls Calls to simulate I/O “Real” I/O instructions


Microkernels (client-server): Microkernel Client process Process server Terminal server Client process File server Memory server … User mode Kernel mode Microkernels (client-server) Processes (clients and OS servers) don’t share memory Communication via message-passing Separation reduces risk of “byzantine” failures Examples include Mach, QNX, early versions of Windows NT


Metric units: Metric units


Types of operating system: Types of operating system How does a batch operating system differ from a multiprogrammed operating system? Why is multiprogramming useful? Why are multiprogrammed systems much more difficult to implement than are batch systems? What is timesharing? How does it differ from multiprogramming? What is an online system? What is a real-time system? Which systems try to maximize throughput? Which ones try to minimize response time?


What type of operating system would you use: What type of operating system would you use For editing a letter? For controlling a chemical reaction? For processing payroll? In a cellphone? In a toy? For surfing the web? For air traffic control? For a scientific simulation? To play MP3?


Computer architecture: Computer architecture What connects the processor to memory? How does the operating system separate the memory of different processes? What are the components of the storage hierarchy? What is between the processor and I/O devices? What are the components of a disk? What is spooling? What is an interrupt? Why are interrupts useful? What happens to program execution when an interrupt occurs?


OS interaction: OS interaction How does an application interact with the operating system? Does it differ if the operating system is monolithic or a microkernel? What are the steps involved when the operating system is monolithic? What additional steps happen in case of a microkernel?