Device Manager Flashcards
What is the Device Manger?
Monitors every device within the system, ensuring every process gets fair access to these devices. Some tasks include:
- keeps track of devices
- creates virtual files that map onto physical devices
- deals with multiple requests for same devices
- provides syscalls so software can use devices
Layers of Abstraction
Program Code ->
System Call Interface ->
Device Driver ->
Device Controller (memory and registers) ->
Mechanical/Electronic Hardware
Devices Categories
Character vs. block
Sequential vs. random
Shared vs. dedicated
Speed of Operation
Data Direction (read-write, read-only, write-only)
The device driver hides these differences from the kernel.
Character vs. block
Character devices handle data on a character-by-character basis, where each character is treated as a unit of data. Block devices are devices that handle data in fixed-sized blocks.
Sequential vs. random
Sequential devices write data sequentially, whilst random devices write data in any location/order.
Shared vs. dedicated
Shared devices can be accessed by multiple users or processes concurrently, whilst dedicated devices are exclusively assigned to a specific user/process.
Device Drivers
The connection between the operating system and the hardware devices.
Device Buses
PCIe - Peripheral Component Interconnect Express -> general purpose
USB - Universal Series Bus -> general purpose
NVMe - Non-Volatile Memory Express -> flash disks (SSD)
SATA - Serial AT attachment -> mechanical disks (HDD)
Each of these buses have their own protocol and format for sending and receiving data
Peripherals
External devices
System Bus
Used to connect devices buses and CPU, except for interrupts.
Ways of passing Commands and Data to Devices
Memory Mapped I/O -> virtual addresses in main memory are mapped on to device registers, allowing CPU to use its standard instructions to manipulate device registers which look and behave exactly like normal memory.
Port-Mapped I/O -> this is supported by Intel instruction sets, in which devices have a separate address space assigned to the CPU via dedicated pins. This allows in and out instructions to move data between EAX and devices addresses.
Essentially, devices are either assigned specific I/O port addresses, or mapped to main memory addresses.
Scheduling I/O Activities
The device manager schedules I/O activities to maximise system performance. This allows minimal time wasted by moving the HDD read/write head, and prioritise I/O requests. This also ensures disk access is shared equally between processes.
I/O Wait Queue and Scheduling Algorithms
Each disk has an I/O wait queue, which can be reordered depending on policy:
- first come first served
- shortest seek first
- elevator algorithm
- completely fair queueing
- anticipatory scheduling
Completely Fair Queueing
Requests are serviced via time slices according to priority values of the processes.
Anticipatory Scheduling
Essentially, AS takes a few milliseconds to anticipate the next I/O request a process is going to make based upon it historical I/O behaviour, grouping together I/O requests that are likely to be issued by the same process in the queue. So overall, we have a queue with groups of I/O requests which, by guesswork, should belong to different processes respectively.