1 / 67

Advanced Operating Systems

Advanced Operating Systems. Mehdi Naghavi naghavi@iust.ac.ir Winter 1385. Course motivation and goals. Programming computer hardware directly is difficult Operating systems provide a layer between applications and computer hardware (VM)

tal
Download Presentation

Advanced Operating Systems

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Advanced Operating Systems Mehdi Naghavi naghavi@iust.ac.ir Winter 1385

  2. Course motivation and goals • Programming computer hardware directly is difficult • Operating systems provide a layer between applications and computer hardware (VM) • Understanding operating system concepts is essential to many advanced programming tasks

  3. Class outline • Introduction and Overview • Processes and threads • Operating system structures • Memory management • Scheduling • Input/Output • File Systems • Security

  4. Textbook • Andrew S. Tanenbaum. “Operating Systems design and implementation”, 3nd ed., Prentice Hall, 2006. • Abraham Silberschatz, Galvin, and Gagne. “Operating Systems Concepts”, 7nd ed., John Wiley and Sons, 2005 • William Stallings. “Operating Systems”, 4nd ed., Prentice Hall, 2001. • Andrew S. Tanenbaum. “Modern Operating Systems”, 2nd ed., Prentice Hall, 2001. • Andrew S. Tanenbaum. “Distributed Operating Systems”, Prentice Hall.

  5. Mobile Phones, pagers and other similar devices OFF during class Collegians must be Presence in classroom Contact naghavi@iust.ac.ir naghavi@aut.ac.ir Points

  6. Operating Systems Introduction to Operating Systems Mehdi Naghavi naghavi@aut.ac.ir Winter 1385

  7. Overview: • What is an operating system? • Operating systems history • The zoo of modern operating systems • Review of computer hardware • Operating system concepts • System calls • Operating system structure • User interface to the operating system • Anatomy of a system call

  8. IBSYS (IBM 7090) OS/360 (IBM 360) TSS/360 (360 mod 67) Michigan Terminal System CP/CMS & VM 370 MULTICS (GE 645) Alto (Xerox PARC) Pilot (Xerox STAR) CP/M IRIX Solaris MVS VxWorks MACH Apollo DOMAIN Unix (System V & BSD) Apple Mac (v. 1– v. 9) MS-DOS Windows NT, 2000, XP Novell Netware Linux FreeBSD PalmOS PocketPC VxWorks Samples of Operating Systems

  9. Samples of Operating Systems (continue…)

  10. What is an Operating System? • An Operating System is a program that acts as an intermediary/interface between a user of a computer and the computer hardware. • It is an extended machine • Hides the messy details which must be performed • Presents user with a virtual machine, easier to use • It is a resource manager • Each program gets time with the resource • Each program gets space on the resource

  11. The Operating System controls the machine Debugger Compiler User OS Kernel Video Game Hard ware Application App. Editor Operating System … Terminal emulator  Hardware Browser

  12. Static View of System Components … User 1 User 2 User 3 User 4 User n Compiler Editor Database Calculator WP Operating System Hardware

  13. Dynamic View of System Components

  14. End User Programmer Operating- System Designer Layers of a Computer System Application Programs Utilities Operating-System Computer Hardware

  15. History of Operating Systems • 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?

  16. 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

  17. 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

  18. $END $RUN $LOAD $FORTRAN $JOB, 10,6610802, JANE DOE Structure of a typical 2nd generation job Data forprogram FORTRANprogram

  19. 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 Job 3 Job 2 Memorypartitions Job 1 Operatingsystem

  20. CPU Multi tasking • Resource utilization • Multiprogramming, multitasking, and multiple users. • Time sharing. • Response time. Operating System Main Memory Job 1 Task 1 Task 2 Job 2 Job 3

  21. 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

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

  23. Computer Hardware Review • Computer block diagram • Components of a simple personal computer • CPU internals • Memory • Storage pyramid • Disk drive structure • Anatomy of a device request • Structure of a large Pentium system

  24. Keyboard Mouse Scanner Modem Input Unit Computer CPU Monitor Printer Modem Output Unit Control Unit ALU Registers Bank Cache Memory Memory Main Memory RAM ROM Secondary Memory HD FD CD Flash TertiaryMemory Tape

  25. ComputerComponents: Top-Level View • MAR - Memory Address Register • address for next read or write • MBR - Memory Buffer Register • data to be written into memory • receives data read from memory • I/OAR - I/O Address • specifies a particular I/O device • I/OBR - I/O Buffer • exchange of data between an I/O module and the processor

  26. Components of a simple personal computer Outsideworld Videocontroller Hard drivecontroller USBcontroller Networkcontroller CPU Computer internals(inside the “box”) Memory

  27. CPU internals Executeunit Fetchunit Decodeunit Holding buffer Executeunit Fetchunit Decodeunit Executeunit Fetchunit Decodeunit Executeunit (a) A three-stagePipelined CPU (b) ASuperscalar CPU

  28. Memory Address Address 0x0002ffff 0x0002ffff User 2 programand data User 2 data 0x0002d000 Limit2 0x0002b000 0x0002bfff User 1 data Base2 0x00029000 Limit 0x00027fff User 1 programand data Limit1 0x00024fff User program 0x00023000 Base Base1 0x00023000 0x0001dfff 0x0001dfff Operatingsystem Operatingsystem • Single base/limit pair: set for each process • Two base/limit registers: one for program, one for data 0x00000000 0x00000000

  29. Registers Cache (SRAM) Main memory (DRAM) Magnetic disk Magnetic tape Storage pyramid Capacity Access latency < 1 KB 1 ns Better 1 MB 2–5 ns 1 GB 50 ns 200 GB 5 ms > 1 TB 50 sec • 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

  30. Disk drive structure head • 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 sector platter track cylinder surfaces spindle actuator

  31. Anatomy of a device request Instructionn 3 2 Instructionn+1 1: Interrupt CPU 5 Interruptcontroller Diskcontroller Operatingsystem 1 6 4 3: Return Interrupt handler • 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) 2: Process interrupt

  32. Structure of a large Pentium system

  33. Operating system Components • Process Management • Memory Management • File Management • I/O Management • Process Scheduler • Inter Process Communication • Network Unit • Command Interpreter • Security Management

  34. Modern Operating System Structure Application Application Application Shared Runtime Libraries user-mode supervisor-mode System Call Interface memory manager task manager file manager network manager Device Driver Components OS Kernel Hardware

  35. 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 C D E F G

  36. 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” 0x7fffffff Stack Data Data Text 0x00000000

  37. Synchronization and deadlock (b) An Actual deadlock (a) A Potential deadlock

  38. Hierarchical file systems File system for a university department

  39. Mounting • Before mounting, • files on floppy are inaccessible • After mounting floppy on b, • files on floppy are part of file hierarchy

  40. 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 Process Process A B Pipe Two processes connected by a pipe

  41. Types of OS structures • Monolithic system • Layered system • Virtual machine • Exokernel • Client/Server

  42. Monolithic system Mainprocedure ServiceProcedures UtilityProcedures Simple structuring model for a monolithic system

  43. Applications User space Kernel space System call interface Kernel MM PS IPC FS … I/O Net Monolithic system… MM = Memory Manager PS = Processor Scheduler IPC = Inter Process Communication FS = File System I/O = Input/Output manager Net = Network manager

  44. MS-DOS Layer Structure

  45. Layered Operating System

  46. User Layer 5 User Application Layer 4 User space I/O Management Hardware Kernel space Layer 3 Message Interpreter Layer 2 Memory Management Layer 1 Process Scheduling Layer 0 Layered system Structure of the THE operating system

  47. UNIX System Structure

  48. Virtual machine App1 App2 App3 System calls Linux Windows NT FreeBSD I/O instructions CMS (VMW) CMS(VMW) CMS (VMW) Calls to simulate I/O VM/370 “Real” I/O instructions Bare hardware • First widely used in VM/370 with CMS (Conversational Monitor System) • 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

  49. VMware Architecture

  50. The Java Virtual Machine

More Related