CSE 120 Lecture Notes - Lecture 14: Protected Mode, Linked List, Hash Table

33 views6 pages
Input/Output System
-devices communicate over an “I/O” bus
Issues
Problems: so many different types of I/O devices!
- Wide range: speed, operation, data transfer units, etc.
- Have to take into account NEW devices with new functionality?
Questions
- How does a process “initiate” I/O?
- How is synchronization achieved?
- How is data transferred?
Background: I/O Hardware
CPU and device (controller) communicate via
- I/O instructions - instruction of the ISA designed specifically for I/O
- Memory instructions (“memory-mapped”) - loads/stores
Data transfer:
- Programmed I/O - CPU is involved in moving data from CPU register TO device or vice
versa
- DMA (Direct Memory Address) - CPU “tells” device to move x amount of data to a certain
data area
- Initiates process, and then you take over from there
Synchronization:
- Polling - checking a register, bit, memory, if device is “ready”, and “busy-waits” otherwise
- Interrupts - CPU does not “explicitly” check the device
- Device generates an interrupt for which the CPU then handles it
Buffered and Unbuffered I/O
Buffer - “temporary” holding place for data
Unbuffered - NO temporary holding place!
When is it good to have buffers?
Buffered I/O
-data copied from device INTO a buffer
-goes through process
-process itself might have data copied into the kernel into the buffer
-then goes out to the other device
Unbuffered I/O
-writing from process goes DIRECTLY to the device!
Pros and Cons of buffering
Pros
Unlock document

This preview shows pages 1-2 of the document.
Unlock all 6 pages and 3 million more documents.

Already have an account? Log in
- You can hold the data for the device in the kernel while waiting for “pages” of the
process to show
- A process can write into buffer and can then go and do its own thing!
Cons
- Kernel buffering is expensive (copying memory is expensive)
- Consider effect on caches - hardware caches are filled
- The more you copy data, the more you “exercise” the caches, which can blow
away a lot of needed data!
Dealing w/ Complexity of Devices
Classifying them
- Variable vs fixed-size units
- Sequential vs “random” access
- Sync vs async
- Speed of operation
I/O System - part of the system devoted to I/O
-software that deals w/ I/O
-”mostly” in the kernel
-also in processes (in form of library, stdio for example)
I/O System Structure: Layered
User User I/O (stdio)
_______________________________________________
Kernel Device-Independent I/O, Device drivers
_______________________________________________
Hardware Devices and Device controllers
_______________________________________________
Device Dependent: Device Drivers
-encapsulates “device-dependent” code
-in order for it to interact w/ other parts of the kernel, it implements a standard interface
-open(), close(), read(), write()
-Kernel calls on these functions!
-interrupt handlers (at least 1)
- executes when I/O completes
- updates data structures
- wakes up waiting processes
Ex:
Device driver
- knows how to generate a read in disk memory
Unlock document

This preview shows pages 1-2 of the document.
Unlock all 6 pages and 3 million more documents.

Already have an account? Log in

Get OneClass Notes+

Unlimited access to class notes and textbook notes.

YearlyBest Value
75% OFF
$8 USD/m
Monthly
$30 USD/m
You will be charged $96 USD upfront and auto renewed at the end of each cycle. You may cancel anytime under Payment Settings. For more information, see our Terms and Privacy.
Payments are encrypted using 256-bit SSL. Powered by Stripe.