Introduction & History Ch1 CS 422 T W Bennet Mississippi - - PowerPoint PPT Presentation

introduction history ch1
SMART_READER_LITE
LIVE PREVIEW

Introduction & History Ch1 CS 422 T W Bennet Mississippi - - PowerPoint PPT Presentation

Introduction & History Ch1 CS 422 T W Bennet Mississippi Col le ge 1 Two Roles of an Operating System Extended Machine or virtual machine Device drivers, Processes, File systems, Networking protocols. Resource Manager


slide-1
SLIDE 1

Introduction & History Ch1

CS 422 · T W Bennet · Mississippi Col le ge

1

slide-2
SLIDE 2

Two Roles of an Operating System Extended Machine

  • r virtual machine

Device drivers, Processes, File systems, Networking protocols. Resource Manager Allocates and enforces Memory, Disk space, Devices (e.g. printer)

CS 422 · T W Bennet · Mississippi Col le ge

2

slide-3
SLIDE 3

Structure

Hardware Software User mode Kernel mode Operating system Web browser E-mail reader Music player User interface program

CS 422 · T W Bennet · Mississippi Col le ge

3

slide-4
SLIDE 4

History First Gen 1940’s and 1950’s Relays or vacuum tube hardware. Plug board or punch card input. Programmer runs his own program. Reserves time on a paper sign-up sheet. No Operating System

CS 422 · T W Bennet · Mississippi Col le ge

4

slide-5
SLIDE 5

History Problems

  • Scheduling inefficiency.
  • Time wasted mounting tapes and cards.

Result: Low utilization of a very expensive piece of equipment.

CS 422 · T W Bennet · Mississippi Col le ge

5

slide-6
SLIDE 6

History Second Gen: Batch Mainframes Mid-1950’s to Mid-1960’s Transistorized equipment. Punch-card input. Users distinct from the designers and builders. Equipment isolated and controlled by operators. User inputs a stream of jobs, usually on cards.

CS 422 · T W Bennet · Mississippi Col le ge

6

slide-7
SLIDE 7

History Batch Systems

1401 7094 1401 (a) (b) (c) (d) (e) (f) Card reader Tape drive Input tape Output tape System tape Printer

CS 422 · T W Bennet · Mississippi Col le ge

7

slide-8
SLIDE 8

History Third Gen: Multiprocessing Integrated Circuits Multiprogramming Leader: IBM 360. One machine for both scientific and business DP. Multiprogramming: Leverage the mix of I/O and compute-bound jobs. Multiple jobs in memory. Each has its own contiguous region. Spooling: Main machine does its own job input.

CS 422 · T W Bennet · Mississippi Col le ge

8

slide-9
SLIDE 9

History Time-sharing Desire to return to interactive use. Leader: Compatible Time Sharing System (CTSS) MULTICS: A centralized “computing utility.” Advanced the field Not a commercial success Unix: Created by ATT scientists left w/o MULTICS Written on spare minicomputer Very popular in academia and elsewhere BSD and SysV Linux

CS 422 · T W Bennet · Mississippi Col le ge

9

slide-10
SLIDE 10

History Fourth Gen: Personal Computers 1975: Intel 8080 CP/M 1981: IBM PC DOS 1960’s: Douglas Englebert at SRI Xerox PARC GUI Steve Jobs (Apple) visited PARC Lisa Macintosh

CS 422 · T W Bennet · Mississippi Col le ge

10

slide-11
SLIDE 11

History Fourth Gen: Personal Computers MS influenced by Mac Windows Windows 95 Windows 98 Windows ME Windows NT Windows 2000 Windows XP Vista Windows 7 Unix popular on engineering stations Linux occasionally X-Windows

CS 422 · T W Bennet · Mississippi Col le ge

11

slide-12
SLIDE 12

OS Types Mainframe Server Multiprocessor PC Handheld Embedded Sensor Node Smart-Card Real-Time Hard Soft

CS 422 · T W Bennet · Mississippi Col le ge

12

slide-13
SLIDE 13

Hardware Overview Hardware Components CPU Memory Process abstraction I/O Devices Drivers, clean interfaces Storage Devices File system abstraction

CS 422 · T W Bennet · Mississippi Col le ge

13

slide-14
SLIDE 14

Hardware Overview CPUs Traditionally, there is one CPU. Multiple-CPUs used on high-end systems. Muliti-core systems are now the usual. Multithreading (or hyperthreading) makes it faster for the OS to change which program is running.

CS 422 · T W Bennet · Mississippi Col le ge

14

slide-15
SLIDE 15

Hardware Overview CPU Registers Program counter. Stack pointer. General purpose registers. Program Status Word (PSW) Collection of status values and flags. Collectively the CPU state

CS 422 · T W Bennet · Mississippi Col le ge

15

slide-16
SLIDE 16

Hardware Overview I/O I/O operations are slow. CPU must start the operation then wait for completion Polling Loop on a status query Are we there yet? Interrupt-Driven CPU start operation; device interrupts CPU on completion. Direct Memory Access (DMA) A DMA controller batches of I/O operations.

CS 422 · T W Bennet · Mississippi Col le ge

16

slide-17
SLIDE 17

Hardware Overview Interrupts Much like an asynchronous function call. Similar to event handlers in a GUI. Peripheral device signals the CPU. CPU calls the interrupt vector in response. CPU saves its state, runs the vector, then restores the state. Restoring the PC returns to calling point. Avoids the need to poll.

