750 likes | 765 Views
This chapter provides an introduction to operating systems, including their history, categories, and concepts. It also covers the structure of an operating system and the role it plays in managing computer hardware and resources. The chapter explores the evolution of operating systems through generations and highlights key advancements in the field.
E N D
Outline • What is an operating system? • History of operating systems • Categories of operating systems • Computer hardware review • Operating system concepts • System calls • Operating system structure
Computer As A Complex System • Many resources • Hardware: processors, memory, disks, printers, keyboard, display, network interfaces, … • Software: office tools, multimedia players, … • Many tasks • Surfing web, handling emails, solving equations, playing music, … • Many users • Playing with computer should be easy
Read From Diskette … • Basic commands: read and write • 13 parameters, packed into 9 bytes • Controller chips • 23 status and error field • Motor switch: on/off • Don’t leave motor on too long! • Do you want to program the hardware directly? • A simpler interface is needed!
Why A Simple Interface Possible? • Many tedious details can be handled by default • They are out of the user’s interest • Only some key features are important • Examples: file name, length of the file, etc • A simple interface • Present key features to programmer • Hide many tedious details • Meet requirements from many programs
OS As An Extended Machine • Extended machine/virtual machine • Easier to program than the underlying hardware • Provide a variety of services (system calls) • Trade-off • Higher efficiency in program development and system management • Less efficiency in program execution
Programs Without Coordination • Three programs want to output to a printer • A chaos if no coordination • How to coordinate? • Buffer outputs on disk • Copy complete outputs to printer one by one • Do you want to coordinate everything in a computer system? • A resource manager is needed!
OS As A Resource Manager • Multiplexing (sharing) resources • In time • Users/programs take turns using resources • CPU, printers, etc. • In space • Users/programs get parts of resources • Main memory, disk, etc. • Issues about a good manager • Fairness, efficiency, protection, …
What Is An Operating System? Provide user programs with a simpler interface Manage resources
Outline • What is an operating system? • History of operating systems • Categories of operating systems • Computer hardware review • Operating system concepts • System calls • Operating system structure
History of Operating Systems • OS and architecture of computers • Computer evolves so does OS • To provide better service OS has impact on computer design • Keep evolving through years • Four generations so far
The First Generation Computer • Vacuum tubes and plugboards • 1944-1955 • Applications: • Straightforward numerical calculations • Scenario • Single group of people designed, built, programmed, operated and maintained a machine • All in absolute machine language • No operating system • The people maintaining the computers are OS?!
The Second Generation OS • Transistors and batch systems • 1955-1965 • Applications • Scientific and engineering calculation IBM 1401 IBM 7094 IBM 1401 Do computing Print out Read batch of jobs onto tape Cards from programmers Input tape Output tape
Ancestor of Today’s OS • Scenario: batch systems • Fortran • Operating system • Read a job from tape run the job write output onto a second tape • Load next job • Examples: • FMS, IBSYS
The Third Generation OS • Features: ICs and multiprogramming • 1965-1980 • Applications • Numerical calculations in science & engineering • Word-oriented, large-scale scientific computers • Massive commercial data processing • Character-oriented, commercial computers • Can we solve both problems at a single stroke?
System/360 and OS/360 • One family • A series of software-compatible machines • Different only in price and performance • Capable of both scientific & commercial apps • Problems • Dinosaurs: huge operating systems • Millions of instructions, thousands of developers
Key Advances in 3rd Gen OS • Multiprogramming • Run job 2 while job 1 waiting for I/O • Keep CPU busy • Spooling • Read job from cards to disk asap • Load new jobs from disk whenever old job done • Time sharing • CPU is allocated in turn
Milestones • IBM OS/360 • M.I.T. CTSS • M.I.T. MULTICS • Ken Thompson UNIX • AT&T UNIX System V • UC Berkeley UNIX BSD • IEEE POSIX • Andrew S. Tanenbaum MINIX • Linus Torvalds Linux
The Fourth Generation OS • Personal computers • 1980-now • An individual has her own computer • Milestones • Kildall CP/M for Intel 8080, Z80 • MS-DOS/BASIC for IBM PC • Engelbart GUI • MS Windows, Windows NT • UNIX X Windows • Network & distributed operating systems
Outline • What is an operating system? • History of operating systems • Categories of operating systems • Computer hardware review • Operating system concepts • System calls • Operating system structure
Categories of Operating Systems • Mainframe operating systems • Server operating systems • Multiprocessor operating systems • Personal computer operating systems • Real-time operating systems • Embedded operating systems • Smart card operating systems
Mainframe Operating Systems • Why mainframe computers • Strong I/O capability, e.g., 1000 disks, TB space • High-end servers • Features of OS • Batch • Transaction processing • Timesharing • Example: IBM OS/390
Server Operating Systems • Hardware platforms • Very large personal computers or workstations • Services • Printing • File accessing • Web • Examples • UNIX, Windows 2000, Linux
Multiprocessor Operating Systems • Multiple CPUs within a single system • Parallel computers: loosely coupled • Multi-computers: tightly coupled • Multiprocessors: share memory • Features of OS • Communications and connectivity • Variations of the server operating systems
Personal Computer OS • Good interface to a single user • Word processing, spreadsheets, internet access, … • Examples • Windows 98, Windows 2000 • Macintosh operating system • Linux
Real-time Operating Systems • Having time as a key parameter • Industrial process control systems • Hard/soft real-time systems • Hard real-time system: actions absolutely must occur at a certain moment • Robot at an assembly line • Soft real-time system: missing an occasional deadline is acceptable • Digital audio or multimedia systems
Embedded Operating Systems • Very small computers • Palmtop/PDA • Device controllers • Features of OS • Kind of real-time systems • Restrictions in size, memory, power, … • Example: PalmOS, Windows CE
Smart Card Operating Systems • CPU chips on credit card-sized devices • Proprietary systems • Features • Java oriented • Multiprogramming for Java applets • Resource management and protection
Outline • What is an operating system? • History of operating systems • Categories of operating systems • Computer hardware review • Operating system concepts • System calls • Operating system structure
Components of a Computer • System bus: connect all components Floppy disk driver Hard disk driver Monitor Keyboard Floppy disk controller Video controller Keyboard controller Hard disk controller CPU Memory Bus
CPU • Registers • General registers • Program counter: pointer to next instruction • Stack pointer: to the top of current memory • PSW: condition code bits • Basic model • Fetching instruction decoding executing • Execution image: a snapshot of registers
Pipeline and Superscalar • Pipeline: overlap instruction execution • Superscalar: multiple execution units I1 Fetch unit Decode unit Execute unit I2 I3 Execute unit Fetch unit Decode unit Holding buffer Execute unit Fetch unit Decode unit Execute unit
System Calls • Two modes in CPU • Kernel mode: full capability • User mode: disallow I/O, memory protection • System calls: get OS service for user program • Traps: OS gets control • TRAP instruction switches from user mode to kernel mode and starts OS • When the work done, control is returned to user program
Nonvolatile RAM • ROM • Programmed once, cannot be changed afterward • Fast and inexpensive • Boot strap loader, fixed programs • EEPROM and flash RAM • Rewritable • CMOS • Volatile, one battery lasts for several years
Memory Management • Hold multiple programs in main memory • Improve CPU utilization • Problems • Protection • Program A is not allowed to fetch data within program B • Relocation • Each program starts from logical address 0 • How to load and allocate them into main memory?
Base/limit Registers 0xFFFFFFF • Base register • Point to the start of a program • Its content is added to every program address • Limit register • Record the size of program + data • Limit of addresses • Virtual address physical address • Base = 4096, limit = 6114 • Virtual addr = 2000 physical addr = 6096 < limit, legal! • MMU: memory management unit Limit Base 0
Split Program and Data Registers when running program 2 Registers when running program 1 • Why: multiple users may run a same program • How: base/limit registers for program and data, respectively • Overhead of switching: context switch Limit-2 Base-2 Limit-1 Base-1 Limit-1 Limit-2 Base-1 Base-2
I/O Devices • Controller: physically controls the devices • Devices are diverse and complicated • Device driver: software talks to a controller • Depends on operating systems • Installation of drivers • Relink kernel with new driver, reboot • Register driver in system file, reboot • Install on-the-fly, NO reboot Operating system driver controller device
I/O by Interrupt • Driver programs controller by writing its device registers. Controller starts device • Controller finishes reading/writing, and then signals the interrupt controller • If interrupt controller can accept the interrupt, it informs CPU • Interrupt controller puts the number of device on the bus, CPU read it Disk drive CPU Interrupt controller Disk controller 3 4 1 2
Interrupt Processing 3. Return 1. Interrupt 2. Dispatch to handler
Advanced Computer With Multiple Buses Cache bus Local bus Memory bus Level 2 cache PCI bridge Main memory CPU PCI bus USB bus IDE bus Available PCI slot SCSI USB ISA bridge Graphics adaptor IDE disk Mouse Keyboard Monitor SCSI bus ISA bus Available ISA slot Modem Sound card Printer
Plug and Play • Problems without plug and play • Each I/O card has a fixed interrupt level/address • When new card comes conflict level/address • Use switches/jumpers to select good level/address more than an art • How plug and play • System collects info/assign level/address for I/O devices • BIOS does major work
Warm-up • Operating system = extended (virtual) machine + resource manager • Hardware evolving operating system evolving • 4 generations • Various hardware platform various OS • Important components of a computer • CPU, bus, memory, I/O
Outline • What is an operating system? • History of operating systems • Categories of operating systems • Computer hardware review • Operating system concepts • System calls • Operating system structure
Process • A program in execution • Address space: a list of memory locations the process can read/write • Registers, e.g., PC, SP, … • Examples • Two processes running two programs: Word, Excel • Two processes running the same program: multiple web-browsers in a PC
Information About Processes • Process table in operating systems • Registers, etc. • Core image: suspended process address space • Process information = Process table entry + core image
Process Management System Calls • Create a new (child) process • Process tree • Interprocess communication • Communication • Synchronization • Request/release memory • Alarm signal • E.g., remote communication A B C D E F