Presentation is loading. Please wait.

Presentation is loading. Please wait.

Contact Information Office: 225 Neville Hall Office Hours: Monday and Wednesday 12:00-1:00 and by appointment.

Similar presentations


Presentation on theme: "Contact Information Office: 225 Neville Hall Office Hours: Monday and Wednesday 12:00-1:00 and by appointment."— Presentation transcript:

1 Contact Information Office: 225 Neville Hall Office Hours: Monday and Wednesday 12:00-1:00 and by appointment. E-Mail: dickens@umcs.maine.edudickens@umcs.maine.edu Phone: 581-3967 Textbook: Operating System Concepts, 7 th edition, Silberschatz, Galvin, and Gagne. URL: http://umcs.maine.edu/~dickens/COS431/COS431.htmlhttp://umcs.maine.edu/~dickens/COS431/COS431.html

2 Components of a Computer System A computer system consists of hardware system programs application programs

3 Hardware: Physical Devices: Memory, CPU, I/O devices…. Micro-architecture: Executes machine-level instructions. Hardware or firmware (microcode). Machine language: Hardware and instructions visible to an assembly language program. System Components

4 Components of a Computer System Operating System: Hides complexity of hardware and provides simplified set of instructions (API, Application Program Interface).

5 Components of a Computer System System programs: Generally execute in user mode. (Why?) Command interpreter (shell), compilers, editors, …..

6 So What is an Operating System? It is an extended machine Hides the messy details. Presents user with a virtual machine, easier to use Don’t want to program I/O devices, handle interrupts, etc. It is a resource manager (and scheduler) Each program gets time with the resource E.g., CPU, I/O devices, memory Each program gets space on the resource E.g., Disk space.

7 So What is an Operating System? Control Program Manages the execution of user applications to prevent errors and improper use of system. Program A should not be able to access memory of an unaffiliated program B. No one user should be able to starve OS and/or other users of system resources (e.g., CPU). No user should be able to trash I/O devices (deliberately or by error).

8 Computer Hardware Review Components of a simple personal computer Monitor Bus

9 Special registers: Program counter. Stack pointer. Process Status Word (PSW).

10 CPU and other devices can run concurrently. When device needs attention, it issues an interrupt. Character transferred from keyboard to system buffer. Disk read/write completed. Page fault. User programs generate interrupts when making system calls. Trap instruction. Generally termed software interrupt.

11 Interrupts Operating systems are interrupt-driven. Perform action, such as executing a process, then wait until receives an interrupt. Makes developing an operating system a very complex task. When an interrupt is generated the CPU stops what it is doing and execution is transferred to the appropriate interrupt handler. Addresses of interrupt handlers are found in the interrupt vector. Table of addresses Each device has a particular offset within the table.

12 Interrupts The state of the interrupted computation must be saved before interrupt can be processed. This state is restored when the OS returns from the interrupt handler. Termed a context switch.

13 I/O Devices Each type of device has its own controller that accepts and carries out commands from the operating system. Because each controller is different, manufacturer provides device driver for each operating system it supports. OS talks to device driver.

14 I/O Operation Program makes I/O request (e.g., read/write to/from a file). Device driver loads appropriate controller registers. Controller reads registers and determines the operation requested. Starts data transfer from the device to its local buffer. When completed, generates an interrupt. State of currently executing program is saved. Interrupt handled by the device driver. Device driver returns control to the OS. OS restarts suspended program.

15 (a) Steps in starting an I/O device and getting interrupt (b) How the CPU is interrupted (a)(b)

16 Three I/O Methods Synchronous Asynchronous DMA (Direct Memory Access).

17 Three I/O Methods Synchronous After I/O starts, control returns to user program only upon I/O completion. Wait instruction idles the CPU until the next interrupt Wait loop (contention for memory access). Generally a bad idea.

18 I/O Methods Asynchronous After I/O starts, control returns to user program without waiting for I/O completion. I/O completion signaled by an interrupt. More complicated than synchronous I/O.

19 Two of the I/O Methods Synchronous Asynchronous

20 I/O Methods DMA Used for high-speed I/O devices able to transmit information at close to memory speeds. Device controller transfers blocks of data from buffer storage directly to main memory without CPU intervention. Only one interrupt is generated per block, rather than the one interrupt per byte.

21 I/O Methods Asynchronous I/O requires the ability to handle multiple I/O commands concurrently. Uses device status table. Queue waiting requests.

22 Device-Status Table


Download ppt "Contact Information Office: 225 Neville Hall Office Hours: Monday and Wednesday 12:00-1:00 and by appointment."

Similar presentations


Ads by Google