tailieunhanh - Lecture Operating system concepts - Lecture 3

The objectives of this chapter are to describe the services an operating system provides to users, processes, and other systems; to discuss the various ways of structuring an operating system, to discuss the various ways of structuring an operating system. | CSC 322 Operating Systems Concepts Lecture - 3: by Ahmed Mumtaz Mustehsan Special Thanks To: Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. (Chapter-1) Ahmed Mumtaz Mustehsan, CIIT, Islamabad 1 I/O Devices The I/O devices Interact heavily with the OS. Generally consist of two parts: Controller (Having its own processor) The I/O Device itself. The physical control of the device is with its controller. Controller accepts commands from OS and executes. Controller has its own registers which are used to communicate with the driver Commands are complex and device dependent. Lecture 3 2 Ahmed Mumtaz Mustehsan, CIIT, Islamabad I/O Devices Example: Controller gets a command to read sector x on disk y. it converts the sector address into cylinder no., head no., and sector no. on the track . Moves the arm to correct cylinder position. Waits for the sector to rotate under the head. Reads and store bits coming off the drive. compute checksum. Store the bits by converting . | CSC 322 Operating Systems Concepts Lecture - 3: by Ahmed Mumtaz Mustehsan Special Thanks To: Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. (Chapter-1) Ahmed Mumtaz Mustehsan, CIIT, Islamabad 1 I/O Devices The I/O devices Interact heavily with the OS. Generally consist of two parts: Controller (Having its own processor) The I/O Device itself. The physical control of the device is with its controller. Controller accepts commands from OS and executes. Controller has its own registers which are used to communicate with the driver Commands are complex and device dependent. Lecture 3 2 Ahmed Mumtaz Mustehsan, CIIT, Islamabad I/O Devices Example: Controller gets a command to read sector x on disk y. it converts the sector address into cylinder no., head no., and sector no. on the track . Moves the arm to correct cylinder position. Waits for the sector to rotate under the head. Reads and store bits coming off the drive. compute checksum. Store the bits by converting them to words in the memory Lecture 3 3 Ahmed Mumtaz Mustehsan, CIIT, Islamabad Device Driver Is a software, part of OS; that talks to the controller gives commands and accepts responses. The controller manufacturer supplies the DD for each OS Becomes the part of OS by Re-link, make an entry, or on-the-fly It runs in kernel mode I/O address space either the part of memory address space or separate I/O address space. If separate address space then requires separate instructions to read and write. Three modes of communication 1. Polling 2. Interrupts 3. DMA Lecture 3 4 Ahmed Mumtaz Mustehsan, CIIT, Islamabad I/O by Polling device A user program invoke a system call Transfer control from user space to kernel space. The driver then starts the I/O and sits in a tight loop continuously polling the device to see if it is done (Some bit that indicates that the device is still busy) CPU busy waiting, big use of CPU When the I/O has completed, the driver puts the data where they are needed and .