CS 422 · T W Bennet · Mississippi Col le ge

17

slide-18
SLIDE 18

Hardware Overview Traps CPU interrupts itself. Program errors or exceptions. Divide by zero Illegal address Undefined op code etc

CS 422 · T W Bennet · Mississippi Col le ge

18

slide-19
SLIDE 19

O/S-Essential Hardware Hardware Support for the OS Certain hardware features are required to implement a reasonable OS Traps and Interrupts CPU Modes Memory Protection Clock Interrupt

CS 422 · T W Bennet · Mississippi Col le ge

19

slide-20
SLIDE 20

O/S-Essential Hardware Traps and Interrupts Interrupt vectors are part of the O/S. Interrupts give control to the O/S. O/S regains control when I/O completes. O/S Can let other other code run during I/O

CS 422 · T W Bennet · Mississippi Col le ge

20

slide-21
SLIDE 21

O/S-Essential Hardware CPU Modes User and supervisory mode. User code uses user mode OS uses supervisory mode Some instructions forbidden in user mode. Interrupts and syscall change to supervisory. OS switches to user before return. Reserves certain operations for the OS alone.

CS 422 · T W Bennet · Mississippi Col le ge

21

slide-22
SLIDE 22

O/S-Essential Hardware I/O Operations are Privileged Most I/O operations are forbidden in user mode. Gives O/S exclusive control over disk operations. A user programs must ask the OS to perform IO for it. Keeps user code from violating file permissions.

CS 422 · T W Bennet · Mississippi Col le ge

22

slide-23
SLIDE 23

O/S-Essential Hardware Memory Protection In user mode, CPU may access only a portion of the memory. Violations trap Base and limit registers. Segment codes. Virtual memory (ch. 3). Instructions to set or modify protection are privileged. OS sets memory limits, hardware enforces.

CS 422 · T W Bennet · Mississippi Col le ge

23

slide-24
SLIDE 24

O/S-Essential Hardware Clock Interrupt Periodically interrupts the CPU. Setting the interrupt time is privileged. Makes certain the CPU always gets control eventually. Allows O/S to enforce CPU allocation.

CS 422 · T W Bennet · Mississippi Col le ge

24

slide-25
SLIDE 25

System Calls How user software talks to the OS. Syscall instruction is a deliberate trap. Store arguments in a standard place. Push on the stack or store in standard registers Execute the syscall instruction. OS handles the operation and returns.

CS 422 · T W Bennet · Mississippi Col le ge

25

slide-26
SLIDE 26

Operations Performed With System Calls Create a file or directory. Read or write a file. Send or receive a network packet. Create or terminate a process. Anything that requires privileged instructions.

CS 422 · T W Bennet · Mississippi Col le ge

26

slide-27
SLIDE 27

Structure Monolithic Single supervisory-mode kernel provides all O/S services. Layered Kernel is build in layers each provided additional services to those above. Micro-kernel Minimal supervisory-mode kernel

CS 422 · T W Bennet · Mississippi Col le ge

27

slide-28
SLIDE 28

Linux Layered Kernel

System calls Interrupts Dispatcher Virtual file system

Terminals Sockets File systems Network protocols Network device drivers Block device drivers Character device drivers I/O scheduler Generic block layer

Line discipline

Page cache Paging page replacement Virtual memory Signal handling Process/thread creation & termination CPU scheduling I/O component Memory mgt component Process mgt component

CS 422 · T W Bennet · Mississippi Col le ge

28

slide-29
SLIDE 29

Micro-kernels

User mode Microkernel handles interrupts, processes, scheduling, IPC Sys Clock FS Proc. Reinc. Other ... Servers Disk TTY Netw Print Other ... Drivers Shell Make ... Process User progs. Other

CS 422 · T W Bennet · Mississippi Col le ge

29

slide-30
SLIDE 30

Micro-kernels Clean, extensible design. Message-passing easily distributed. Has not been commercially successful for performance reasons.

CS 422 · T W Bennet · Mississippi Col le ge

30

slide-31
SLIDE 31

Virtual Machines VM layer divides the resources to provide exact, shrunken copies of the hardware

I/O instructions here Trap here Trap here System calls here Virtual 370s CMS CMS CMS VM/370 370 Bare hardware

DOS mode under Windows

CS 422 · T W Bennet · Mississippi Col le ge

31

slide-32
SLIDE 32

Two Types Type 1: VM runs on the hardware. Used by IBM in the 70s. Type 2: VM runs on an OS VMWare, Virtual Box, Virtual PC

Type 1 hypervisor Host operating system (a) (b) ... Linux Windows Excel Word Mplayer Apollon Type 2 hypervisor Guest OS Guest Host OS process OS process

CS 422 · T W Bennet · Mississippi Col le ge

32

slide-33
SLIDE 33

IBM Had It Easier VM must run in user mode and simulate privileged instructions. Easiest of the instructions cause traps. Pentium class machines tend to ignore privileged instructions. Pentium VMs have to do more simulation. Current generations translate binary by block.

CS 422 · T W Bennet · Mississippi Col le ge

33

slide-34
SLIDE 34

Sources Tanenbaum, Modern Operating Systems (Course textbook.)

CS 422 · T W Bennet · Mississippi Col le ge

34