Reguera-Salgado / Rufes | Asynchronous Programming with C++ | E-Book | www.sack.de
E-Book

E-Book, Englisch, 424 Seiten

Reihe: Packt Publishing

Reguera-Salgado / Rufes Asynchronous Programming with C++

Build blazing-fast software with multithreading and asynchronous programming for ultimate efficiency
1. Auflage 2025
ISBN: 978-1-83588-425-6
Verlag: De Gruyter
Format: EPUB
Kopierschutz: 0 - No protection

Build blazing-fast software with multithreading and asynchronous programming for ultimate efficiency

E-Book, Englisch, 424 Seiten

Reihe: Packt Publishing

ISBN: 978-1-83588-425-6
Verlag: De Gruyter
Format: EPUB
Kopierschutz: 0 - No protection



As hardware continues to evolve with greater memory capacity and multi-core processors, software must keep pace to efficiently utilize available resources and minimize idle CPU cycles. In this book, you will explore a wide range of parallel programming paradigms, including concurrent, parallel, multithreading, reactive, and event-driven programming, as well as dataflows. It clarifies the relationships between threads, processes, and services while guiding you through thread creation and management. You'll gain hands-on experience with C++'s thread-safety mechanisms, such as mutual exclusion, atomic operations, semaphores, condition variables, latches, and barriers.
Unlike other books, it offers an in-depth approach to building and implementing asynchronous applications in C++. You'll master core concepts like futures, promises, async functions, and coroutines, alongside practical applications using third-party libraries. Step by step, you'll leverage Boost.Asio and Boost.Cobalt to develop network and low-level I/O solutions while learning proven performance optimization techniques, testing strategies, and debugging methods.
By the end of this book, you'll be equipped to develop high-performance applications using C++20 and C++23's cutting-edge asynchronous programming techniques

Reguera-Salgado / Rufes Asynchronous Programming with C++ jetzt bestellen!

Weitere Infos & Material


Preface


Asynchronous programming is an essential practice for building efficient, responsive, and high-performance software, particularly in today’s world of multi-core processors and real-time data processing. This book dives deep into the principles and practical techniques for mastering asynchronous programming in C++, equipping you with the knowledge needed to handle everything from thread management to performance optimization.

There are several key pillars to developing asynchronous software:

  • Thread management and synchronization
  • Asynchronous programming concepts, models, and libraries
  • Debugging, testing, and optimizing multithreaded and asynchronous software

While many resources focus on the basics of parallel programming or generic software development, this book is designed to offer a comprehensive exploration of these pillars. It covers the essential techniques for managing concurrency, debugging complex systems, and optimizing software performance, all while grounding these concepts in real-world scenarios.

We will guide you through various aspects of asynchronous programming with practical examples based on the following:

  • Our extensive experience developing high-performance software
  • Best practices learned from working across diverse industries, from finance to research centers

As multi-core processors and parallel computing architectures become increasingly integral to modern applications, the demand for asynchronous programming expertise is growing rapidly. Mastering the techniques covered in this book will help you not only tackle today’s complex software development challenges but also prepare for future advancements in performance-critical software.

Whether you’re working with low-latency financial systems, developing high-throughput applications, or simply looking to improve your programming skills, this book will provide you with the tools and knowledge to succeed.

Who this book is for


This book is designed for software engineers, developers, and technical leads seeking to deepen their understanding of asynchronous programming using the latest C++ versions and optimize their software performance. The primary target audience includes:

  • Software engineers Those looking to enhance their skills in C++ and gain practical insights into multithreading and asynchronous programming, debugging, and performance optimization.
  • Technical leads Leaders aiming to implement efficient asynchronous systems will find strategies and best practices for managing complex software development and improving team productivity
  • Students and enthusiasts Individuals eager to learn about high-performance computing and asynchronous programming will benefit from the comprehensive explanations and examples, helping them to advance their careers in technology.

This book will empower readers to tackle real-world challenges and excel in technical interviews, equipping them with the knowledge to thrive in today’s fast-paced software landscape.

What this book covers


, , explores different architectures and models for building parallel systems, along with various parallel programming paradigms and their performance metrics.

, , delves into processes in operating systems, examining their life cycle, inter-process communication, and the role of threads, including daemons and multithreading.

, , instructs on how to create and manage threads, pass arguments, retrieve results, and handle exceptions to ensure efficient execution in multithreaded environments.

