Device Drivers and Linux Architecture

Device driver is a computer program that controls a particular device that is connected to the system be it printers, CD-ROM readers etc. Before we go into device drivers, let us get a brief of the Linux architecture. The Linux virtual memory is divided into two partitions namely user space and kernel space to protect data and functionality from fault or any unwanted access. The following picture gives a basic understanding of Linux architecture.

Architecture of Linux OS (Source: www.ibm.com)

User space is the memory space where user applications run whereas Kernel space is the privilege space where operating system (kernel) executes and provides its services.

The GNU C library (glibc) provides APIs (Application Programming Interfaces) that interact with the kernel through system calls (syscalls). For example, when we call printf() in our C program, it internally calls the write() syscall. So, the System Call Interface (SCI) acts as a medium between the user space and kernel space. Kernel is the core of the operating system that loads first and remains in the main memory. It is responsible for memory management, process management, virtual file system and network stack. Following picture illustrates the Linux Kernel Subsystems.

Linux Kernel Subsystems (Source: www.ibm.com)

Process management is focused on the management and execution of processes (called threads in kernel). Threads represent an individual virtualization of the processor (i.e. each thread has its own thread code, data, stack, and CPU registers). However, in user space, the term process is typically used. The kernel provides APIs through the SCI to create a new process (fork, exec, or Portable Operating System Interface [POSIX] functions), stop a process (kill, exit), and communicate and synchronize between them (signal, or POSIX mechanisms).

Memory manager allows multiple processes to securely share the main memory. Also, it supports virtual memory that allows Linux to run processes that require more memory than available with the system.

Network Stack provides the capabilities to access several networking standards and networking hardware.

VFS provides a common file system for all devices to abstract the details of various hardware devices and supports many file systems that are compatible with other operating systems as well.

(Next Article…)

Gautam Vashisht

Leave a Reply

Your email address will not be published. Required fields are marked *