In order to thoroughly understand what makes Linux tick and why it works so well on a wide variety of systems, you need to delve deep into the heart of the kernel. The kernel handles all interactions between the CPU and the external world, and determines which programs will share processor time, in what order. It manages limited memory so well that hundreds of processes can share the system efficiently, and expertly organizes data transfers so that the CPU isn't kept waiting any longer than necessary for the relatively slow disks. The third edition of Understanding the Linux Kernel takes you on a guided tour of the most significant data structures, algorithms, and programming tricks used in the kernel. Probing beyond superficial features, the authors offer valuable insights to people who want to know how things really work inside their machine. Important Intel-specific features are discussed. Relevant segments of code are dissected line by line. But the book covers more than just the functioning of the code; it explains the theoretical underpinnings of why Linux does things the way it does. This edition of the book covers Version 2.6, which has seen significant changes to nearly every kernel subsystem, particularly in the areas of memory management and block devices. The book focuses on the following topics: Memory management, including file buffering, process swapping, and Direct memory Access (DMA) The Virtual Filesystem layer and the Second and Third Extended Filesystems Process creation and scheduling Signals, interrupts, and the essential interfaces to device drivers Timing Synchronization within the kernel Interprocess Communication (IPC) Program execution Understanding the Linux Kernel will acquaint you with all the inner workings of Linux, but it's more than just an academic exercise. You'll learn what conditions bring out Linux's best performance, and you'll see how it meets the challenge of providing good system response during process scheduling, file access, and memory management in a wide variety of environments. This book will help you make the most of your Linux system.
Find an introduction to the architecture, concepts and algorithms of the Linux kernel in Professional Linux Kernel Architecture, a guide to the kernel sources and large number of connections among subsystems. Find an introduction to the relevant structures and functions exported by the kernel to userland, understand the theoretical and conceptual aspects of the Linux kernel and Unix derivatives, and gain a deeper understanding of the kernel. Learn how to reduce the vast amount of information contained in the kernel sources and obtain the skills necessary to understand the kernel sources.
Benvenuti describes the relationship between the Internet's TCP/IP implementation and the Linux Kernel so that programmers and advanced administrators can modify and fine-tune their network environment.
Explore Implementation of core kernel subsystems About This Book Master the design, components, and structures of core kernel subsystems Explore kernel programming interfaces and related algorithms under the hood Completely updated material for the 4.12.10 kernel Who This Book Is For If you are a kernel programmer with a knowledge of kernel APIs and are looking to build a comprehensive understanding, and eager to explore the implementation, of kernel subsystems, this book is for you. It sets out to unravel the underlying details of kernel APIs and data structures, piercing through the complex kernel layers and gives you the edge you need to take your skills to the next level. What You Will Learn Comprehend processes and fles—the core abstraction mechanisms of the Linux kernel that promote effective simplification and dynamism Decipher process scheduling and understand effective capacity utilization under general and real-time dispositions Simplify and learn more about process communication techniques through signals and IPC mechanisms Capture the rudiments of memory by grasping the key concepts and principles of physical and virtual memory management Take a sharp and precise look at all the key aspects of interrupt management and the clock subsystem Understand concurrent execution on SMP platforms through kernel synchronization and locking techniques In Detail 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. Style and approach Each chapter begins with the basic conceptual know-how for a subsystem and extends into the details of its implementation. We use appropriate code excerpts of critical routines and data structures for subsystems.
Unlike some operating systems, Linux doesn’t try to hide the important bits from you—it gives you full control of your computer. But to truly master Linux, you need to understand its internals, like how the system boots, how networking works, and what the kernel actually does. In this completely revised second edition of the perennial best seller How Linux Works, author Brian Ward makes the concepts behind Linux internals accessible to anyone curious about the inner workings of the operating system. Inside, you’ll find the kind of knowledge that normally comes from years of experience doing things the hard way. You’ll learn: * How Linux boots, from boot loaders to init implementations (systemd, Upstart, and System V) * How the kernel manages devices, device drivers, and processes * How networking, interfaces, firewalls, and servers work * How development tools work and relate to shared libraries * How to write effective shell scripts You’ll also explore the kernel and examine key system tasks inside user space, including system calls, input and output, and filesystems. With its combination of background, theory, real-world examples, and patient explanations, How Linux Works will teach you what you need to know to solve pesky problems and take control of your operating system.
Linux Device Drivers
Author: Alessandro Rubini, Jonathan Corbet
Publisher: "O'Reilly Media, Inc."
Nwely updated to include new calls and techniques introduced in Versions 2.2 and 2.4 of the Linux kernel, a definitive resource for those who want to support computer peripherals under the Linux operating system explains how to write a driver for a broad spectrum of devices, including character devices, network interfaces, and block devices. Original. (Intermediate)
Learn to develop customized device drivers for your embedded Linux system About This Book Learn to develop customized Linux device drivers Learn the core concepts of device drivers such as memory management, kernel caching, advanced IRQ management, and so on. Practical experience on the embedded side of Linux Who This Book Is For This book will help anyone who wants to get started with developing their own Linux device drivers for embedded systems. Embedded Linux users will benefit highly from this book. This book covers all about device driver development, from char drivers to network device drivers to memory management. What You Will Learn Use kernel facilities to develop powerful drivers Develop drivers for widely used I2C and SPI devices and use the regmap API Write and support devicetree from within your drivers Program advanced drivers for network and frame buffer devices Delve into the Linux irqdomain API and write interrupt controller drivers Enhance your skills with regulator and PWM frameworks Develop measurement system drivers with IIO framework Get the best from memory management and the DMA subsystem Access and manage GPIO subsystems and develop GPIO controller drivers In Detail Linux kernel is a complex, portable, modular and widely used piece of software, running on around 80% of servers and embedded systems in more than half of devices throughout the World. Device drivers play a critical role in how well a Linux system performs. As Linux has turned out to be one of the most popular operating systems used, the interest in developing proprietary device drivers is also increasing steadily. This book will initially help you understand the basics of drivers as well as prepare for the long journey through the Linux Kernel. This book then covers drivers development based on various Linux subsystems such as memory management, PWM, RTC, IIO, IRQ management, and so on. The book also offers a practical approach on direct memory access and network device drivers. By the end of this book, you will be comfortable with the concept of device driver development and will be in a position to write any device driver from scratch using the latest kernel version (v4.13 at the time of writing this book). Style and approach A set of engaging examples to develop Linux device drivers
Linux Device Drivers
Author: Jonathan Corbet, Alessandro Rubini, Greg Kroah-Hartman
Publisher: "O'Reilly Media, Inc."
Device drivers literally drive everything you're interested in--disks, monitors, keyboards, modems--everything outside the computer chip and memory. And writing device drivers is one of the few areas of programming for the Linux operating system that calls for unique, Linux-specific knowledge. For years now, programmers have relied on the classic Linux Device Drivers from O'Reilly to master this critical subject. Now in its third edition, this bestselling guide provides all the information you'll need to write drivers for a wide range of devices.Over the years the book has helped countless programmers learn: how to support computer peripherals under the Linux operating system how to develop and write software for new hardware under Linux the basics of Linux operation even if they are not expecting to write a driver The new edition of Linux Device Drivers is better than ever. The book covers all the significant changes to Version 2.6 of the Linux kernel, which simplifies many activities, and contains subtle new features that can make a driver both more efficient and more flexible. Readers will find new chapters on important types of drivers not covered previously, such as consoles, USB drivers, and more.Best of all, you don't have to be a kernel hacker to understand and enjoy this book. All you need is an understanding of the C programming language and some background in Unix system calls. And for maximum ease-of-use, the book uses full-featured examples that you can compile and run without special hardware.Today Linux holds fast as the most rapidly growing segment of the computer market and continues to win over enthusiastic adherents in many application areas. With this increasing support, Linux is now absolutely mainstream, and viewed as a solid platform for embedded systems. If you're writing device drivers, you'll want this book. In fact, you'll wonder how drivers are ever written without it.
Linux System Programming
Author: Robert Love
Publisher: "O'Reilly Media, Inc."
Write software that draws directly on services offered by the Linux kernel and core system libraries. With this comprehensive book, Linux kernel contributor Robert Love provides you with a tutorial on Linux system programming, a reference manual on Linux system calls, and an insider’s guide to writing smarter, faster code. Love clearly distinguishes between POSIX standard functions and special services offered only by Linux. With a new chapter on multithreading, this updated and expanded edition provides an in-depth look at Linux from both a theoretical and applied perspective over a wide range of programming topics, including: A Linux kernel, C library, and C compiler overview Basic I/O operations, such as reading from and writing to files Advanced I/O interfaces, memory mappings, and optimization techniques The family of system calls for basic process management Advanced process management, including real-time processes Thread concepts, multithreaded programming, and Pthreads File and directory management Interfaces for allocating memory and optimizing memory access Basic and advanced signal interfaces, and their role on the system Clock management, including POSIX clocks and high-resolution timers
OS X and iOS Kernel Programming combines essential operating system and kernel architecture knowledge with a highly practical approach that will help you write effective kernel-level code. You’ll learn fundamental concepts such as memory management and thread synchronization, as well as the I/O Kit framework. You’ll also learn how to write your own kernel-level extensions, such as device drivers for USB and Thunderbolt devices, including networking, storage and audio drivers. OS X and iOS Kernel Programming provides an incisive and complete introduction to the XNU kernel, which runs iPhones, iPads, iPods, and Mac OS X servers and clients. Then, you’ll expand your horizons to examine Mac OS X and iOS system architecture. Understanding Apple’s operating systems will allow you to write efficient device drivers, such as those covered in the book, using I/O Kit. With OS X and iOS Kernel Programming, you’ll: Discover classical kernel architecture topics such as memory management and thread synchronization Become well-versed in the intricacies of the kernel development process by applying kernel debugging and profiling tools Learn how to deploy your kernel-level projects and how to successfully package them Write code that interacts with hardware devices Examine easy to understand example code that can also be used in your own projects Create network filters Whether you’re a hobbyist, student, or professional engineer, turn to OS X andiOS Kernel Programming and find the knowledge you need to start developing What you’ll learn OS X and iOS common core architecture How to write extremely efficient code by exploiting kernel details Coding kernel-level extensions How to write device drivers How to program the I/O Kit framework Key mobile device topics like power management drivers and video capture modules To understand OS X memory management and threads To parse kernel debug messages and package projects ready for deployment Who this book is for This book is suited for: Intermediate and advanced iPhone and OS X programmers ready for the next step Kernel-level programmers interested in how OS X and iOS function Open source programmers with a background in Linux or BSD, OS X and iOS Programmers interested in application performance System administrators running OS X clusters Table of Contents Operating System Fundamentals Mac OS X and iOS Xcode and the Kernel Development Environment The I/O Kit Framework Interacting with Drivers from Applications Memory Management Synchronisation and Threading USB Drivers PCI and Thunderbolt Power Management Serial Port Drivers Core Audio Network Drivers Storage Drivers and Filesystems User-Space Drivers Debugging and Profiling Advanced Kernel Programming Deployment
The classic guide to UNIX® programming-completely updated! UNIX application programming requires a mastery of system-level services. Making sense of the many functions-more than 1,100 functions in the current UNIX specification-is a daunting task, so for years programmers have turned to Advanced UNIX Programming for its clear, expert advice on how to use the key functions reliably. An enormous number of changes have taken place in the UNIX environment since the landmark first edition. In Advanced UNIX Programming, Second Edition, UNIX pioneer Marc J. Rochkind brings the book fully up to date, with all-new, comprehensive coverage including: POSIX Solaris™ Linux® FreeBSD Darwin, the Mac™ OS X kernel And more than 200 new system calls Rochkind's fully updated classic explains all the UNIX system calls you're likely to need, all in a single volume! Interprocess communication, networking (sockets), pseudo terminals, asynchronous I/O, advanced signals, realtime, and threads Covers the system calls you'll actually use-no need to plow through hundreds of improperly implemented, obsolete, and otherwise unnecessary system calls! Thousands of lines of example code include a Web browser and server, a keystroke recorder/player, and a shell complete with pipelines, redirection, and background processes Emphasis on the practical-ensuring portability, avoiding pitfalls, and much more! Since 1985, the one book to have for mastering UNIX application programming has been Rochkind's Advanced UNIX Programming. Now completely updated, the second edition remains the choice for up-to-the-minute, in-depth coverage of the essential system-level services of the UNIX family of operating systems.
Uncover the secrets of Linux binary analysis with this handy guide About This Book Grasp the intricacies of the ELF binary format of UNIX and Linux Design tools for reverse engineering and binary forensic analysis Insights into UNIX and Linux memory infections, ELF viruses, and binary protection schemes Who This Book Is For If you are a software engineer or reverse engineer and want to learn more about Linux binary analysis, this book will provide you with all you need to implement solutions for binary analysis in areas of security, forensics, and antivirus. This book is great for both security enthusiasts and system level engineers. Some experience with the C programming language and the Linux command line is assumed. What You Will Learn Explore the internal workings of the ELF binary format Discover techniques for UNIX Virus infection and analysis Work with binary hardening and software anti-tamper methods Patch executables and process memory Bypass anti-debugging measures used in malware Perform advanced forensic analysis of binaries Design ELF-related tools in the C language Learn to operate on memory with ptrace In Detail Learning Linux Binary Analysis is packed with knowledge and code that will teach you the inner workings of the ELF format, and the methods used by hackers and security analysts for virus analysis, binary patching, software protection and more. This book will start by taking you through UNIX/Linux object utilities, and will move on to teaching you all about the ELF specimen. You will learn about process tracing, and will explore the different types of Linux and UNIX viruses, and how you can make use of ELF Virus Technology to deal with them. The latter half of the book discusses the usage of Kprobe instrumentation for kernel hacking, code patching, and debugging. You will discover how to detect and disinfect kernel-mode rootkits, and move on to analyze static code. Finally, you will be walked through complex userspace memory infection analysis. This book will lead you into territory that is uncharted even by some experts; right into the world of the computer hacker. Style and approach The material in this book provides detailed insight into the arcane arts of hacking, coding, reverse engineering Linux executables, and dissecting process memory. In the computer security industry these skills are priceless, and scarce. The tutorials are filled with knowledge gained through first hand experience, and are complemented with frequent examples including source code.
Linux Kernel Internals
Author: Michael Beck
Publisher: Addison-Wesley Professional
This book is written for anybody who wants to learn more about Linux. It explains the inner mechanisms of Linux 2.0 from process sceduling to memory management and file systems, and will tell you all you need to know about the structure of the kernel, the heart of the Linux operating system. thoroughly updated to cover Linux 2.0
Linux Kernel in a Nutshell
Author: Greg Kroah-Hartman
Publisher: "O'Reilly Media, Inc."
Presents an overview of kernel configuration and building for version 2.6 of the Linux kernel.
“Probably the most wide ranging and complete Linux device driver book I’ve read.” --Alan Cox, Linux Guru and Key Kernel Developer “Very comprehensive and detailed, covering almost every single Linux device driver type.” --Theodore Ts’o, First Linux Kernel Developer in North America and Chief Platform Strategist of the Linux Foundation The Most Practical Guide to Writing Linux Device Drivers Linux now offers an exceptionally robust environment for driver development: with today’s kernels, what once required years of development time can be accomplished in days. In this practical, example-driven book, one of the world’s most experienced Linux driver developers systematically demonstrates how to develop reliable Linux drivers for virtually any device. Essential Linux Device Drivers is for any programmer with a working knowledge of operating systems and C, including programmers who have never written drivers before. Sreekrishnan Venkateswaran focuses on the essentials, bringing together all the concepts and techniques you need, while avoiding topics that only matter in highly specialized situations. Venkateswaran begins by reviewing the Linux 2.6 kernel capabilities that are most relevant to driver developers. He introduces simple device classes; then turns to serial buses such as I2C and SPI; external buses such as PCMCIA, PCI, and USB; video, audio, block, network, and wireless device drivers; user-space drivers; and drivers for embedded Linux–one of today’s fastest growing areas of Linux development. For each, Venkateswaran explains the technology, inspects relevant kernel source files, and walks through developing a complete example. • Addresses drivers discussed in no other book, including drivers for I2C, video, sound, PCMCIA, and different types of flash memory • Demystifies essential kernel services and facilities, including kernel threads and helper interfaces • Teaches polling, asynchronous notification, and I/O control • Introduces the Inter-Integrated Circuit Protocol for embedded Linux drivers • Covers multimedia device drivers using the Linux-Video subsystem and Linux-Audio framework • Shows how Linux implements support for wireless technologies such as Bluetooth, Infrared, WiFi, and cellular networking • Describes the entire driver development lifecycle, through debugging and maintenance • Includes reference appendixes covering Linux assembly, BIOS calls, and Seq files