Linux Device Handling Flashcards
(16 cards)
Character Device
Device where data is read and written in streams and only with characters.
Character devices don’t have a fixed size.
A common example is a printer directly attached to the computer
Pipe devices
Devices that have the same characteristics as character devices (unknown size, read/write characters to streams) but are connected to another process instead of a kernel driver trying to communicate with physical hardware.
Socket devices
Devices used for inter process communication.
TODO STUB
Block device
Device where the data is accessed in fixed chunks or blocks such as hard drives.
Block devices always have a fixed, known size.
udevadm command
Command line utility to control and configure runtime behavior of udev
dd command
Utility application to read and write to a file/stream and possibly do some conversions
/dev/zero
A special pseudo file that provides an infinite stream of null characters.
It is often used for creating files or memory pages filled with only zeroes, often when the user wants an empty file but of a specific size.
Used in conjunction with the “dd” command
/dev/null
A special pseudo file that provides a stream that immediately discards any data sent to it.
It is often used to discard any unwanted data such as log output from an application.
What does the “sd” in /dev/sda1 stand for?
SCSI disk (Small Computer System Interface).
Although SCSI hardware is no longer being used, the protocol is still being used for its adaptability.
What type of device do /dev/sr* represent?
CD and DVD drives
What type of devices are /dev/tty, /dev/pts/ and /dev/tty?
Terminal devices which are responsible for moving characters from a user process to an I/O device.
Reading from the /dev/tty actually captures output to the screen (i.e. your monitor) and copying to the directory outputs to the screen.
Decades ago, terminals were actual hardware I/O devices.
pseudoterminals
Abstractions of /dev/tty but instead of outputting/capturing to/from an I/O device like a screen, it allows for the capture and sending of data to virtual I/O hardware like xterm/gnome-terminal/iTerm etc.
They are listed as character files in /dev/pts/*
What is the libata library?
A library that translates SCSI commands into ATA commands (for CD/DVD drives) and a full command substitution for SATA drives
What is the use of a generic SCSI device?
To do operations on the device that are too heavy or unnecessary to be implemented in the kernel such as writing to a CD/DVD.
The generic device is then used to bypass the kernel and interact with the device directly using SCSI commands.
What type of device does /dev/sg* represent?
Generic SCSI devices
lsscsi command
Lists info on SCSI devices and all their attributes