In the article on the Linux System file type classification we mentioned the block device and the character device file, then what is the block device character device file? What are the fundamental differences between them?
The device files are divided into blocks (block) device Driver and Character (characters) device drive two classes. Character Device Drive is also known as a character device or bare device raw devices. block device driver is referred to as a chunk.
Difference:
Block Device Driver transmits transfer data at a fixed size length, Character device Driver transmits data in an indefinite length of characters. And the connected devices are also different.
Block devices are roughly a device that can randomly access (random access) data, such as a hard drive (hard disk) or a CD-ROM machine, while the character device, in contrast, follows the equipment that accesses the data in the first order, such as a printer (laser), a terminal (listed as Computer monitors).
The/dev/dsk corresponds to a block device, which is used for file system operations, such as Mount.
/dev/rdsk corresponding to the character device (bare device, Rdsk R is Raw), fsck NEWFS, etc. will be involved. In general, our operating system and various software are read and write the hard disk in block mode, where the block is a logical block, the creation of a file system can be selected.
Windows called clusters. Can see the Manual of Newfs or MKFS. Oracle is a more common character way to read and write hard disks.
The definition of a character device or block device belongs to the device access layer of the operating system and is not necessarily associated with the characteristics of the actual physical device. The device access layer below is the driver, so as long as the driver can provide which way, all can. That is, the driver supports stream mode, so it can be accessed in this way.
If the driver also supports block mode, you can access it in any way you want.
1: Typical, such as a hard disk-based bare device (block device), his two access methods are supported: He is a certain structure of the random access device , the reading and writing of this device is block-based, he makes
Buffer to hold the temporary data, waiting for the condition to mature, from the cache once written to the device or from the device to read out once into the buffer;
: 2: Disk and file system character devices (Character device): This is a sequential data flow device that reads and writes to this device by character,
And these characters are continuously forming a data stream. He does not have buffers, so the reading and writing of such devices is real-time, such as terminals, tape drives and so on.
Devices in the system that can randomly (and do not need to sequentially) access fixed-size data slices (chunks) are called block devices. These pieces of data are called blocks. The most common block devices are hard disks, and in addition, there are many other block devices, such as floppy drives, CD-ROM drives, flash memory, and so on.
Note that they are all used in a way that installs the file system-a common way for block devices to access them.
The essential difference between a block device file and a character device file in Linux