Presentation is loading. Please wait.

Presentation is loading. Please wait.

Kernel Modules – Introduction CSC/ECE 573, Sections 001 Fall, 2012.

Similar presentations


Presentation on theme: "Kernel Modules – Introduction CSC/ECE 573, Sections 001 Fall, 2012."— Presentation transcript:

1 Kernel Modules – Introduction CSC/ECE 573, Sections 001 Fall, 2012

2 Kernel The “Operating System” System of software that – Sits between hardware and application programs – Provides necessary abstractions – Mediated by system calls Process management Memory management File Systems Device drivers Network (drivers and protocols)

3 Why Kernel? Networking “subsystem” originally implemented as user-space – Code easy to examine and change Later, as part of kernel – Not just device drivers, but protocols as well – Experimentation with common protocols require kernel access – Even if only “probing” or “reading off” Kernel problems – Keeps moving – Device dependent

4 Communicating with Kernel Kernel programs run in separate (and unique) address space – Cannot be swapped out – Does not overlap user space address spaces All kernel programs share address space – Mistakes typically causes kernel to crash – VMs ideal in experimenting with kernel programming /proc filesystem is an elegant interface in UNIX – Dynamically generated files – User-space communication with kernel programs

5 Kernel Modules Linux uses kernel modules – Dynamically load and unload – flexibility – Shares address space – still monolithic – Can be completely new code, and “observer” Linux commands insmod, rmmod, lsmod etc. Callback functions – Initialization and exit – Any other functions Device open or close, for device drivers – Register functions for callback conditions

6 Hooks for Callback Linux provides netfilter that includes “hooks” that callback code can register for Can register kernel modules at hooks – Can pop functionality out to user space, but more efficient in kernel space

7 Packet Processing Packets injected into kernel (from device or from user space) stored in special structures Copying eliminated inside kernel – various kernel operations all operate on this structure General framework for packet processing – transcends specific protocol stack, specific protocol data formats

8 Packet Storage

9

10

11 Summary In Linux, particularly easy to investigate and experiment with network protocols, or build new protocols Powerful enough that real advanced application building is possible


Download ppt "Kernel Modules – Introduction CSC/ECE 573, Sections 001 Fall, 2012."

Similar presentations


Ads by Google