百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
M

multi-threading

> 编程语言
开源

实用的多线程教程。支持的语言: C++, Java, C#, Python, JavaScript/Nodejs。

198 stars0 点赞1 次浏览
访问官网GitHub

工具介绍

实用的多线程教程。支持的语言: C++, Java, C#, Python, JavaScript/Nodejs。

MULTIPLE THREADING IN PRACTICE

DESCRIPTION

This repo helps you to practise multithreading in a logical sequence, which is divided into several demonstrations. Plus, you could apply your learning better by doing exercises.

The repo consists of two main sections:

  • "demo" (demostrations).
  • "exer" (exercises).

All the demos (and exers) are really simple, easy to understand, even for difficult terms.

If you find it helpful, please give my repo a star. Thank you.

 

AUTHOR & LICENSE

Author: Thanh Nguyen

  • Email: [email protected]
  • Facebook:

This repo is licensed under the 3-Clause BSD License.

 

LANGUAGES SUPPORTED

Directory name Description
cpp-std C++20 std threading
cpp-pthread C++11 POSIX threading
cpp-boost C++98 Boost threading
csharp C# 7.3 with Dot Net 6
java Java JDK 17
python Python 3.10
js-nodejs Javascript ES2019/Nodejs 18

Special notes for C++ demos/exers: Please read the specified readme.md in corresponding directory.

 

THE NOTES AND ARTICLES

The notes and articles are the additional resources for the source code, which guides you for better research, step by step. You may consider it the comment/description at the beginning of the source code.

…

If you use multithreading or something similar, the context above is truly possible. The reason is that multithreading allows four messages to be sent in parallel, so message order is changed unpredictably when they come to Alice.

In a traditional simple app, there is only one thread (the "main thread"). If you apply multithreading then your app may have multiple threads (including the "main thread").

By learning multithreading:

  • You get closer to the operating system.
  • You can understand various terms: concurrency, parallel, asynchronous, synchronization.
  • You have additional knowledge to learn asynchronous programming and parallel programming.

So, why multithreading?

WHY MULTITHREADING

Multithreaded programs can improve performance compared to traditional simple programs (which use only a single thread).

Multithreading is used as an underlying technique in various fields:

  • Web browsers (Chrome, Edge, Firefox...).
  • Web servers.
  • Graphic editors (Adobe Photoshop, Corel Draw...).
  • Computer games.
  • Database management systems.
  • Networking programming.
  • Video encoders.
  • And more...

Benefits of multithreading:

  • Improving application responsiveness.

    • Any program in which many activities are not dependent upon each other can be redesigned so that each activity is defined as a thread. For example, the user of a multithreaded GUI does not have to wait for one activity to complete before starting another.
  • Using multiprocessors efficiently.

    • Typically, applications that express concurrency requirements with threads need not take into account the number of available processors. The performance of the application improves transparently with additional processors.
    • Numerical algorithms and applications with a high degree of parallelism, such as matrix multiplications, can run much faster when implemented with threads on a multiprocessor.
  • Improving throughput.

    • Many concurrent compute operations and I/O requests within a single process.
  • Program structure simplification.

    • Threads can be used to simplify the structure of complex applications, such as server-class and multimedia applications. Simple routines can be written for each activity, making complex programs easier to design and code, and more adaptive to a wide variation in user demands.
  • Using fewer system resources.

    • Threads impose minimal impact on system resources. Threads require less overhead to create, maintain, and manage than a traditional process.
  • Better communication.

    • Thread synchronization functions can be used to provide enhanced process-to-process communication.
    • In addition, sharing large amounts of data through separate threads of execution within the same address space provides extremely high-bandwidth, low-latency communication between separate tasks within an application.

 

If you want to explore more articles, read here: notes-articles.md.

 

Article references:

  • Oracle Documentation Home, Multithreaded Programming Guide, Chapter 1 Covering Multithreading Basics, Benefiting From Multithreading
  • Oracle Documentation Home, JDK 1.1 for Solaris Developer's Guide, Chapter 2 Multithreading, Benefits of Multithreading

 


REFERENCES

All general references in my repo.

Read here: references.md.

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

C++blocking-queueconcurrencycppcsharp

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言