0% found this document useful (0 votes)
58 views15 pages

Linux Driver 1

The document discusses Linux device drivers and the role of the kernel. It explains that a device driver provides access to hardware capabilities without constraints. The kernel has complete control over the system and is responsible for process management, memory management, filesystems, device control, and networking. It interacts with devices through device drivers and allows multiple processes to run concurrently while sharing system resources.

Uploaded by

lakshmi1989
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
58 views15 pages

Linux Driver 1

The document discusses Linux device drivers and the role of the kernel. It explains that a device driver provides access to hardware capabilities without constraints. The kernel has complete control over the system and is responsible for process management, memory management, filesystems, device control, and networking. It interacts with devices through device drivers and allows multiple processes to run concurrently while sharing system resources.

Uploaded by

lakshmi1989
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 15

LINUX DEVICE DRIVERS

OUTLINE
 What is a Device Driver?
 Role of Device Driver

 What is a Kernel?

 The Role of Kernel


 Process Management
 Memory Management
 Filesystems
 Device Control
 Networking
 Three types of Devices
 Character Device
 Block Device
WHAT IS A DEVICE DRIVER?

 A device driver is a code that performs device control


operations specific to the device being addressed.
ROLE OF DEVICE DRIVER

The role of a device driver is to provide mechanism, not


policy.

 Mechanism – What capabilities are to be provided.

 Policy - How those capabilities can be used.

Fundamental Concept : Write Kernel code to access the


hardware, but don't force particular policies on the user.

A driver is flexible, if it offers access to hardware


capabilities without adding constraints.
WHAT IS A KERNEL?

The kernel is a program that constitutes the central core of a


computer operating system. It has complete control over
everything that occurs in the system.

The contents of a kernel vary considerably according to the


operating system, but they include
(1) a scheduler, which determines how the various processes
share the kernel's processing time (including in what order),
(2) a supervisor, which grants use of the computer to each
process when it is scheduled,
(3) an interrupt handler, which handles all requests from the
various hardware devices that compete for the kernel's services,
and
The role of Kernel

1) Process Management

2) Memory Management

3) Filesystems

4) Device Control

5) Networking
Process Management

- The kernel is in charge of creating and destroying processes


and handling their connection to the outside world (input and
output).

- The kernel’s process management activity implements the


abstraction of several processes on top of a CPU.

- Kernel ensures that each process obtains its turn to run on the
processor and that the individual processes do not interfere with
each other by writing to their areas of memory.
Memory Management

- The computer’s memory is a major resource, and the policy


used to deal with it is a critical one for system performance.

- The kernel builds up a virtual addressing space for any and all
processes on top of the limited available resources.

- The different parts of the kernel interact with the memory-


management subsystem through a set of function calls, ranging
from the simple malloc/free pair to much more complex
functionalities.
Filesystems

- The kernel builds a structured filesystem on top of unstructured


hardware, and the resulting file abstraction is heavily used
throughout the whole system.

- Linux supports multiple filesystem types, that is, different ways


of organizing data on the physical medium.

- For example, disks may be formatted with the Linux-standard


ext3 filesystem, the commonly used FAT filesystem or several
others.
Device Control
- Almost every system operation eventually maps to a physical
device.

- With the exception of the processor, memory, and a very few


other entities, any and all device control operations are
performed by code that is specific to the device being addressed.
That code is called a device driver.

- The kernel must have embedded in it a device driver for every


peripheral present on a system, from the hard drive to the
keyboard.
Networking
- Networking must be managed by the operating system, because
most network operations are not specific to a process: incoming
packets are asynchronous events.

- The packets must be collected, identified, and dispatched


before a process takes care of them.

- The system is in charge of delivering data packets across


program and network interfaces, and it must control the
execution of programs according to their network activity.

- All the routing and address resolution issues are implemented


within the kernel.
Three types of devices

- Character Devices

- Block Devices

- Network Interfaces
Character Device
- A character (char) device is one that can be accessed as a
stream of bytes; a char driver is in charge of implementing
this behavior. Such a driver usually implements at least the
open, close, read, and write system calls.

- The only relevant difference between a char device and a


regular file is that you can always move back and forth in
the regular file, whereas most char devices are just data
channels, which you can only access sequentially.
Block Device
- A block device is a device that can host a filesystem.

- A block device can only handle I/O operations that


transfer one or more whole blocks, which are usually 512
bytes (or a larger power of two) bytes in length.

- Linux, allows the application to read and write a block


device like a char device- it permits the transfer of any
number of bytes at a time.

- As a result, block and char devices differ only in the way


data is managed internally by the kernel, and thus in the
kernel/driver software interface.
Network Interfaces
- A network interface is in charge of sending and receiving data
packets, driven by the network subsystem of the kernel, without
knowing how individual transactions map to the actual packets
being transmitted.

- Many network connections are stream-oriented, but network


devices are, usually, designed around the transmission and
receipt of packets.

- A network driver knows nothing about individual


connections; it only handles packets.

- Communication between the kernel and a network device

You might also like