yaclib / yaclib Goto Github PK
View Code? Open in Web Editor NEWYet Another Concurrency Library
Home Page: https://YACLib.github.io/YACLib
License: MIT License
Yet Another Concurrency Library
Home Page: https://YACLib.github.io/YACLib
License: MIT License
Add benchmarks relative to the master.
It is proposed to measure push and execution of 4 types:
A task that is executed faster than
For deterministic we want deterministic time
https://en.cppreference.com/w/cpp/header/chrono
We only need the Clocks, and more specifically the now
method.
https://github.com/google/sanitizers
Maybe add Valgrind, Hellgrind, or something else
Necessary for #6
Code coverage dont check header files, to avoid checking another libraries.
Check it https://github.com/marketplace/actions/include-what-you-use-github-action and add in CI
Check researches and implementations of shared future (e.g. libunifex, articles, etc.). Try to design and implement this abstraction.
Use all checks, otherwise, we will discuss which ones to disable in PR
Necessary for #6
This class execute only last N
tasks using IExecutorPtr
.
To implement use SPSC lock-free fixed-size queue (ring buffer)
context
Recommend to look at this link https://www.agner.org/optimize
This class should help to set service values for thread pool threads:
It is also a cache of threads between the operating system and a set of user IThreadPool's with a dynamic size or lifetime that is different from the lifetime of the program.
Need to add benchmarks against at least some of these libraries:
ITask
<=> Intrusive node + vtable + virtual void Call() = 0
detail::Task(functor<void()>)
-> Functor member + public inheritance ITask
, void Call()
call functor<void()>
detail::CallbackTask(functor<void(Args...)>) -> Functor member + raw memory for Args + public inheritance ITask
, void Call()
call functor<void(Args...)>
(Args...), method some like SetArgs(Args...)
CreateCallback <=> detail::CallbackTask(functor<void(Args...)>)
when we should execute callback and know its args we:
callback->SetArgs(args...);
tp->Execute(callback)
or if inline callback call
callback->Call(args....)
This class Execute()
tasks strictly sequentially using IExecutorPtr
.
To implement use Wait-free MPSC queue
config.hpp
and cmake
)First of feel free to ask me(@MBkkt) any questions about this task, often the task may not be described in enough detail for devs who don't have the full context.
Make T SharedFuture<T>::Get() const;
"Allocate" the mutex inside the SharedFuture class, not on the stack as is the case with T Future::Get() &&
WhenAll combinator
Container<Future> -> Future<Container>
Container<Future> -> Future
Container maybe any std container or Args...
Generate automatically and upload to a project static site using GitHub and GitHub actons
https://docs.google.com/document/d/1yIAYmbvL3JxOKOjuCyon7JhW4cSv1wy5hC0ApeGMV9s/pub
Design doc
Also, see this golang/go#8899
I also think. if we will implement this, we should write to Dmitry, he wants us to mention him in the file or not. Also a license issue.
Make LastInlineCall
Make typed tests
https://en.cppreference.com/w/cpp/thread
yaclib::std::
C++ 17:
C++ 20:
Maybe?
Definitely no.
CallerCore
ITask::Cancel
WaitGroup
: wait many futures without their invalidation and without overhead expect one mutex/condvarstruct WaitGroup { // not copy/move
template<typename T>
void Add(Future<T>& f) &;
void Wait() &;
};
This abstraction will have to be used in intrusive containers.
Therefore, it needs to be allocated on the heap and there should be pointers to prev/next in it.
And don't forget to write tests
Main idea to create:
Future<void> WhenAll(...);
... can be any type of futuresFuture<vector<T>> TakeAll(...);
... can be same type of futuresFuture<std::tuple<T...>> TakeAllArgs(...);
... can be any type of futuresFuture<void> WhenAny(...);
... can be any type of futuresFuture<vector<T>> TakeAny(...);
... can be same type of futuresFuture<std::tuple<T...>> TakeAnyArgs(...);
... can be any type of futuresIMailBoxTask
это ITask
с несколькими особенностями
IExector
(Если это не так то не используйте ее)N
, это число сколько раз она исполнится:auto task = CreateMailBoxTask(2, lamdda)
// when timer tick
any_executor->Execute(task);
Хочется, чтобы таска исполнялась минимальное число раз между количеством тиков и N
.
Собственно N
будет строгим минимумом тогда когда тики происходят быстрее чем таска исполняется,
TODO(MBkkt)
Лучшее описание
IntusiveList
and std::mutex
Write basic documentation using GitHub Flavored Markdown:
Add implementation based on atomic finite state machine
Add tests
But return Awaiter that works with co_await
Wait-free MPSC queue
std::random_device should be deterministic in deterministic tests
If we mix headers and links in markdown it incorrect render in doxygen. (For example, check SANITIZERS.md
). Check how to fix this doxygen bug
See https://jothepro.github.io/doxygen-awesome-css/ for details
Check WhenAll examples and add WhenAny examples in documentation
WhenAny combinator
Container<Future> -> Future
Container maybe any std container or Args...
Implement more tests for future/promise
Write different implementations IThreadPool
IntusiveList
with std::mutex
IntusiveList
with spinlock
IntusiveList
with std::mutex
per threadIntusiveList
with spinlock
per threadMichael Scott queue
Michael Scott queue
per threadLock-free MPSC queue
with std::mutex
for consumersLock-free MPSC queue
with spinlock
for consumersLock-free MPSC queue
per threadLock-free MPSC queue
with std::mutex
and per-thread SPSC queue
for consumersLock-free MPSC queue
with spinlock
and per-thread SPSC queue
for consumersLock-free deque
Lock-free deque
per threadAnd whatever else you can invent
P.S. per thread means you should use work-stealing or work-distribution
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.