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

while (not data_available) loop
read data
clear data_available
process data
return

Writing Data

Optimistic Option: Assume the device is initially ready

clear ready_to_output
output data
while ( not ready_to_output) loop
return

Conservative Option: Assume the device is not initially ready

while ( not ready_to_output) loop
clear ready_to_output
output data
return

Interrupt Synchronization

  1. Device notifies the CPU that an interrupt happens (CPU Notification)
  2. CPU completes execution of current instruction
  3. Execution of main program is suspended
  4. Interrupts are disabled
  5. Registers are saved
  6. Device may be acknowledged
  7. ISR is selected (ISR Selection)
  8. ISR is executed (Interrupt Service Routines)
  9. Registers are restored (including PC if required)
  10. Interrupts are enabled
  11. Execution of main resumes

Blind Synchronization (Independant Timing)

See Blind Synchronization

Synchronous Systems (Common Timing)

See Synchronous Systems

Asynchronous Systems (Different Timing)

See Asynchronous Systems