舉報

會員
Hands-On System Programming with C++
C++isageneral-purposeprogramminglanguagewithabiastowardsystemprogrammingasitprovidesreadyaccesstohardware-levelresources,efficientcompilation,andaversatileapproachtohigher-levelabstractions.ThisbookwillhelpyouunderstandthebenefitsofsystemprogrammingwithC++17.YouwillgainafirmunderstandingofvariousC,C++,andPOSIXstandards,aswellastheirrespectivesystemtypesforbothC++andPOSIX.AfterabriefrefresheronC++,ResourceAcquisitionIsInitialization(RAII),andthenewC++GuidelineSupportLibrary(GSL),youwilllearntoprogramLinuxandUnixsystemsalongwithprocessmanagement.Asyouprogressthroughthechapters,youwillbecomeacquaintedwithC++'ssupportforIO.Youwillthenstudyvariousmemorymanagementmethods,includingachapteronallocatorsandhowtheybenefitsystemprogramming.YouwillalsoexplorehowtoprogramfileinputandoutputandlearnaboutPOSIXsockets.ThisbookwillhelpyougettogripswithsafelysettingupaUDPandTCPserver/client.Finally,youwillbeguidedthroughUnixtimeinterfaces,multithreading,anderrorhandlingwithC++exceptions.Bytheendofthisbook,youwillbecomfortablewithusingC++toprogramhigh-qualitysystems.
最新章節
- Leave a review - let other readers know what you think
- Other Books You May Enjoy
- Chapter 13
- Chapter 12
- Chapter 11
- Chapter 10
品牌:中圖公司
上架時間:2021-07-02 12:38:07
出版社:Packt Publishing
本書數字版權由中圖公司提供,并由其授權上海閱文信息技術有限公司制作發行
- Leave a review - let other readers know what you think 更新時間:2021-07-02 14:43:17
- Other Books You May Enjoy
- Chapter 13
- Chapter 12
- Chapter 11
- Chapter 10
- Chapter 9
- Chapter 8
- Chapter 7
- Chapter 6
- Chapter 5
- Chapter 4
- Chapter 3
- Chapter 2
- Chapter 1
- Assessments
- Further reading
- Questions
- Summary
- Compiling and testing
- Studying an example on exception benchmark
- Understanding exception support in C++
- Learning about set jump exceptions
- Error handling POSIX-style
- Technical requirements
- Error – Handling with Exceptions
- Further reading
- Questions
- Summary
- Compiling and testing
- Studying an example on thread logging
- Compiling and testing
- Studying an example on benchmarking with threads
- Compiling and testing
- Studying an example on parallel computation
- Synchronization
- Yielding
- The basics of C++ threads
- Exploring C++ threads
- Synchronization
- Yielding
- The basics of POSIX threads
- Understanding POSIX threads
- Technical requirements
- Learning to Program POSIX and C++ Threads
- Further reading
- Questions
- Summary
- Compiling and testing
- Studying an example on high-resolution timer
- Compiling and testing
- Studying an example on the read system clock
- The high_resolution_clock function
- The steady_clock function
- Duration
- The time_point API
- The system_clock() API
- Exploring C++ Chrono APIs
- The clock() function
- The mktime() function
- The difftime() function
- The strftime() function
- The asctime() function
- The localtime() and gmtime() APIs
- The ctime() typedef
- The time() API
- Learning about the types of APIs
- Learning about POSIX time.h APIs
- Technical requirements
- Time Interfaces in Unix
- Further reading
- Questions
- Summary
- Compiling and testing
- The client logic
- Server
- Processing an example of processing JSON
- Compiling and testing
- The client logic
- Trying out an example for processing packets
- Compiling and testing
- The client logic
- Server
- Exploring an example on TCP Logger
- Compiling and testing
- The client logic
- Server
- Studying an example on the TCP echo server
- Compiling and testing
- The client logic
- Server
- Studying an example on the UDP echo server
- The send() recv() sendto() and recvfrom() APIs
- The listen() and accept() APIs
- The bind() and connect() APIs
- The socket() API
- Beginning with APIs
- Beginning with POSIX sockets
- Technical requirements
- Programming POSIX Sockets Using C++
- Further reading
- Questions
- Summary
- Compiling and testing
- Studying an example of a stateful memory–pool allocator
- Compiling and testing
- Studying an example of stateless cache–aligned allocator
- Optional functions
- Exploring some optional properties
- Moving equal allocators
- Copying equal allocators
- Different allocation types
- Equality
- The value pointer type
- Learning the properties
- Understanding the allocator's properties and options
- Learning about the basic allocator
- Introducing the C++ allocators
- Technical requirements
- A Hands-On Approach to Allocators
- Further reading
- Questions
- Summary
- Comparing C++ versus mmap benchmark
- Learning about the tail file example
- Understanding the logger example
- Paths
- Understanding file utilities
- Writing bytes
- Writing by field
- Writing to a file
- Reading by line
- Reading bytes
- Reading by field
- Reading from a file
- Reading and writing to a file
- Modes for opening a file
- Different ways to open a file
- Opening a file
- Technical requirements
- Learning to Program File Input/Output
- Further reading
- Questions
- Summary
- External over internal fragmentation
- Internal over external fragmentation
- Internal fragmentation
- External fragmentation
- Learning importance of memory fragmentation
- Shared memory
- Smart pointers and mmap()
- Permissions
- The basics
- Learning about mapping and permissions
- The std::shared_ptr pointer
- The std::unique_ptr{} pointer
- Understanding smart pointers and ownership
- Overloading
- Placement of new
- nothrow
- Aligning memory
- The basics for writing a program
- Learning about the new and delete functions
- Technical requirements
- A Comprehensive Look at Memory Management
- Further reading
- Questions
- Summary
- Understanding the Serial Echo server example
- Recreating the echo program
- Learning about manipulators
- Performance of C++ streams
- Common debugging patterns
- Safety and implicit memory management
- Beginning with user-defined types
- Disadvantages of C++ stream-based IO
- Advantages of C++ stream-based IO
- Advantages and disadvantages of C++ stream-based IO
- The basics of stream
- Learning about stream-based IO
- Technical requirements
- Learning to Program Console Input/Output
- Further reading
- Questions
- Summary
- Unix signals
- Output redirection
- The exec() function
- Unix shared memory
- Unix pipes
- Interprocess communication (IPC)
- The wait() function
- The fork() function
- Unix processes
- The Unix filesystem
- ELF segments
- ELF sections
- Executable and Linkable Format (ELF)
- Virtual memory layout
- Exception handling and debugging
- The calling convention
- Function prologs and epilogs
- The stack frame
- The register layout
- The System V ABI
- The Linux ABI
- Technical requirements
- Programming Linux/Unix Systems
- Further Reading
- Questions
- Summary
- Utilities
- Contracts
- Pointer arithmetic
- Pointer ownership
- The Guideline Support Library (GSL)
- Resource Acquisition Is Initialization (RAII)
- std::any std::variant and std::optional
- String View
- Changes in the library
- Inline variables
- Structured bindings
- Namespaces
- Additions to compile-time facilities
- Initializers in if/switch statements
- Language changes
- A brief overview of C++17
- Technical requirements
- C++ RAII and the GSL Refresher
- Further reading
- Questions
- Summary
- Structure packing
- Learning standard integer types
- Boolean
- Floating – point numbers
- Integer types
- Character types
- Exploring C and C++ default types
- Technical requirements
- System Types for C and C++
- Further reading
- Questions
- Summary
- Threading
- Sockets
- Filesystems
- Memory management
- Beginning with the POSIX standard
- Libraries
- Pointers versus references
- Scope
- Linking C++ applications
- Libraries
- Language syntax
- General conventions and concepts
- How the standard is organized
- Learning about the C++ standard
- Libraries
- Pointers and arrays
- Scope
- Dynamic libraries
- Static libraries
- All about linking
- How a C program starts
- Libraries
- Language
- Environment
- How the standard is organized
- Beginning with the C standard language
- Technical requirements
- Learning the C C++17 and POSIX Standards
- Further reading
- Questions
- Summary
- APIs and C++ containers in C++
- Error handling mechanism in C++
- Functional programming associated with C++
- Templates used in C++
- Objects of C++
- Type safety in C++
- Benefits of using C++ when system programming
- Meltdown and Spectre
- SYSRET
- System call security risks
- Threading and process creation
- Time
- Networking
- File input/output
- Memory allocation
- Console input/output
- Learning about different types of system calls
- The anatomy of a system call
- Understanding system calls
- Technical requirements
- Getting Started with System Programming
- Reviews
- Get in touch
- Conventions used
- Download the example code files
- To get the most out of this book
- What this book covers
- Who this book is for
- Preface
- Packt is searching for authors like you
- About the reviewer
- About the author
- Contributors
- Packt.com
- Why subscribe?
- About Packt
- Dedication
- Hands-On System Programming with C++
- Copyright and Credits
- Title Page
- coverpage
- coverpage
- 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 更新時間:2021-07-02 14:43:17