, , explains the use of C++ Standard Library synchronization primitives, including mutexes and condition variables, while addressing race conditions, deadlocks, and livelocks.

, , explores insights into C++ atomic types, memory models, and how to implement a basic SPSC lock-free queue, preparing for future performance enhancements.

, , introduces asynchronous programming concepts, including promises, futures, and packaged tasks, and shows how to tackle real-life problems using these tools.

, , explores the functionality of std::async for executing asynchronous tasks, defining launch policies, handling exceptions, and optimizing performance.

, , describes C++ coroutines, their basic requirements, and how to implement generators and parsers, while handling exceptions within coroutines.

, , explains how to use Boost.Asio for managing asynchronous tasks related to external resources, focusing on I/O objects, execution contexts, and event processing.

, , explores the Boost.Cobalt library to implement coroutines easily, avoiding low-level complexities and focusing on functional programming needs.

, , explains how to effectively use logging and debugging tools to identify and resolve issues in asynchronous applications, including deadlocks and race conditions.

, , explores how to use sanitizers for multithreaded code and explores testing techniques tailored for asynchronous software with the GoogleTest library.

, , examines performance measurement tools and techniques, including high-resolution timers, cache optimization, and strategies to avoid false and true sharing.

To get the most out of this book


You will need to have previous experience with programming using C++ and how to use debuggers to find bugs. As we are using C++20 features, and in some examples C++23, you will need to install GCC 14 and Clang 18. All source code examples have been tested in Ubuntu and macOS, but as they are platform-independent, they should compile and run on any platform.

Software/hardware covered in the book

Operating system requirements

C++20 and C++23

Linux (tested in Ubuntu 24.04)

GCC 14.2

macOS (tested in macOS Sonoma 14.x)

Clang 18

Windows 11

Boost 1.86

GDB 15.1

Each chapter includes a section highlighting relevant information on how to install the tools and libraries needed to compile the chapter’s examples.

If you are using the digital version of this book, we advise you to type the code yourself or access the code from the book’s GitHub repository (a link is available in the next section). Doing so will help you avoid any potential errors related to the copying and pasting of code.

Download the example code files


You can download the example code files for this book from GitHub at https://github.com/PacktPublishing/Asynchronous-Programming-with-CPP. If there’s an update to the code, it will be updated in the GitHub repository.

We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Conventions used


There are a number of text conventions used throughout this book.

Code in text: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: “The code above generates a vector of normally distributed random numbers and then sorts the vector with both std::sort() and...


Reguera-Salgado Javier :

Javier Reguera-Salgado is a seasoned software engineer with 19+ years of experience, specializing in high-performance computing, real-time data processing, and communication protocols. Skilled in C++, Python, and a variety of other programming languages and technologies, his work spans low-latency distributed systems, mobile apps, web solutions, and enterprise products. He has contributed to research centers, start-ups, blue-chip companies, and quantitative investment firms in Spain and the UK. Javier holds a PhD cum laude in high-performance computing from the University of Vigo, Spain. Rufes Juan Antonio :

Juan Antonio Rufes is a software engineer with 30 years of experience, specializing in low-level and systems programming, primarily in C, C++, 0x86 assembly, and Python. His expertise includes Windows and Linux optimization, Windows kernel drivers for antivirus and encryption, TCP/IP protocol analysis, and low-latency financial systems such as smart order routing and FPGA-based trading systems. He has worked with software companies, investment banks, and hedge funds. Juan holds an MSc in electrical engineering from the Polytechnic University of Valencia, Spain.



Ihre Fragen, Wünsche oder Anmerkungen
Vorname*
Nachname*
Ihre E-Mail-Adresse*
Kundennr.
Ihre Nachricht*
Lediglich mit * gekennzeichnete Felder sind Pflichtfelder.
Wenn Sie die im Kontaktformular eingegebenen Daten durch Klick auf den nachfolgenden Button übersenden, erklären Sie sich damit einverstanden, dass wir Ihr Angaben für die Beantwortung Ihrer Anfrage verwenden. Selbstverständlich werden Ihre Daten vertraulich behandelt und nicht an Dritte weitergegeben. Sie können der Verwendung Ihrer Daten jederzeit widersprechen. Das Datenhandling bei Sack Fachmedien erklären wir Ihnen in unserer Datenschutzerklärung.