售 价:¥
温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印
为你推荐
Title Page
Copyright and Credits
Hands-On System Programming with C++
Dedication
About Packt
Why subscribe?
Packt.com
Contributors
About the author
About the reviewer
Packt is searching for authors like you
Preface
Who this book is for
What this book covers
To get the most out of this book
Download the example code files
Conventions used
Get in touch
Reviews
Getting Started with System Programming
Technical requirements
Understanding system calls
The anatomy of a system call
Learning about different types of system calls
Console input/output
Memory allocation
File input/output
Networking
Time
Threading and process creation
System call security risks
SYSRET
Meltdown and Spectre
Benefits of using C++ when system programming
Type safety in C++
Objects of C++
Templates used in C++
Functional programming associated with C++
Error handling mechanism in C++
APIs and C++ containers in C++
Summary
Questions
Further reading
Learning the C, C++17, and POSIX Standards
Technical requirements
Beginning with the C standard language
How the standard is organized
Environment
Language
Libraries
How a C program starts
All about linking
Static libraries
Dynamic libraries
Scope
Pointers and arrays
Libraries
Learning about the C++ standard
How the standard is organized
General conventions and concepts
Language syntax
Libraries
Linking C++ applications
Scope
Pointers versus references
Libraries
Beginning with the POSIX standard
Memory management
Filesystems
Sockets
Threading
Summary
Questions
Further reading
System Types for C and C++
Technical requirements
Exploring C and C++ default types
Character types
Integer types
Floating – point numbers
Boolean
Learning standard integer types
Structure packing
Summary
Questions
Further reading
C++, RAII, and the GSL Refresher
Technical requirements
A brief overview of C++17
Language changes
Initializers in if/switch statements
Additions to compile-time facilities
Namespaces
Structured bindings
Inline variables
Changes in the library
String View
std::any, std::variant, and std::optional
Resource Acquisition Is Initialization (RAII)
The Guideline Support Library (GSL)
Pointer ownership
Pointer arithmetic
Contracts
Utilities
Summary
Questions
Further Reading
Programming Linux/Unix Systems
Technical requirements
The Linux ABI
The System V ABI
The register layout
The stack frame
Function prologs and epilogs
The calling convention
Exception handling and debugging
Virtual memory layout
Executable and Linkable Format (ELF)
ELF sections
ELF segments
The Unix filesystem
Unix processes
The fork() function
The wait() function
Interprocess communication (IPC)
Unix pipes
Unix shared memory
The exec() function
Output redirection
Unix signals
Summary
Questions
Further reading
Learning to Program Console Input/Output
Technical requirements
Learning about stream-based IO
The basics of stream
Advantages and disadvantages of C++ stream-based IO
Advantages of C++ stream-based IO
Disadvantages of C++ stream-based IO
Beginning with user-defined types
Safety and implicit memory management
Common debugging patterns
Performance of C++ streams
Learning about manipulators
Recreating the echo program
Understanding the Serial Echo server example
Summary
Questions
Further reading
A Comprehensive Look at Memory Management
Technical requirements
Learning about the new and delete functions
The basics for writing a program
Aligning memory
nothrow
Placement of new
Overloading
Understanding smart pointers and ownership
The std::unique_ptr{} pointer
The std::shared_ptr pointer
Learning about mapping and permissions
The basics
Permissions
Smart pointers and mmap()
Shared memory
Learning importance of memory fragmentation
External fragmentation
Internal fragmentation
Internal over external fragmentation
External over internal fragmentation
Summary
Questions
Further reading
Learning to Program File Input/Output
Technical requirements
Opening a file
Different ways to open a file
Modes for opening a file
Reading and writing to a file
Reading from a file
Reading by field
Reading bytes
Reading by line
Writing to a file
Writing by field
Writing bytes
Understanding file utilities
Paths
Understanding the logger example
Learning about the tail file example
Comparing C++ versus mmap benchmark
Summary
Questions
Further reading
A Hands-On Approach to Allocators
Technical requirements
Introducing the C++ allocators
Learning about the basic allocator
Understanding the allocator's properties and options
Learning the properties
The value pointer type
Equality
Different allocation types
Copying equal allocators
Moving equal allocators
Exploring some optional properties
Optional functions
Studying an example of stateless, cache–aligned allocator
Compiling and testing
Studying an example of a stateful, memory–pool allocator
Compiling and testing
Summary
Questions
Further reading
Programming POSIX Sockets Using C++
Technical requirements
Beginning with POSIX sockets
Beginning with APIs
The socket() API
The bind() and connect() APIs
The listen() and accept() APIs
The send(), recv(), sendto(), and recvfrom() APIs
Studying an example on the UDP echo server
Server
The client logic
Compiling and testing
Studying an example on the TCP echo server
Server
The client logic
Compiling and testing
Exploring an example on TCP Logger
Server
The client logic
Compiling and testing
Trying out an example for processing packets
The client logic
Compiling and testing
Processing an example of processing JSON
Server
The client logic
Compiling and testing
Summary
Questions
Further reading
Time Interfaces in Unix
Technical requirements
Learning about POSIX time.h APIs
Learning about the types of APIs
The time() API
The ctime() typedef
The localtime() and gmtime() APIs
The asctime() function
The strftime() function
The difftime() function
The mktime() function
The clock() function
Exploring C++ Chrono APIs
The system_clock() API
The time_point API
Duration
The steady_clock function
The high_resolution_clock function
Studying an example on the read system clock
Compiling and testing
Studying an example on high-resolution timer
Compiling and testing
Summary
Questions
Further reading
Learning to Program POSIX and C++ Threads
Technical requirements
Understanding POSIX threads
The basics of POSIX threads
Yielding
Synchronization
Exploring C++ threads
The basics of C++ threads
Yielding
Synchronization
Studying an example on parallel computation
Compiling and testing
Studying an example on benchmarking with threads
Compiling and testing
Studying an example on thread logging
Compiling and testing
Summary
Questions
Further reading
Error – Handling with Exceptions
Technical requirements
Error handling POSIX-style
Learning about set jump exceptions
Understanding exception support in C++
Studying an example on exception benchmark
Compiling and testing
Summary
Questions
Further reading
Assessments
Chapter 1
Chapter 2
Chapter 3
Chapter 4
Chapter 5
Chapter 6
Chapter 7
Chapter 8
Chapter 9
Chapter 10
Chapter 11
Chapter 12
Chapter 13
Other Books You May Enjoy
Leave a review - let other readers know what you think
买过这本书的人还买过
读了这本书的人还在读
同类图书排行榜