Device Drivers
See Drivers
What is it?
I/O synchronization ensures that data is read from and written to devices or storage systems in a controlled and orderly manner. It ensures that concurrent processes do not interfere with each other’s I/O operations.
Makes two entities with different views of time interact.
I.G: SYNCRHONOUS = CLOCKED = COMMON VIEW OF TIME
Device Drivers
See Drivers
Active Synchronization
DO SOMETHING NOW. Forcing a change.
Passive Synchronization
Request-oriented, like polling. Like a waiter in a restaurant. Requesting a service.
CPU and Device Latency
The time between the receipt of a service request and the initiation of service. Can involve hjardware and software.
Real Time System
A system that guarantees a worst-case latency for critical events.
Latency
The delay between the arrival of the request and completion of a service. One could also consider the average latency or the maximum latency by considering more results.
Throughput
A measure of how many items can be processed per unit of time
Mechanisms
Blind Cycle: Software waits for some amount of time and then acts on data irregardless if the device is ready.
Occasional Polling: Device is checked at the convenience of the designer (code), poll based on when it is convenient for your workflow (using if statements).
I/O is from the perspective of the CPU
Periodic Polling: Device status is checked after a pre-determined amount of time and repeats. Usually done with a timer interrupt.
Tight Polling Loop: Software continuously checks the I/O status waiting for the device to be done. This is continuously testing one status register and looping until a condition is met (or multiple).
Interrupt Handling: Device generates a hardware interrupt to request service immediately.
Performance
Blind, Occasional, and Periodic and CPU-oriented because these methods give priority to the CPU and wait for the CPU to initiate synchronization.
Tight polling and Interrupt handling are device-oriented because the device demands immediate service to reduce latency.
Reading Data
Writing Data
Optimistic Option: Assume the device is initially ready
Conservative Option: Assume the device is not initially ready
Interrupt Synchronization
- Device notifies the CPU that an interrupt happens (CPU Notification)
- CPU completes execution of current instruction
- Execution of main program is suspended
- Interrupts are disabled
- Registers are saved
- Device may be acknowledged
- ISR is selected (ISR Selection)
- ISR is executed (Interrupt Service Routines)
- Registers are restored (including PC if required)
- Interrupts are enabled
- Execution of main resumes