Love linux system programming

Linux, системное программирование, Лав Р., 2014

Роберт Лав стоит у истоков создания операционной системы Linux. Он внес существенный вклад в создание ядра Linux и настольной среды GNOME. Эта книга представляет собой руководство по системному программированию для Linux, справочник по системным вызовам Linux, а также подробный рассказ о том, как писать более быстрый и умный код. Роберт Лав четко разграничивает стандартные функции POSIX и специальные службы, которые предлагаются лишь в Linux. Во втором издании вы изучите эту операционную систему как с теоретической, так и с прикладной точки зрения.

Предисловие.

Есть старая шутка, что разработчики ядра Linux, рассердившись, могут в сердцах бросить: «Все ваше пользовательское пространство — просто тестовая нагрузка для ядра!» Говоря такое, разработчики просто пытаются умыть руки и снять с себя ответственность за любые случаи, в которых ядру не удается обеспечивать максимально эффективную работу пользовательского кода. По мнению создателей ядра, программистам, работающим в пользовательском пространстве, следует просто посторониться и исправлять собственный код, ведь проблемы могут объясняться чем угодно, но не недостатками ядра. Уже более трех лет назад один из ведущих разработчиков ядра Linux прочитал лекцию под названием «Почему пользовательское пространство — ерунда». Целью лекции было доказать, что обычно корень проблем лежит не в ядре. Выступив перед переполненной аудиторией, этот специалист привел примеры отвратительного пользовательского кода, на который практически всем пользователям Linux приходится полагаться ежедневно. Другие разработчики ядра создали специальные инструменты, демонстрирующие, как сильно пользовательские программы могут злоупотреблять оборудованием и растрачивать заряд ничего не подозревающего ноутбука.

Краткое содержание.

Предисловие.
Вступление.
Благодарности.
От издательства.
Глава 1. Введение и основополагающие концепции.
Глава 2. Файловый ввод-вывод.
Глава 3. Буферизованный ввод-вывод.
Глава 4. Расширенный файловый ввод-вывод.
Глава 5. Управление процессами.
Глава 6. Расширенное управление процессами.
Глава 7. Поточность.
Глава 8. Управление файлами и каталогами.
Глава 9. Управление памятью.
Глава 10. Сигналы.
Глава 11. Время.
Приложение А. Расширения GCC для языка С.
Приложение Б. Библиография.

Бесплатно скачать электронную книгу в удобном формате, смотреть и читать:
Скачать книгу Linux, системное программирование, Лав Р., 2014 — fileskachat.com, быстрое и бесплатное скачивание.

Скачать pdf
Ниже можно купить эту книгу по лучшей цене со скидкой с доставкой по всей России. Купить эту книгу

Источник

Linux System Programming, 2nd Edition

Linux System Programming, 2nd Edition

Read it now on the O’Reilly learning platform with a 10-day free trial.

O’Reilly members get unlimited access to books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.

Book description

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.

Читайте также:  Сбросить пароль от связки ключей linux

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

Publisher resources

