This summerises device drivers in the operating system
Size: 142.11 KB
Language: en
Added: May 16, 2023
Slides: 23 pages
Slide Content
GROUP 20 Operating Systems NAMES STUDENT_NUMBER REG_NUMBER NSEREKO KAYONGO JULIUS 2100714339 21/U/14339/PS MUTUMBA ROBERT 2100711810 21/U/11810/EVE AMANDA ANN KIRABO 2100704763 21/U/04763/PS ALIDDEKI MULINDWA BRYAN 2100700663 21/U/0663 NANYONGA RAHMAH 2100711530 21/U/11530/PS
DEVICE DRIVERS A device driver is a specialized software that operates a particular computer-connected device offering a software interface to the hardware allows operating systems and other computer applications to access hardware functionalities. The hardware is linked to a computer bus/communication subsystem via which device drivers interact with the device. They are hardware-dependent and operating-system-specific (OS). They offer the interrupt processing essential for any time-dependent asynchronous hardware interface.
A device driver’s primary objective is to allow computers and network hardware components to interface and interact with specific devices. They handle requests made by the kernel concerning a particular type of device. Device drivers define messages and mechanisms through which the computer’s operating system and applications can access the device or make requests for the device. They also handle device responses and messages for delivery to the computer. Device Drivers cont’d
Device Drivers cont’d
How do device drivers handle requests Device drivers receive requests for device access and actions from the Operating System and it’s active applications to their respective hardware devices. Suppose a request comes to read block N. If a driver is idle when the request arrives, it starts carrying out the request immediately. If the driver is already busy with some other request, it places a new request in the queue of the pending request.
Illustration Block N is called the block device and this devices communicate with the driver by sending the entire blocks of data. For example, hard disks.
TYPES OF DEVICE DRIVERS 1. Kernel device drivers Kernel device drivers consist of some generic hardware loaded with the operating system (OS) as part of the OS. They include motherboards, processors, and BIOS. They are invoked and loaded into the random-access memory (RAM) when required. 2. User-mode device drivers User mode device drivers refer to device drivers that users may trigger during a session. When using a system, users may have their own external devices that they bring to use, such as external plug-and-play devices. These devices also require drivers to function. Users can write these drivers to the disk to reduce strain on computer resources.
3. Character drivers Character device drivers provide unstructured access to the hardware. They transfer data to and from devices without using a specific device address. They allow the reading or writing of one byte at a time as a stream of sequential data. 4. Block drivers Block device drivers provide structured access to the hardware. They use file system block-sized buffers from a buffer cache supplied by the kernel to perform I/O. A buffer cache is a memory pool established by the kernel to store frequently accessed blocks via block devices. The buffer cache reduces the amount of I/O queries that need an I/O operation from the device.
5. Original equipment manufacturer (OEM) drivers Device drivers can be categorized as generic or OEM-related. Generic drivers refer to device drivers with their operating software bundled into the OEM hardware. One can use generic drivers with different brands of a particular device type. For instance, Linux works with several generic drivers that function without the need to install any other software manually. 6. Virtual device drivers Virtual device drivers operate in both virtualization and non-virtualization environments. In virtualization environments, these drivers are used to emulate the hardware of the host device. They control or manage the resource hardware of the host device to ensure that both the guest and host device run as expected.
7. BIOS The basic input output system (BIOS) is located in a ROM chip, which ensures that BIOS will be available even when the hard disk is formatted. It performs power-on self-tests (POST) that are required during startup. The BIOS also provides drivers for the basic hardware, such as keyboards and monitors, to ensure that they interface with the operating system to function as intended. 8. Motherboard drivers Motherboard drivers exist within the operating system and enable fundamental computer operations. These drivers comprise applications that allow the keyboard and mouse’s USB devices and I/O ports to work. Some motherboards have drivers that support video and audio.
9. Open-source drivers Open-source drivers refer to drivers that are released under a free and open-source license. For instance, open-source graphic drivers control the output to the display if the display is part of the graphics hardware. The source code for open-source drivers is available to everyone, making software collaborations easier. They are more trustworthy as people can check them for any malicious code.
Applications of Device Drivers Accessing Storage Systems Computer storage systems allow users to store data and make it available on demand. They include external and internal devices such as USB flash drives, hard drives, and network-attached storage. Drivers in storage systems enable them to interact with the computer. This ensures that the computer can access its internal or external storage systems, query their information, and allow data transfer
Applications of Device Drivers ( ctd ) For Input and Output Devices The computer’s OS interacts with device drivers to ensure its hardware functions as expected. Input devices include mice and keyboards, while output devices include display devices such as monitors. Keyboards, mice, and monitors are categorized as plug-and-play devices
Applications of Device Drivers ( ctd ) Control and management of virtual machines When a guest operating system works on a host, it makes function calls to virtual device drivers to access the hardware. In addition, they imitate processor-level occurrences like interrupts and transmit them to the virtual machine.
Applications of Device Drivers ( ctd ) BIOS for booting and hardware support The BIOS performs the POST to ensure that all devices are correctly configured before the computer can resume with the normal booting process. This is an essential part of botting
Applications of Device Drivers ( ctd ) Smooth functioning of peripherals (e.g., printers, keyboards) The device drivers responsible for PnP (Plug and Play) have eased attachment of computer peripherals onto the computer ports. This ensures that a device is configured as soon as it is connected
Steps taken when developing device drivers Know about the hardware. The developer should have an in-depth grasp about the platform’s hardware. Read the device –datasheet to understand relevant terms and definitions. You should know the method through which data is transferred. You should know the software of the device-drivers resides and what bus interface does the hardware use to communicate with the host. In case the primary device is a system on chip then developers should know how the driver interacts with its firmware and command protocols
Steps cont’d 2. Write driver code. In this step, developers are expected to come up with the a working prototype of the preferred hardware then they should start writing the kernel mode driver. If the device is incorrectly designed the driver’s running in the user mode may cause system crash likewise if anything goes wrong with the drivers working in highly privileged settings, operational concerns may occur. Usually, the first functions that you develop for your Device Driver are Load and Unload functions which are invoked when the Operating System Starts and Shuts down respectively. One of the primary duties of the Load/Unload functions is to detect the hardware plugged into the system or not. If the Hardware is plugged in then the Load function is successful if not call unload. Typical ways to detect the hardware are by Device ID specified by the specific Bus (e.g. USB, PCIe, etc.…).
Steps cont’d 3.Initialise the hardware . Once you are able to detect your hardware, the next is to initialize your hardware. The kind of initialization that is needed may vary for each hardware. It may range from just writing to a couple of device registers to all the way, downloading a microcode onto the device, and communicating using proprietary command protocol.
Steps cont’d 4. Control the hardware . The next step is controlling your hardware. Until Step 3, the operation might be a one-time operation when the OS loads, Step 4 might be needed to be performed multiple times after the Operating System is up and running. The developer must know whether the device will simply relay data from one device to another, they should also consider whether the device will be sending data continuously
Steps cont’d 5.Begin data communication with the hardware . Several devices deal with some form of data be it video, audio. Once the device is initialized, the developer can send some stream of data as required. The driver works a as pipeline between the high level application and the low level hardware for data transfer. As noted in step 1 developer should know the protocols of data communication.
Steps cont’d 6.Control data communication . In this step developers need to control data transfer and manage data communication in several situations. When problems arise ,the peripheral devices shouldn’t send the same error message. 7.Test it and debug it . At this point, your driver may be ready for testing, since all the development is done to ensure that is initialized and recognized. Functional tests should be run to ensure that it works as expected.
References https://www.javatpoint.com/device-driver-in-operating-system spiceworks.com/tech/devops/articles/what-is-device-driver/ Advanced OS by Nsereko Julius Kayongo