Book Image

C++ Programming for Linux Systems

By : Desislav Andreev, Stanimir Lukanov
Book Image

C++ Programming for Linux Systems

By: Desislav Andreev, Stanimir Lukanov

Overview of this book

Around 35 million Linux and almost 2 billion Android users rely on C++ for everything from the simplest embedded and IoT devices to cloud services, supercomputing, and space exploration. To help you produce high-quality software, two industry experts have transformed their knowledge and experience into practical examples in system programming with C++ Programming for Linux Systems. In this book, you'll explore the latest C++20 features, while working on multiple specific use cases. You’ll get familiar with the coroutines and modern approaches in concurrent and multithreaded programming. You'll also learn to reshape your thinking when analyzing system behavior in Linux (POSIX) environments. Additionally, you'll discover advanced discussions and novel solutions for complex challenges, while approaching trivial system operations with a new outlook and learning to choose the best design for your particular case. You can use this workbook as an introduction to system programming and software design in Linux or any Unix-based environment. You’ll also find it useful as a guideline or a supplement to any C++ book. By the end of this book, you’ll have gained advanced knowledge and skills for working with Linux or any Unix-based environment.
Table of Contents (15 chapters)
Free Chapter
1
Part 1:Securing the Fundamentals
7
Part 2:Advanced Techniques for System Programming

Introducing coroutines

At the end of your journey, we’d like to remind you about the knowledge you received in Chapter 1 and Chapter 2 about processes and threads. If you remember well, a process is simply a running instance of a program. It has its respective address space, which is not shared with others, except through shared memory. Threads reside in a process, and they cannot exist outside of them, although both processes and threads are treated as tasks in Linux. They are scheduled in the same manner and have the same controlling structures on the kernel level. Still, threads are considered lightweight because the bigger overhead for the initial load of a program is taken by the parent process.

But this is not the full picture. There are fibers and coroutines as well. If the processes and threads are truly concurrent and working in parallel over shared resources, fibers are just like threads but are not concurrency-compliant. While threads often depend on preemptive...