|Project Name||Stars||Downloads||Repos Using This||Packages Using This||Most Recent Commit||Total Releases||Latest Release||Open Issues||License||Language|
|Disruptor||16,402||2,163||1,094||2 months ago||29||September 29, 2023||10||apache-2.0||Java|
|High Performance Inter-Thread Messaging Library|
|Rxjava Android Samples||7,559||4 months ago||10||apache-2.0||Java|
|Learning RxJava for Android by example|
|Crossbeam||6,496||1,476||1,148||a day ago||35||April 09, 2023||130||apache-2.0||Rust|
|Tools for concurrent programming in Rust|
|Concurrent Ruby||5,554||205||10 days ago||69||February 24, 2023||43||other||Ruby|
|Scala Best Practices||4,331||a year ago||22|
|A collection of Scala best practices|
|Concurrent Map||3,944||83||336||14 days ago||4||November 08, 2022||31||mit||Go|
|a thread-safe concurrent map for go|
|Golang Set||3,592||503||2,484||a day ago||11||November 29, 2023||5||other||Go|
|A simple, battle-tested and generic set type for the Go language. Trusted by Docker, 1Password, Ethereum and Hashicorp.|
|Libgo||2,942||2||5 months ago||2||April 30, 2020||111||mit||C++|
|Go-style concurrency in C++11|
|Rpmalloc||1,915||a month ago||15||other||C|
|Public domain cross platform lock free thread caching 16-byte aligned memory allocator implemented in C|
|Concurrencpp||1,794||4 days ago||4||mit||C++|
|Modern concurrency for C++. Tasks, executors, timers and C++20 coroutines to rule them all|
Libgo is a stackful coroutine library for collaborative scheduling written in C++ 11, and it is also a powerful and easy-to-use parallel programming library.
Three platforms are currently supported:
Linux MacOSX Windows (Win7 or above,x86 or x64,complie with VS2015/2017)
Using libgo to write multi-threaded programs, it can be developed as fast and logical as golang and Erlang concurrent languages, and has the performance advantages of C++ native.It make it happen that one can serve God and Mammon.
Libgo has the following characteristics:
1.Provide golang's General powerful protocol, write code based on coroutine, can write simple code in a synchronous manner, while achieving asynchronous performance.
2.Supporting massive coroutines, creating 1 million coroutines requires only 4.5 GB of physical memory. (data from real test, in no deliberately compressed stack situation.)
3.Supporting multi-threaded scheduling protocols, providing efficient load balancing strategy and synchronization mechanism, it is easy to write efficient multi-threaded programs.
4.The number of scheduled threads supports dynamic scaling, and there is no head blocking caused by slow scheduling.
5.Use hook technology to make synchronous third-party libraries of linking processes become asynchronous calls, which greatly improves their performance. There's no need to worry that some DB authorities don't provide asynchronous drivers, such as hiredis and mysqlclient, which are client drivers that can be used directly and can achieve performance comparable to that of asynchronous drivers.
6.Both dynamic links and full static links are supported, which makes it easy to generate executable files using C++ 11 static links and deploy them to low-level Linux systems.
7.Provide Channel, Co_mutex, Co_rwmutex, timer and other features to help users write programs more easily.
8.Supports local variables (CLS) of the process, and completely covers all scenarios of TLS (read the tutorial code sample13_cls.cpp for details).
From user feedback in the past two years, many developers have a project with an asynchronous non-blocking model (probably based on epoll, libuv or ASIO network libraries) and then need access to DBs such as MySQL that do not provide asynchronous driver. Conventional connection pool and thread pool schemes are intensive in high concurrency scenarios (each connection have to correspond to a thread for Best performance. Thousands of instruction cycles of thread context switching are intensive and too many active threads will lead to a sharp decline performance in OS scheduling capacity, which is unacceptable to many develops.
In this situation, there is no need to reconstruct the existing code if we want to use libgo to solve the problem of blocking operation in non-blocking model. The new libgo 3.0 has created three special tools for this scenario, which can solve this problem without intrusion: multi-scheduler with isolated running environment and easy interaction (read the tutorial code sample1_go.cpp for details), libggo can instead of the traditional thread pool scheme. (read tutorial code sample10_co_pool.cpp and sample11_connection_pool.cpp for details)
** tutorial directory contains many tutorial codes, including detailed instructions, so that develop can learn libgo library step by step. **
If you find any bugs, good suggestions, or use ambiguities, you can submit a issue or contact the author directly: Email: [email protected]
If you have installed vcpkg, you can install it directly using vcpkg: $ vcpkg install libgo
1.Use cmake to compile and install：
$ mkdir build $ cd build $ cmake ..
$ make debug #Skip it if you don`t want a debuggable versions. $ sudo make uninstall $ sudo make install
2.Dynamic link to glibc: (put libgo at the front of link list)
g++ -std=c++11 test.cpp -llibgo -ldl [-lother_libs]
3.Full static link: (put libgo at the front of link list)
g++ -std=c++11 test.cpp -llibgo -Wl,--whole-archive -lstatic_hook -lc -lpthread -Wl,--no-whole-archive [-lother_libs] -static
Windows: (3.0 is compatible with windows, just use master branch directly!)
0.When using GitHub to download code on windows, we must pay attention to the problem of newline characters. Please install git correctly (using default options) and use git clone to download source code. (Do not download compressed packages)
1.Use CMake to build project.
#For example vs2015(x64)： $ cmake .. -G"Visual Studio 14 2015 Win64" #For example vs2015(x86)： $ cmake .. -G"Visual Studio 14 2015"
2.If you want to execute the test code, please link the boost library. And set BOOST_ROOT in the cmake parameter:
For example： $ cmake .. -G"Visual Studio 14 2015 Win64" -DBOOST_ROOT="e:\\boost_1_69_0"
Like golang, libgo implements a complete scheduler (users only need to create a coroutine without concern for the execution, suspension and resource recovery of the coroutine). Therefore, libgo is qualified to compare the performance of single-threaded with golang (It is not qualified to do performance comparison in different ability).
Test environment: 2018 13-inch MAC notebook (CPU minimum) Operating System: Mac OSX CPU: 2.3 GHz Intel Core i5 (4 Core 8 Threads) Test script: $test/golang/test.sh thread_number
TLS or non-reentrant library functions that depend on TLS implementation should be avoided as far as possible. If it is unavoidable to use, we should pay attention to stop accessing the TLS data generated before handover after the process handover.
connect read readv recv recvfrom recvmsg write writev send sendto sendmsg poll __poll select accept sleep usleep nanosleep gethostbyname gethostbyname2 gethostbyname_r gethostbyname2_r gethostbyaddr gethostbyaddr_r The above system calls are all possible blocking system calls. The whole thread is no longer blocked in the process. During the blocking waiting period, the CPU can switch to other processes to execute.System calls executed in native threads by HOOK are 100% consistent with the behavior of the original system calls without any change. socket socketpair pipe pipe2 close __close fcntl ioctl getsockopt setsockopt dup dup2 dup3 The above system calls will not cause blocking, although they are also Hook, but will not completely change their behavior, only for tracking socket options and status.
ioctlsocket WSAIoctl select connect WSAConnect accept WSAAccept WSARecv recv recvfrom WSARecvFrom WSARecvMsg WSASend send sendto WSASendTo WSASendMsg