Linux System Programming: Talking Directly to the Kernel and C Library


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, ...

See more details below
Paperback (Second Edition)
$38.86 price
(Save 35%)$59.99 List Price

Pick Up In Store

Reserve and pick up in 60 minutes at your local store

Other sellers (Paperback)
  • All (23) from $25.67   
  • New (16) from $33.44   
  • Used (7) from $25.67   
Linux System Programming: Talking Directly to the Kernel and C Library

Available on NOOK devices and apps  
  • NOOK Devices
  • Samsung Galaxy Tab 4 NOOK 7.0
  • Samsung Galaxy Tab 4 NOOK 10.1
  • NOOK HD Tablet
  • NOOK HD+ Tablet
  • NOOK eReaders
  • NOOK Color
  • NOOK Tablet
  • Tablet/Phone
  • NOOK for Windows 8 Tablet
  • NOOK for iOS
  • NOOK for Android
  • NOOK Kids for iPad
  • PC/Mac
  • NOOK for Windows 8
  • NOOK for PC
  • NOOK for Mac
  • NOOK for Web

Want a NOOK? Explore Now

NOOK Book (eBook)
$29.49 price
(Save 42%)$50.99 List Price


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
With Linux System Programming, you will be able to take an in-depth look at Linux from both a theoretical and an applied perspective as you cover a wide range of programming topics.
Read More Show Less

Product Details

  • ISBN-13: 9781449339531
  • Publisher: O'Reilly Media, Incorporated
  • Publication date: 6/4/2013
  • Edition description: Second Edition
  • Edition number: 2
  • Pages: 456
  • Sales rank: 565,901
  • Product dimensions: 7.00 (w) x 9.10 (h) x 1.10 (d)

Meet the Author

Robert Love has been a Linux user and hacker since the early days. Heis active in, and passionate about, both the Linux kernel and GNOMEdesktop communities. His recent contributions to the Linux kernelinclude work on the kernel event layer and inotify. GNOME-relatedcontributions include Beagle, GNOME Volume Manager, NetworkManager,and Project Utopia. Currently Robert works in the Open Source ProgramOffice at Google.

As an author, Robert is responsible for Linux Kernel Development(SAMS), now in its second edition, and Linux System Programming(O'Reilly). He is also a coauthor of the fifth edition of O'Reilly'sLinux in a Nutshell. He's a Contributing Editor for Linux Journal, haswritten numerous articles, and has been invited to speak around theworld on Linux.

Robert graduated from the University of Florida with a B.A. inMathematics and a B.S. in Computer Science. Hailing from SouthFlorida, he currently calls Boston home.

Read More Show Less

Table of Contents

Audience and Assumptions;
Contents of This Book;
Versions Covered in This Book;
Conventions Used in This Book;
Safari® Books Online;
Using Code Examples;
How to Contact Us;
Chapter 1: Introduction and Essential Concepts;
1.1 System Programming;
1.2 APIs and ABIs;
1.3 Standards;
1.4 Concepts of Linux Programming;
1.5 Getting Started with System Programming;
Chapter 2: File I/O;
2.1 Opening Files;
2.2 Reading via read( );
2.3 Writing with write( );
2.4 Synchronized I/O;
2.5 Direct I/O;
2.6 Closing Files;
2.7 Seeking with lseek( );
2.8 Positional Reads and Writes;
2.9 Truncating Files;
2.10 Multiplexed I/O;
2.11 Kernel Internals;
2.12 Conclusion;
Chapter 3: Buffered I/O;
3.1 User-Buffered I/O;
3.2 Standard I/O;
3.3 Opening Files;
3.4 Opening a Stream via File Descriptor;
3.5 Closing Streams;
3.6 Reading from a Stream;
3.7 Writing to a Stream;
3.8 Sample Program Using Buffered I/O;
3.9 Seeking a Stream;
3.10 Flushing a Stream;
3.11 Errors and End-of-File;
3.12 Obtaining the Associated File Descriptor;
3.13 Controlling the Buffering;
3.14 Thread Safety;
3.15 Critiques of Standard I/O;
3.16 Conclusion;
Chapter 4: Advanced File I/O;
4.1 Scatter/Gather I/O;
4.2 The Event Poll Interface;
4.3 Mapping Files into Memory;
4.4 Advice for Normal File I/O;
4.5 Synchronized, Synchronous, and Asynchronous Operations;
4.6 I/O Schedulers and I/O Performance;
4.7 Conclusion;
Chapter 5: Process Management;
5.1 The Process ID;
5.2 Running a New Process;
5.3 Terminating a Process;
5.4 Waiting for Terminated Child Processes;
5.5 Users and Groups;
5.6 Sessions and Process Groups;
5.7 Daemons;
5.8 Conclusion;
Chapter 6: Advanced Process Management;
6.1 Process Scheduling;
6.2 Yielding the Processor;
6.3 Process Priorities;
6.4 Processor Affinity;
6.5 Real-Time Systems;
6.6 Resource Limits;
Chapter 7: File and Directory Management;
7.1 Files and Their Metadata;
7.2 Directories;
7.3 Links;
7.4 Copying and Moving Files;
7.5 Device Nodes;
7.6 Out-of-Band Communication;
7.7 Monitoring File Events;
Chapter 8: Memory Management;
8.1 The Process Address Space;
8.2 Allocating Dynamic Memory;
8.3 Managing the Data Segment;
8.4 Anonymous Memory Mappings;
8.5 Advanced Memory Allocation;
8.6 Debugging Memory Allocations;
8.7 Stack-Based Allocations;
8.8 Choosing a Memory Allocation Mechanism;
8.9 Manipulating Memory;
8.10 Locking Memory;
8.11 Opportunistic Allocation;
Chapter 9: Signals;
9.1 Signal Concepts;
9.2 Basic Signal Management;
9.3 Sending a Signal;
9.4 Reentrancy;
9.5 Signal Sets;
9.6 Blocking Signals;
9.7 Advanced Signal Management;
9.8 Sending a Signal with a Payload;
9.9 Conclusion;
Chapter 10: Time;
10.1 Time's Data Structures;
10.2 POSIX Clocks;
10.3 Getting the Current Time of Day;
10.4 Setting the Current Time of Day;
10.5 Playing with Time;
10.6 Tuning the System Clock;
10.7 Sleeping and Waiting;
10.8 Timers;
GCC Extensions to the C Language;
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;

Read More Show Less

Customer Reviews

Be the first to write a review
( 0 )
Rating Distribution

5 Star


4 Star


3 Star


2 Star


1 Star


Your Rating:

Your Name: Create a Pen Name or

Barnes & Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation


  • - By submitting a review, you grant to Barnes & and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Terms of Use.
  • - Barnes & reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously
Sort by: Showing 1 Customer Reviews
  • Anonymous

    Posted April 14, 2008

    Top Notch Reference

    Linux System Programming is a top notch reference in the witty and educating style of the author's other book. I learned a lot on my first pass and continue to refer to it as a reference on many followup reads.

    1 out of 1 people found this review helpful.

    Was this review helpful? Yes  No   Report this review
Sort by: Showing 1 Customer Reviews

If you find inappropriate content, please report it to Barnes & Noble
Why is this product inappropriate?
Comments (optional)