LKMs:Loadable Kernel Modules

版权声明:This article is a blogger original article, only for study reference, reprint please indicate the source, thank you! https://blog.csdn.net/Rong_Toa/article/details/88045779

Loadable Kernel Modules

  1. ● LKMs (Loadable Kernel Modules)
  2. ● Pre-compiled binary pieces
  3. ● Each piece is called “module”
  4. ● Can be loaded at runtime
  5. ● Extend the functionality of the system
  6. ● Enforce modularity
  7. ○ Easy to develop, debug and maintain
  8. ○ No need to rebuild the kernel
  9. ● Can save memory (load only the necessary)

What are LKMs used for

  1. ● Everything that is not required in the core
  2. ● 6 main categories
  3. ○ Device drivers
  4. ○ File system drivers
  5. ■ Implementation of a specific file system
  6. ○ System calls
  7. ○ Network stack
  8. ■ Interprets a network protocol
  9. ○ TTY line disciplines
  10. ○ Executable interpreters for the supported formats

Character Device Driver

  1. ● Read or Write a byte at a time
  2. ● Accessed by a stream of bytes
  3. ● Usually permit only sequential access
  4. ● Implement: open, close, read, write
  5. ● Similar to regular files
  6. ● Examples:
  7. ○ /dev/console
  8. ○ /dev/ttyS0

Block Device Driver

  1. ● Read or Write block-size multiples
  2. ● Permit random access
  3. ● Accessed in the /dev/
  4. ● File systems can be mount on top
  5. ● Handle I/O operations
  6. ● Differ with the char module in the way the manage data inside the kernel
  7. ● Different interface to the kernel than char modules

Network Drivers

  1. ● Handle any network transaction made
  2. ● Transfer packets of data
  3. ● Independent of a specific protocol
  4. ● Reception and Transmission instead of Read/Write
  5. ● Usually the interface is a hardware device but it can also be software like the loopback
  6. ○ loopback is used to communicate with the servers that run in the same node, debugging etc.
  7. ● They are not mapped to the file system; they are identified by a name

Praktikum Kernel Programming
University of Hamburg
Scientific Computing
Winter semester 2014/2015

猜你喜欢

转载自blog.csdn.net/Rong_Toa/article/details/88045779