Book Image

Mastering Linux Kernel Development

By : CH Raghav Maruthi
Book Image

Mastering Linux Kernel Development

By: CH Raghav Maruthi

Overview of this book

Mastering Linux Kernel Development looks at the Linux kernel, its internal arrangement and design, and various core subsystems, helping you to gain significant understanding of this open source marvel. You will look at how the Linux kernel, which possesses a kind of collective intelligence thanks to its scores of contributors, remains so elegant owing to its great design. This book also looks at all the key kernel code, core data structures, functions, and macros, giving you a comprehensive foundation of the implementation details of the kernel’s core services and mechanisms. You will also look at the Linux kernel as well-designed software, which gives us insights into software design in general that are easily scalable yet fundamentally strong and safe. By the end of this book, you will have considerable understanding of and appreciation for the Linux kernel.
Table of Contents (19 chapters)
Title Page
About the Author
About the Reviewer
Customer Feedback

Software timers and delay functions

A software timer allows a function to be invoked on expiry of a time duration. There are two types of timers: dynamic timers used by the kernel and interval timers used by the user-space processes. Apart from software timers, there is another type of commonly used timing function called delay functions. Delay functions implement a precise loop, which is executed as per (usually as many times as the) delay function's argument.

Dynamic timers

Dynamic timers can be created and destroyed at any time, hence the name dynamic timers. Dynamic timers are represented by the struct timer_list object, defined in include/linux/timer.h:

structtimer_list{/*        * Every field that changes during normal runtime grouped to the        * same cacheline        */structhlist_nodeentry;unsignedlongexpires;void(*function)(unsignedlong);unsignedlongdata;u32flags;#ifdef CONFIG_LOCKDEPstructlockdep_maplockdep_map;#endif};

All timers in a system are managed by a doubly linked list...