Book description
This book is about writing software that makes the most effective use of the system you're running on -- code that interfaces directly with the kernel and core system libraries, including the shell, text editor, compiler, debugger, core utilities, and system daemons. The majority of both Unix and Linux code is still written at the system level, and Linux System Programming focuses on everything above the kernel, where applications such as Apache, bash, cp, vim, Emacs, gcc, gdb, glibc, ls, mv, and X exist.
Written primarily for engineers looking to program (better) at the low level, this book is an ideal teaching tool for any programmer. Even with the trend toward high-level development, either through web software (such as PHP) or managed code (C#), someone still has to write the PHP interpreter and the C# virtual machine. Linux System Programming gives you an understanding of core internals that makes for better code, no matter where it appears in the stack. Debugging high-level code often requires you to understand the system calls and kernel behavior of your operating system, too.
Key topics include:
- An overview of Linux, the kernel, the C library, and the C compiler
- Reading from and writing to files, along with other basic file I/O operations, including how the Linux kernel implements and manages file I/O
- Buffer size management, including the Standard I/O library
- 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
- File and directories-creating, moving, copying, deleting, and managing them
- Memory management -- interfaces for allocating memory, managing the memory youhave, and optimizing your memory access
- Signals and their role on a Unix system, plus basic and advanced signal interfaces
- Time, sleeping, and clock management, starting with the basics and continuing through POSIX clocks and high resolution timers
Publisher resources
Table of contents
- Foreword
- Preface
- 1. Introduction and Essential Concepts
- 2. File I/O
-
3. Buffered I/O
- User-Buffered I/O
- Standard I/O
- Opening Files
- Opening a Stream via File Descriptor
- Closing Streams
- Reading from a Stream
- Writing to a Stream
- Sample Program Using Buffered I/O
- Seeking a Stream
- Flushing a Stream
- Errors and End-of-File
- Obtaining the Associated File Descriptor
- Controlling the Buffering
- Thread Safety
- Critiques of Standard I/O
- Conclusion
-
4. Advanced File I/O
- Scatter/Gather I/O
- The Event Poll Interface
- Mapping Files into Memory
- Advice for Normal File I/O
- Synchronized, Synchronous, and Asynchronous Operations
- I/O Schedulers and I/O Performance
- Conclusion
-
5. Process Management
- The Process ID
- Running a New Process
- Terminating a Process
- Waiting for Terminated Child Processes
-
Users and Groups
- Real, Effective, and Saved User and Group IDs
- Changing the Real or Saved User or Group ID
- Changing the Effective User or Group ID
- Changing the User and Group IDs, BSD Style
- Changing the User and Group IDs, HP-UX Style
- Preferred User/Group ID Manipulations
- Support for Saved User IDs
- Obtaining the User and Group IDs
- Sessions and Process Groups
- Daemons
- Conclusion
-
6. Advanced Process Management
- Process Scheduling
- Yielding the Processor
- Process Priorities
- Processor Affinity
- Real-Time Systems
- Resource Limits
- 7. File and Directory Management
- 8. Memory Management
- 9. Signals
- 10. Time
-
A. GCC Extensions to the C Language
- GNU C
- Inline Functions
- Suppressing Inlining
- Pure Functions
- Constant Functions
- Functions That Do Not Return
- Functions That Allocate Memory
- Forcing Callers to Check the Return Value
- Marking Functions As Deprecated
- Marking Functions As Used
- Marking Functions or Parameters As Unused
- Packing a Structure
- Increasing the Alignment of a Variable
- Placing Global Variables in a Register
- Branch Annotation
- Getting the Type of an Expression
- Getting the Alignment of a Type
- The Offset of a Member Within a Structure
- Obtaining the Return Address of a Function
- Case Ranges
- Void and Function Pointer Arithmetic
- More Portable and More Beautiful in One Fell Swoop
- Bibliography
- About the Author
- Colophon
- Copyright
Product information
- Title: Linux System Programming
- Author(s):
- Release date: September 2007
- Publisher(s): O'Reilly Media, Inc.
- ISBN: 9780596009588
You might also like
book
Linux System Programming, 2nd Edition
Write software that draws directly on services offered by the Linux kernel and core system libraries. …
book
Linux Kernel Programming
Learn how to write high-quality kernel module code, solve common Linux kernel programming issues, and understand …
book
Mastering Embedded Linux Programming - Second Edition
Master the techniques needed to build great, efficient embedded devices on Linux About This Book Discover …
book
Linux Kernel Debugging
Effectively debug kernel modules, device drivers, and the kernel itself by gaining a solid understanding of …