Drivers Flashcards

1
Q

What do device drivers do?

A

Exchange high-level messages with userspace.

Communication with hardware via low-level instructions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What high-level messages fo drivers exchange with userspace?

A

Specific system calls.

IO Control mechanisms

File and memory mapped regions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What do drivers communicate with HW?

A

HW devices send messages via HW interrupts

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are the elements of a modern device drive?

A

Userspace should not talk to hardware directly. Device drivers are parts of the kernel which do this, proving an interface for userspace processes to access HW functionality.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Why would you move drivers to userspace?

A

Driver crash will not crash the system (Microkernel approach)

However there is a trade-off between protection and performance.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How are devices controlled?

A

By changing the values of their registers, called I/O registers.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is memory-mapped I/O and how does it work?

A

Map registers into memory address region, controllers listen for specific addresses on address bus. Controlling devices amounts to writing to memory.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is port-mapped I/O and how does it work?

A

Seperate instructions for writing to I/O registers, using port number and value as parameters.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What are the UNIX device types?

A
  • Character devices
  • Block devices
  • Network devices
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What are the elements of a character device? (UNIX)

A

Direct, unbuffered access

Used for real-time devices: Sound, graphics, printing

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What are the elements of a block device? (UNIX)

A
Buffered access (read/write blocks of arbitrary size)
Used for storage
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What are the elements of a network device? (UNIX)

A

Packet-based, use specific system calls

Built on top of socket abstraction

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How does UNIX treat devices?

A

Same as files. Communication with the driver is by reading/writing to the files in /dev

Init and exit can be used to load/unload modules.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

How can you create a device file? (UNIX)

A

Manually (mknod) or automatically.

name follows convention:
Disk drive: hdX, sdX, fdX
Terminals: ttyX
ports: parport, lp, ttyS

major number identifies drive, minor number identifies particular device of this type.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

How can actions that are driver specific be executed?

A

ioctl syscall, userspace programs must understand some HW detail.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What are the foundations of windows drivers?

A

User Mode Device Framework (UMDF)

Kernel Mode Device Framework (KMDF)

Also accessed as files from userspace.

17
Q

What does UMDF do?

A

Unprivileged code running in userspace.

Communicates with kernel by exchanging messages.

18
Q

What does KMDF do?

A

Leverages existing implementations of tricky functionality.

19
Q

What are the classes of drivers? (Windows)

A

Direct I/O, buffered I/O and neither.