Table of contents

  1. Dedication
  2. Foreword
  3. Preface
    1. Audience and Assumptions
    2. Contents of This Book
    3. Versions Covered in This Book
    4. Conventions Used in This Book
    5. Using Code Examples
    6. Safari® Books Online
    7. How to Contact Us
    8. Acknowledgments
    1. System Programming
      1. Why Learn System Programming
      2. Cornerstones of System Programming
      3. System Calls
        1. Invoking system calls
        1. APIs
        2. ABIs
        1. POSIX and SUS History
        2. C Language Standards
        3. Linux and the Standards
        4. This Book and the Standards
        1. Files and the Filesystem
          1. Regular files
          2. Directories and links
          3. Hard links
          4. Symbolic links
          5. Special files
          6. Filesystems and namespaces
          1. Threads
          2. Process hierarchy
          1. Opening Files
            1. The open() System Call
              1. Flags for open()
              1. Return Values
              2. Reading All the Bytes
              3. Nonblocking Reads
              4. Other Error Values
              5. Size Limits on read()
              1. Partial Writes
              2. Append Mode
              3. Nonblocking Writes
              4. Other Error Codes
              5. Size Limits on write()
              6. Behavior of write()
              1. fsync() and fdatasync()
                1. Return values and error codes
                1. Error Values
                1. Seeking Past the End of a File
                2. Error Values
                3. Limitations
                1. Error Values
                1. select()
                  1. Return values and error codes
                  2. select() example
                  3. Portable sleeping with select()
                  4. pselect()
                  1. Return values and error codes
                  2. poll() example
                  3. ppoll()
                  1. The Virtual Filesystem
                  2. The Page Cache
                  3. Page Writeback
                  1. User-Buffered I/O
                    1. Block Size
                    1. File Pointers
                    1. Modes
                    1. Closing All Streams
                    1. Reading a Character at a Time
                      1. Putting the character back
                      1. Reading arbitrary strings
                      1. Writing a Single Character
                      2. Writing a String of Characters
                      3. Writing Binary Data
                      1. Obtaining the Current Stream Position
                      1. Manual File Locking
                      2. Unlocked Stream Operations
                      1. Scatter/Gather I/O
                        1. readv() and writev()
                          1. Return values
                          2. writev() example
                          3. readv() example
                          4. Implementation
                          1. Creating a New Epoll Instance
                          2. Controlling Epoll
                          3. Waiting for Events with Epoll
                          4. Edge- Versus Level-Triggered Events
                          1. mmap()
                            1. The page size
                            2. Return values and error codes
                            3. Associated signals
                            1. Return values and error codes
                            1. Return values and error codes
                            1. Return values and error codes
                            1. Return values and error codes
                            1. The posix_fadvise() System Call
                              1. Return values and error codes
                              1. Return values and error codes
                              1. Asynchronous I/O
                              1. Disk Addressing
                              2. The Life of an I/O Scheduler
                              3. Helping Out Reads
                                1. The Deadline I/O Scheduler
                                2. The Anticipatory I/O Scheduler
                                3. The CFQ I/O Scheduler
                                4. The Noop I/O Scheduler
                                1. Scheduling I/O in user space
                                2. Sorting by path
                                3. Sorting by inode
                                4. Sorting by physical block
                                1. Programs, Processes, and Threads
                                2. The Process ID
                                  1. Process ID Allocation
                                  2. The Process Hierarchy
                                  3. pid_t
                                  4. Obtaining the Process ID and Parent Process ID
                                  1. The Exec Family of Calls
                                    1. The rest of the family
                                    2. Error values
                                    1. Copy-on-write
                                    2. vfork()
                                    1. Other Ways to Terminate
                                    2. atexit()
                                    3. on_exit()
                                    4. SIGCHLD
                                    1. Waiting for a Specific Process
                                    2. Even More Waiting Versatility
                                    3. BSD Wants to Play: wait3() and wait4()
                                    4. Launching and Waiting for a New Process
                                    5. Zombies
                                    1. Real, Effective, and Saved User and Group IDs
                                    2. Changing the Real or Saved User or Group ID
                                    3. Changing the Effective User or Group ID
                                    4. Changing the User and Group IDs, BSD Style
                                    5. Changing the User and Group IDs, HP-UX Style
                                    6. Preferred User/Group ID Manipulations
                                    7. Support for Saved User IDs
                                    8. Obtaining the User and Group IDs
                                    1. Session System Calls
                                    2. Process Group System Calls
                                    3. Obsolete Process Group Functions
                                    1. Process Scheduling
                                      1. Timeslices
                                      2. I/O- Versus Processor-Bound Processes
                                      3. Preemptive Scheduling
                                      1. Legitimate Uses
                                      1. nice()
                                      2. getpriority() and setpriority()
                                      3. I/O Priorities
                                      1. sched_getaffinity() and sched_setaffinity()
                                      1. Hard Versus Soft Real-Time Systems
                                      2. Latency, Jitter, and Deadlines
                                      3. Linux’s Real-Time Support
                                      4. Linux Scheduling Policies and Priorities
                                        1. The first in, first out policy
                                        2. The round-robin policy
                                        3. The normal policy
                                        4. The batch scheduling policy
                                        5. Setting the Linux scheduling policy
                                        1. Error codes
                                        2. Determining the range of valid priorities
                                        1. Error codes
                                        1. Prefaulting data and locking memory
                                        2. CPU affinity and real-time processes
                                        1. The Limits
                                          1. Default limits
                                          1. Error codes
                                          1. Binaries, Processes, and Threads
                                          2. Multithreading
                                            1. Costs of Multithreading
                                            2. Alternatives to Multithreading
                                            1. User-Level Threading
                                            2. Hybrid Threading
                                            3. Coroutines and Fibers
                                            1. Thread-per-Connection
                                            2. Event-Driven Threading
                                            1. Race Conditions
                                              1. Real-world races
                                              1. Mutexes
                                              2. Deadlocks
                                                1. Deadlock avoidance
                                                1. Linux Threading Implementations
                                                2. The Pthread API
                                                3. Linking Pthreads
                                                4. Creating Threads
                                                5. Thread IDs
                                                  1. Comparing thread IDs
                                                  1. Terminating yourself
                                                  2. Terminating others
                                                  1. Joining threads
                                                  2. Detaching threads
                                                  1. Initializing mutexes
                                                  2. Locking mutexes
                                                  3. Unlocking mutexes
                                                  4. Mutex example
                                                  1. Files and Their Metadata
                                                    1. The Stat Family
                                                    2. Permissions
                                                    3. Ownership
                                                    4. Extended Attributes
                                                      1. Keys and values
                                                      2. Extended attribute namespaces
                                                      1. Retrieving an extended attribute
                                                      2. Setting an extended attribute
                                                      3. Listing the extended attributes on a file
                                                      4. Removing an extended attribute
                                                      1. The Current Working Directory
                                                        1. Obtaining the current working directory
                                                        2. Changing the current working directory
                                                        1. Reading from a directory stream
                                                        2. Closing the directory stream
                                                        3. System calls for reading directory contents
                                                        1. Hard Links
                                                        2. Symbolic Links
                                                        3. Unlinking
                                                        1. Copying
                                                        2. Moving
                                                        1. Special Device Nodes
                                                        2. The Random Number Generator
                                                        1. Initializing inotify
                                                        2. Watches
                                                          1. Adding a new watch
                                                          2. Watch masks
                                                          1. Reading inotify events
                                                          2. Advanced inotify events
                                                          3. Linking together move events
                                                          1. The Process Address Space
                                                            1. Pages and Paging
                                                              1. Sharing and copy-on-write
                                                              1. Allocating Arrays
                                                              2. Resizing Allocations
                                                              3. Freeing Dynamic Memory
                                                              4. Alignment
                                                                1. Allocating aligned memory
                                                                2. Other alignment concerns
                                                                1. Creating Anonymous Memory Mappings
                                                                2. Mapping /dev/zero
                                                                1. Fine-Tuning with malloc_usable_size() and malloc_trim()
                                                                1. Obtaining Statistics
                                                                1. Duplicating Strings on the Stack
                                                                2. Variable-Length Arrays
                                                                1. Setting Bytes
                                                                2. Comparing Bytes
                                                                3. Moving Bytes
                                                                4. Searching Bytes
                                                                5. Frobnicating Bytes
                                                                1. Locking Part of an Address Space
                                                                2. Locking All of an Address Space
                                                                3. Unlocking Memory
                                                                4. Locking Limits
                                                                5. Is a Page in Physical Memory?
                                                                1. Overcommitting and OOM
                                                                1. Signal Concepts
                                                                  1. Signal Identifiers
                                                                  2. Signals Supported by Linux
                                                                  1. Waiting for a Signal, Any Signal
                                                                  2. Examples
                                                                  3. Execution and Inheritance
                                                                  4. Mapping Signal Numbers to Strings
                                                                  1. Permissions
                                                                  2. Examples
                                                                  3. Sending a Signal to Yourself
                                                                  4. Sending a Signal to an Entire Process Group
                                                                  1. Guaranteed-Reentrant Functions
                                                                  1. More Signal Set Functions
                                                                  1. Retrieving Pending Signals
                                                                  2. Waiting for a Set of Signals
                                                                  1. The siginfo_t Structure
                                                                  2. The Wonderful World of si_code
                                                                  1. Signal Payload Example
                                                                  1. Time’s Data Structures
                                                                    1. The Original Representation
                                                                    2. And Now, Microsecond Precision
                                                                    3. Even Better: Nanosecond Precision
                                                                    4. Breaking Down Time
                                                                    5. A Type for Process Time
                                                                    1. Time Source Resolution
                                                                    1. A Better Interface
                                                                    2. An Advanced Interface
                                                                    3. Getting the Process Time
                                                                    1. Setting Time with Precision
                                                                    2. An Advanced Interface for Setting the Time
                                                                    1. Sleeping with Microsecond Precision
                                                                    2. Sleeping with Nanosecond Resolution
                                                                    3. An Advanced Approach to Sleep
                                                                    4. A Portable Way to Sleep
                                                                    5. Overruns
                                                                    6. Alternatives to Sleeping
                                                                    1. Simple Alarms
                                                                    2. Interval Timers
                                                                    3. Advanced Timers
                                                                      1. Creating a timer
                                                                      2. Arming a timer
                                                                      3. Obtaining the expiration of a timer
                                                                      4. Obtaining the overrun of a timer
                                                                      5. Deleting a timer
                                                                      1. GNU C
                                                                      2. Inline Functions
                                                                      3. Suppressing Inlining
                                                                      4. Pure Functions
                                                                      5. Constant Functions
                                                                      6. Functions That Do Not Return
                                                                      7. Functions That Allocate Memory
                                                                      8. Forcing Callers to Check the Return Value
                                                                      9. Marking Functions as Deprecated
                                                                      10. Marking Functions as Used
                                                                      11. Marking Functions or Parameters as Unused
                                                                      12. Packing a Structure
                                                                      13. Increasing the Alignment of a Variable
                                                                      14. Placing Global Variables in a Register
                                                                      15. Branch Annotation
                                                                      16. Getting the Type of an Expression
                                                                      17. Getting the Alignment of a Type
                                                                      18. The Offset of a Member Within a Structure
                                                                      19. Obtaining the Return Address of a Function
                                                                      20. Case Ranges
                                                                      21. Void and Function Pointer Arithmetic
                                                                      22. More Portable and More Beautiful in One Fell Swoop
                                                                      1. Books on the C Programming Language
                                                                      2. Books on Linux Programming
                                                                      3. Books on the Linux Kernel
                                                                      4. Books on Operating System Design

                                                                      Product information

                                                                      • Title: Linux System Programming, 2nd Edition
                                                                      • Author(s): Robert Love
                                                                      • Release date: May 2013
                                                                      • Publisher(s): O’Reilly Media, Inc.
                                                                      • ISBN: 9781449339531

                                                                      Источник

Оцените статью
Adblock
detector