Home > Hosting > Server

What are the types of devices in the linux system

2022-12-15 22:22:33

<p>The editor in this article will introduce in detail the types of devices in the linux system. The content is detailed, the steps are clear, and the details are handled properly. I hope this article on the types of devices in the linux system can help you solve your doubts. Follow the editor&#39;s instructions below Slowly deepen your thinking, let&#39;s learn new knowledge together.</p><p><br/></p><blockquote><p>The devices in the Linux system are divided into three categories: 1. Character devices are devices that can be accessed like byte streams. Request, the corresponding IO operation occurs immediately; 2, block device, is the device that must be accessed in units of blocks when performing TO operations in the Linux system, and the block device can install the file system; 3, network device, by the network subsystem of Linux The driver is responsible for the sending and receiving of data packets, rather than stream-oriented devices, so there are no nodes for network devices in the Linux system file system.</p></blockquote><p><strong>Devices in the Linux system</strong></p><p>The devices in the Linux system can be divided into three categories: character devices, block devices and network devices.</p><p><strong>(1) Character device</strong></p><p>A character device is a device that can be accessed like a byte stream. When a read or write request is made to a character device, the corresponding The IO operations happen immediately. Many devices in the Linux system are character devices, such as character terminals, serial ports, keyboards, and mice. In the development of embedded Linux, character devices and drivers are the most contacted.</p><p><strong>(2) Block device</strong></p><p>A block device is a device that must be accessed in units of blocks when performing TO operations in the Linux system. Block devices can be installed File system. The block device driver will use a piece of system memory as a buffer, so issuing read and write access to the block device does not necessarily generate hardware I/O operations immediately. Common block devices in Linux systems include hard disks, floppy drives, and so on.</p><p><strong>(3) Network device</strong></p><p>A network device can be a hardware device such as a network card, or a pure software device such as a loopback device. Network devices are driven by the Linux network subsystem, which is responsible for sending and receiving data packets, rather than stream-oriented devices, so there are no nodes for network devices in the Linux system file system. Access to network devices is generated through socket calls, rather than common file operations such as open/closc and read/write.</p><p><strong>The status of the driver in linux</strong></p><p>The driver is the bridge between the device and the user in the Linux system. In the Linux system, access to the device must be through the device driverManual operation, the user program cannot directly operate the device. The relationship between hardware, drivers and user programs in the Linux system is shown in Figure 2.2.</p><p><img src="/uploads/allimg/20221216/1-221216101446393.jpg" alt="下载.jpg"/></p><p>The driver program runs in the kernel space, the user program can only access and operate the hardware through the system call provided by the kernel, and the data transmitted by the hardware device It must go through the driver, VFS and system calls before it can be received by the user program. Therefore, device drivers are bridges and channels for applications to access system devices and transmit data.</p><p><br/></p>


Copyright Description:No reproduction without permission。

Knowledge sharing community for developers。

Let more developers benefit from it。

Help developers share knowledge through the Internet。

Follow us