Ludovic 'Archivist'
Ludovic 'Archivist'
And since in C++ you write the scheduler yourself, you hence have control whether tasks are executed according to which priorities
Ludovic 'Archivist'
Ludovic 'Archivist'
Cooperative multithreading vs preemptive multithreading and all that
~
But why I have never know of coroutines are heavy used in CPU bound task, in AI library they mostly use OS thread directly
Ludovic 'Archivist'
Ludovic 'Archivist'
Ludovic 'Archivist'
Concurrent performance is of very little concern
~
Maybe writing little code demonstrating it?
Ludovic 'Archivist'
Maybe writing little code demonstrating it?
I demonstrated it at work. On windows you can have a starvation of the coroutine thread for up to 100ms, on Linux it is better, with no starvations being longer than 40ms. Performance wise I have little to no pessimisation when doing chunked processing via C++ ranges and coroutines together
Ludovic 'Archivist'
I used trantor to run the coroutines and Poco thread pool for the separate thread pool
Ludovic 'Archivist'
~
Do you have a simple backend that use that approach, like just returning hardcoded JSON. I will try to compare it with other approach
Ludovic 'Archivist'
The work load was a bunch of large data sha1
Ludovic 'Archivist'
Ludovic 'Archivist'
And for the given example, I did not use the thread pool from drogon
Ludovic 'Archivist'
Just the multithreaded event loop
~
Because Java and other can have async Postgres driver, C++ should can too
~
Using thread pool for Postgres will not scale well :( it reminds me of old Java 😅
Ludovic 'Archivist'
Ludovic 'Archivist'
I could make an async Postgres thunk for drogon but that's above my current paygrade
Ludovic 'Archivist'
Ludovic 'Archivist'
My current project is not in C++ at all, it is all in Elixir so I have no external database
~
~
Because in my experience, the 2 performance is far above Elixir
Ludovic 'Archivist'
I curious to know, what is the reason to pick elixir? Instead of Java or C#?
The application is not performance sensitive but the data is and Elixir allows to have very easy data replication in complex database queries without external database server. Also 80% of the software is telecoms so it is a very suitable tool, and the software has a GPU side part and managing resources across a cluster is easy in Elixir
Ludovic 'Archivist'
Oh and if anything becomes a performance bottleneck I can just write a module in C or C++ or Rust
~
~
Mostly uses managed Kubernetes provided by cloud service for horizontal scalling
~
And Redis
Ludovic 'Archivist'
Ludovic 'Archivist'
And we don't do cloud because it is overpriced crappy service
🇷🇺 Ryan
are you going to?
does it matter? if i am not reading in here, i am not disrupting nor causing issues. if i am reading, i am here to learn and get feedback (eventually) about C++ and nothing else. does it harm anything if i am often behind?
🇷🇺 Ryan
i literally have learned at least the minimal basics of C++ language but i'd say only maybe 10% of the entire knowledgebase. i am still a super newb and have a long way to go. To quantify, i have watched most but not all of CB's instructional videos on the topic. and i have a ton of books (real hardcopy and e-book) i am still going thru .... slowly. i like to take my time when learning and not rush nor be rushed. i get negative and even backwards effects from being rushed.
🇷🇺 Ryan
in fact i doubt i am at any skill level above C++ 98 ... let alone 2011 or beyond. i am barely starting out.
🇷🇺 Ryan
i cannot wait to get into GUI and async / concurrency ..... and MPP ...
🇷🇺 Ryan
but i am waiting or going slow, anyway lol
🇷🇺 Ryan
i have also been learning Perl 5 and some Scala as well. but those are on back-burner .... C++ has been my main focus for at least a year now.
🇷🇺 Ryan
🇷🇺 Ryan
i am a hardware guy... but i did master BASIC before i mastered hardware.
🇷🇺 Ryan
🇷🇺 Ryan
🇷🇺 Ryan
we are entering that era of hardware AI already. barely.
🇷🇺 Ryan
we also have NPUs now. tiny amount. and DPUs as well.... interesting times.
🇷🇺 Ryan
the old Commodore Amiga did a lot of tasks in hardware parallel and it seems ( i hope i am not wrong but i may be ignorant to an extent) that we soon see advances in PC architecture where every kind of task can all execute in parallel on their own chips that are independent.
🇷🇺 Ryan
i want to learn RISC-V someday and i am already reading about Quantum computing ... just to stay informed on new hardware paradigms and how programming in C and C++ and even with scripts .... may all change.
🇷🇺 Ryan
Vlad
🇷🇺 Ryan
if that is what he wants to believe, then it sounds like he is talking only about code that operates on hardware sys calls and does not use an OS AT ALL .... ?
🇷🇺 Ryan
embedded code is something i will have to learn eventually though
🇷🇺 Ryan
i mean, coroutines in C++ are new since what, C++21 or 23????
🇷🇺 Ryan
idk...
Vlad
🇷🇺 Ryan
C++20
aha i do know some things then
Vlad
🇷🇺 Ryan
Vlad
And coroutines have support for suspention and resume
Vlad
One might thought that you may use it for something I dunno
🇷🇺 Ryan
i first learned about task switching the way most newbs did, in windows 3.x .... i never started using *nix until 1998
Vlad
You set up a timer and give it your callback and kernel calls that for you
🇷🇺 Ryan
wow..,.. is that raw in hardware or part of most OS design?
🇷🇺 Ryan
oh you said kernel .... so OS :D
Vlad
Cause you can't handle interrupts in usermode
🇷🇺 Ryan