Skip to content

Commit d276f1e

Browse files
feat: add concurrency exercises handbook (#31)
* feat: add concurrency exercises handbook * feat: english version * fix: site build error
1 parent c98136e commit d276f1e

403 files changed

Lines changed: 24368 additions & 10698 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
---
1919

2020
<!-- COVERAGE_START -->
21-
![English Coverage](https://img.shields.io/badge/en_coverage-98%25-green.svg) 403/411 docs translated
21+
![English Coverage](https://img.shields.io/badge/en_coverage-100%25-green.svg) 420/420 docs translated
2222
<!-- COVERAGE_END -->
2323

2424
## 这是什么项目

documents/en/404.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
layout: page
3+
title: Page Not Found
4+
description: 404 Page Not Found
5+
tags:
6+
- host
7+
chapter: 0
8+
order: 0
9+
translation:
10+
source: documents/404.md
11+
source_hash: 5e0383392a35876a04fd1237a4ab9b52d22c34468522ffe9ee5a8998b76926bc
12+
translated_at: '2026-05-26T10:08:15.033103+00:00'
13+
engine: anthropic
14+
token_count: 60
15+
---
16+
# 404
17+
18+
**Page Not Found**
19+
20+
The page you are looking for does not exist or has been moved.
21+
22+
[Back to Home](index.md) · [GitHub Repository](https://github.com/Awesome-Embedded-Learning-Studio/Tutorial_AwesomeModernCPP)

documents/en/appendix/index.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,21 @@
11
---
22
title: Appendix
3-
description: "Supplementary reference material and glossary"
3+
description: Supplementary reference material and glossary
4+
translation:
5+
source: documents/appendix/index.md
6+
source_hash: 4ece544c590af26fa13604339501a6c17dbab838bea665772db30ebb461703f1
7+
translated_at: '2026-05-26T10:08:15.153796+00:00'
8+
engine: anthropic
9+
token_count: 48
410
---
5-
611
# Appendix
712

8-
Supplementary reference material to help you better understand the tutorial.
13+
Supplementary reference material to help you better understand the concepts in this tutorial.
914

1015
## References
1116

1217
<ChapterNav variant="sub">
1318
<ChapterLink href="terminology/">Glossary</ChapterLink>
1419
</ChapterNav>
1520

16-
Standard Chinese-English technical term translations
21+
Standard translation reference table for Chinese and English technical terms

documents/en/appendix/terminology.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
11
---
22
title: Glossary
3-
description: Standard Chinese-English Technical Terminology Translation Reference
4-
Table for the Project
3+
description: Standard translation reference table for technical terms in this project
54
tags:
65
- 基础
76
chapter: 99
87
order: 0
8+
translation:
9+
source: documents/appendix/terminology.md
10+
source_hash: 196eb84369e66ed9a72950957ad430ac6dd024a4dbc092a4775a829165660d31
11+
translated_at: '2026-05-26T10:09:25.855956+00:00'
12+
engine: anthropic
13+
token_count: 1617
914
---
1015
# Glossary
1116

12-
This document compiles the core terms used throughout the project tutorials, grouped by domain, with Chinese and English translations. Its purpose is to ensure consistent terminology across all articles, preventing the same concept from being translated differently in different places.
17+
This document compiles the core terms used throughout the project tutorials, grouped by domain, with Chinese and English translations. The goal is to ensure consistent terminology across all articles, preventing the same concept from being translated differently in different places.
1318

1419
## C++ Language Features
1520

documents/en/compilation/01-compilation-and-linking-overview.md

Lines changed: 90 additions & 84 deletions
Large diffs are not rendered by default.

documents/en/compilation/02-reuse-concept.md

Lines changed: 39 additions & 33 deletions
Large diffs are not rendered by default.
Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
2-
title: 'In-depth Understanding of C/C++ Compilation and Linking Techniques 3: How
3-
to Create and Use Static Libraries'
2+
title: 'Deep Dive into C/C++ Compilation and Linking Techniques 3: How to Create and
3+
Use Static Libraries'
44
description: ''
55
tags:
66
- cpp-modern
@@ -10,26 +10,32 @@ difficulty: intermediate
1010
platform: host
1111
chapter: 13
1212
order: 3
13+
translation:
14+
source: documents/compilation/03-creating-and-using-static-libs.md
15+
source_hash: 79ffd88cde2473e0b07e01fd5de01422eb942c50868bd9db2293d5ac3e11a9bc
16+
translated_at: '2026-05-26T10:10:06.991070+00:00'
17+
engine: anthropic
18+
token_count: 871
1319
---
1420
# Deep Dive into C/C++ Compilation and Linking Part 3: How to Create and Use Static Libraries
1521

16-
In the previous blog post, I briefly covered the basic introduction to static and dynamic libraries. I have linked them here:
22+
In the previous blog post, I briefly touched upon the basic introduction to static and dynamic libraries. I have included the links here:
1723

1824
> [Deep Dive into C/C++ Compilation and Linking - CSDN Blog](https://blog.csdn.net/charlie114514191/article/details/152921903)
1925
>
2026
> [Deep Dive into C/C++ Compilation and Linking Part 2: Introduction to Dynamic and Static Libraries - CSDN Blog](https://blog.csdn.net/charlie114514191/article/details/154828385)
2127
22-
So earlier, we simply explained what the essence of a static library is. Although today, using dynamic libraries for code sharing is a more fundamental strategy, for the sake of completeness—and because I personally like using static libraries to package something that only depends on `C/C++` the most basic runtime (honestly, I have no solid technical reason for this choice; I just don't like feeding a massive chunk of relocatable files directly to the linker)—let's continue.
28+
So earlier, we briefly covered what the essence of a static library is. Although today, using dynamic libraries for code sharing is a more fundamental strategy, for the sake of completeness—and because I personally like using static libraries to package something that only depends on `C/C++` the most basic runtime (honestly, I have no deep technical reason for this choice; I just don't really like feeding a massive blob of relocatable files directly to the linker)—let's continue.
2329

2430
## How Do We Create a Static Library?
2531

2632
### `ar` Tool
2733

28-
So a natural question arises: we previously learned the fundamental principle of a static library (an organic combination of several relocatable files), but how do we actually create one? The answer is a small yet powerful tool—`ar` (Archiver).
34+
So a natural question arises: we previously learned the fundamental principle of a static library (an organic combination of several relocatable files), but how do we actually create one? The answer is by using a small yet powerful tool—`ar` (Archiver).
2935

30-
Let me briefly introduce `ar`! It is a tool used to create, modify, and extract **archive files**. These archive files typically end with the `.a` extension (where "a" stands for archive), and their most common use case is packaging object files (`.o` files) to create **static libraries**. On Linux, if we are creating a static library (at least a static library) and decide to name it `Charlie`, the generated library will generally be `libCharlie.a`.
36+
Let me briefly introduce `ar`! It is a tool used to create, modify, and extract **archive files**. These archive files typically end with the `.a` extension (where "a" stands for archive), and their most common use case is packaging object files (`.o` files) to create **static libraries**. On Linux, when we create a static library—assuming we decide to name the library `Charlie`the generated library will generally be `libCharlie.a`.
3137

32-
Some might wonder why it must start with `lib`. Wouldn't generating `Charlie.a` be more intuitive? The core reason is: **this is dictated by the working conventions of the linker when we perform linking later**. Most commonly, when we `gcc/g++` compile and prepare to link objects, we dispatch `ld` to link the target libraries and relocatable files. Generally, upper-level build tools prefer using the `-L` flag to specify the search directory combined with `-l` (a lowercase L) to find the library. For example, when we try to provide the well-known `math` static library to `main.c` at a specified path, we might write something like this:
38+
Some of you might wonder why it must start with `lib`. Wouldn't generating `Charlie.a` be much more intuitive? The core reason is: **this is dictated by the working conventions of the linker when we perform linking later**. Most commonly, when we `gcc/g++` compile and prepare to link objects, we dispatch `ld` to link the target libraries and relocatable files. Generally, higher-level build tools prefer using the `-L` flag to specify the search directory, combined with `-l` (lowercase L) to find the library. For example, when we try to provide the `math` static library from a known path to `main.c`, we might write something like this:
3339

3440
```cpp
3541

@@ -43,7 +49,7 @@ The linker does not directly look for a file named `math`. Instead, following co
4349
- The linker automatically prepends the prefix `lib` to this name.
4450
- Then, depending on the situation (and priority), it appends a suffix like `.a` (static library) or `.so` (dynamic library) to form the complete filename.
4551

46-
Therefore, **naming the library file in the `lib<name>.a` format is to proactively cater to the linker's automatic search mechanism**. If the library file is not named in this format, the linker cannot find it via the convenient `-l` option. You would have to link by directly specifying the full path to the library file, which is very cumbersome. Furthermore, this leads to a serious issue that we will revisit when discussing dynamic libraries (for static libraries, it doesn't matter since they get packaged into the target file).
52+
Therefore, **naming the library file in the `lib<name>.a` format is to proactively cater to the linker's automatic search mechanism**. If the library file is not named in this format, the linker cannot find it via the convenient `-l` option. You would have to rely on the clumsy method of specifying the full path to the library file to link it, which is highly inconvenient. Furthermore, this leads to a severe issue that we will revisit when discussing dynamic libraries (for static libraries, it doesn't matter since they get packaged into the target file anyway).
4753

4854
### Common Command Formats for `ar`
4955

@@ -54,38 +60,38 @@ ar [操作码][修饰符] <归档文件名> <文件...>
5460

5561
```
5662

57-
| **Operation Code** | **Description** | **Common Modifiers** | **Example Command** |
58-
| ---------- | ------------------------------------------------------------ | ------------------ | ------------------------------- |
63+
| **Operation Code** | **Description** | **Common Modifiers** | **Example Command** |
64+
| ------------------ | ------------------------------------------------------------------------------- | ------------------------ | -------------------------------- |
5965
| **`r`** | **Insert/Replace**: Adds files to the archive. If a file with the same name already exists, it replaces it. | `v` (verbose output) | `ar rv libmy.a file1.o file2.o` |
60-
| **`t`** | **List**: Displays the list of files contained in the archive. | `v` (verbose output) | `ar t libmy.a` |
66+
| **`t`** | **List**: Displays the list of files contained in the archive. | `v` (verbose output) | `ar t libmy.a` |
6167
| **`x`** | **Extract**: Extracts (unpacks) files from the archive. | `v` (verbose output) | `ar xv libmy.a` |
6268

6369
> Checking the man page is always a good idea: [ar(1) - Linux man page](https://linux.die.net/man/1/ar)
6470
6571
### What About Windows?
6672

67-
This is actually handled by the MSVC toolchain. However, few people do this manually on Windows. On Windows, most people delegate this task to the massive IDE: Visual Studio, or like me, use lightweight Visual Studio Code and delegate to CMake. For specific details, you can check the detailed build logs from CMake, but I won't expand on that here for the sake of brevity.
73+
This is actually handled by the MSVC toolchain. However, few people do this manually on Windows. On Windows, most people delegate this task to the monolithic IDE, Visual Studio, or, like me, use lightweight Visual Studio Code and delegate to CMake. For specific details, you can check the detailed build logs from CMake, but I won't expand on that here for the sake of brevity.
6874

6975
## Where Do We Use Static Libraries?
7076

71-
I thought about this carefully, combining my shallow engineering experience (which I can honestly say is almost non-existent) with the materials I have read. In fact, today, static libraries can almost entirely be replaced by dynamic libraries. However, in the following scenarios, using static libraries is clearly more appropriate. Of course, I use static libraries more often in embedded systems, so I will frame it this way:
77+
I thought about this carefully, combining my shallow engineering experience (which I admit is practically non-existent) with the materials I've read. In fact, today, static libraries can almost entirely be replaced by dynamic libraries. However, in the following scenarios, using static libraries is clearly more appropriate. Of course, since I use static libraries more often in embedded systems, I'll frame it this way:
7278

73-
- **Simplified distribution:** We only need to distribute a single executable file, without carrying a bunch of `.dll` (Windows) or `.so`/`.dylib` (Linux/macOS) files.
79+
- **Simplified distribution:** We only need to distribute a single executable file, without carrying around a bunch of `.dll` (Windows) or `.so`/`.dylib` (Linux/macOS) files.
7480
- **Version locking:** We need to **absolutely guarantee** that our program uses a specific version of a library, free from interference by other versions on the user's system.
75-
- **Small tools or embedded systems:** In environments with strict limitations on the number of files or dynamic linking support.
81+
- **Small utilities or embedded systems:** In environments with strict limitations on file count or dynamic linking support.
7682

7783
## Conversely, What Are the Reasons Not to Use Static Libraries?
7884

79-
Reviewing the previous blog post, we have already explained how static libraries work. So, it is easy to think of the first reason not to use them:
85+
Reviewing the previous blog post, we already explained how static libraries work. So, it's easy to think of the first reason not to use them:
8086

8187
#### Executable Bloat
8288

83-
When focusing on **interface reuse**, using static libraries obviously causes the size of all dependent libraries and executables to increase dramatically (executable bloat). Therefore, **for any module whose purpose is to provide functional interfaces to other dependencies and that operates independently, please use a dynamic library**. In this case, keeping only one copy of the code dependency and letting the operating system and loader automatically coordinate all mapped symbol relationships is clearly the better approach.
89+
When focusing on **interface reuse**, using static libraries obviously causes the size of all dependent libraries and executables to increase dramatically (Executable Bloat). Therefore, **for any module whose purpose is to provide functional interfaces to other dependencies and that stands completely independent, please use a dynamic library**. In this case, keeping only one copy of the code dependency and letting the operating system and loader automatically coordinate all mapped symbol relationships is clearly the better approach.
8490

8591
#### Updates Require Recompilation and Redistribution (Hot Reloading Request)
8692

87-
In scenarios that prioritize **hot reloading**, using static libraries is clearly inappropriate. For example, when we cannot easily replace the executable file itself but only need to update a sub-dependency (say, a library we use has a vulnerability discovered by an enthusiastic open-source developer who promptly reports it to us)—that is, when we discover a security vulnerability or a bug in the library that needs fixing—with a static library, we must **recompile and redistribute the entire application (static linking makes this code a part of the main body rather than a required dependency)**.
93+
In scenarios that prioritize **hot reloading**, using static libraries is clearly inappropriate. For example, when we can't easily replace the executable file itself but only need to update a sub-dependency (say, a library we use has a vulnerability discovered by an enthusiastic open-source developer who promptly reports it to us)—meaning we find a security vulnerability or a bug in the library that needs fixing—with a static library, we must **recompile and redistribute the entire application (static linking makes this code a part of the main body rather than a required dependency)**.
8894

8995
#### Potential Symbol Collisions and Version Management Issues (Symbol Collisions)
9096

91-
If we link **multiple versions** of static libraries or static libraries with **identical symbol names** into the same executable, the compiler/linker will attempt to resolve them, but the risk is very high (if I remember correctly, it drops them randomly based on symbol strength and equality). This is truly dangerous; nobody likes playing a guessing game with their program.
97+
If we link **multiple versions** of static libraries or libraries with **identical symbol names** into the same executable, the compiler/linker will attempt to resolve them, but the risk is very high (if I remember correctly, it drops them based on symbol strength, or randomly discards them if they are equal). This is truly dangerousnobody likes playing a guessing game with their program.

0 commit comments

Comments
 (0)