In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces "what is the linux block equipment". In the daily operation, I believe that many people have doubts about what the linux block equipment is. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful for you to answer the doubts about "what is the linux block equipment?" Next, please follow the editor to study!
Linux block device, character device
The definition of character device or block device belongs to the device access layer of the operating system and is not necessarily related to the characteristics of the actual physical device. Below the device access layer is the driver, so it can be done in any way that the driver provides. In other words, if the driver supports stream, it can be accessed in this way. If the driver also supports block, you can access it in any way you want, such as a hard disk bare device, both.
Block device (blockdevice)
Is a random access device with a certain structure, reading and writing to this device is carried out in blocks, it uses buffers to store temporary data, and when the conditions are ripe, write to the device from the cache or read it out from the device and put it into the buffer at once, such as disk and file system, etc.
Character device (Characterdevice): this is a sequential data flow device, reading and writing to such a device is carried out by characters, and these characters continuously form a data stream. It does not have a buffer, so reading and writing to this device is real-time, such as terminals, tape drives, and so on.
Devices in the system that can access fixed-size slices (chunks) randomly (not in order) are called block devices, and these slices are called blocks. The most common block device is the hard disk, in addition to floppy disk drives, CD-ROM drives, flash memory, and many other block devices. Note that they are all used by installing the file system-- this is also the general access method for block devices.
Another basic type of device is a character device. Character devices are accessed in an orderly manner according to the character stream, such as serial ports and keyboards. If a hardware device is accessed as a character stream, it should be classified as a character device; conversely, if a device is accessed randomly (unordered), it belongs to a block device.
The fundamental difference between the two types of linux fast devices is whether they can be accessed randomly-in other words, whether they can jump from one location to another at will when accessing the device. For example, a device like a keyboard provides a data stream, and when you type the string "fox", the keyboard driver returns the three-character data stream in exactly the same order as the input. It doesn't make sense for keyboard drivers to read strings or other characters out of order. So the keyboard is a typical character device, which provides the character stream that the user inputs from the keyboard. Reading the keyboard results in a stream of characters, first "f", then "o", * * "x", and finally the end of the file (EOF). When no one taps the keyboard, the character stream is empty. The situation with hard disk devices is different. The driver of a hard disk device may require reading the contents of any block on the disk, and then turn to read the contents of another block, and the position of the read block on the disk is not necessarily continuous, so the hard disk can be accessed randomly, not by stream, obviously it is a block device.
Kernel management block devices are much more detailed than managing character devices, and the problems that need to be considered and the work done are much more complex than character devices. This is because the character device only needs to control one position-the current location-and the location accessed by the block device must be able to move back and forth between different intervals of the media. So in fact, the kernel does not need to provide a special subsystem to manage character devices, but the management of block devices must have a special subsystem to provide services. Not only because the complexity of the block device is much higher than that of the character device, but also because the block device requires high execution performance; each extra utilization of the hard disk will improve the performance of the whole system, and its effect is much greater than that of the keyboard.
At this point, the study of "what is a linux block device" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.