Article Title: migrate devices from Windows to Linux to control applications. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
Microsoft Windows? And Linux? Operating System Device Control working principle, this article will simplify from Microsoft Windows? To Linux? Migrate device control applications. The author analyzes the differences between the two and provides C/C ++ examples.
If you have developed device control applications on different platforms, you must understand the differences in Device Control Methods between Windows and Linux. It is quite complicated to migrate applications from one platform to another. This article analyzes the device control principles of the two operating systems and explores the differences from architecture to system calls. This article also provides a migration example (written in C/C ++) to illustrate the migration process in detail.
Working conditions:
According to the purpose of this Article, "Windows" refers to Windows 2000 or later versions, and Microsoft Visual C ++ is installed? 6.0 or later versions. Linux should be based on the 2.6 kernel and installed with gnu gcc.
Compare the architecture of Device Control
The Control Methods for Windows and Linux devices are different.
Windows Device Control Architecture
The Windows I/O subsystem associates user applications with device drivers and defines infrastructure support for device drivers. The Device Driver provides an I/O interface for a specific device (see figure 1 ).
Figure 1: Windows Device Control Architecture
During Device Control, I/O operations are encapsulated as IRP (I/O Request Packet ). The I/O manager creates an IRP and sends it to the top of the stack. Then, the device driver obtains the stack address of the IRP. IRP contains the parameters of the I/O Request. Each driver works through a hardware interface based on the request contained by the IRP (such as creating, reading, writing, device I/O control, clearing, or disabling.
Linux Device Control Architecture
The device control architecture of Linux is different. The main difference is that common files, directories, devices, and sockets in Linux are files-everything in Linux is files. To access the device, the Linux kernel maps device operation calls to the device driver through the file system. Linux does not have an I/O manager. All I/O Requests enter the file system from the beginning (see figure 2 ).
Figure 2. Linux Device Control Architecture
[1] [2] [3] [4] Next page