swift-corelibs-libdispatch
ideas5
swift-corelibs-libdispatch | ideas5 | |
---|---|---|
3 | 6 | |
2,426 | 5 | |
0.8% | - | |
6.5 | 7.3 | |
5 days ago | 7 months ago | |
C | ||
Apache License 2.0 | - |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
swift-corelibs-libdispatch
-
Is Parallel Programming Hard, and, If So, What Can You Do About It? v2023.06.11a
GCD/libdispatch is a fantastic approach to concurrency and you can build and install support for non-Apple operating systems:
https://github.com/apple/swift-corelibs-libdispatch
Here’s a simple echo server:
https://github.com/williamcotton/c_playground/blob/master/sr...
Here’s a simple multithreaded database pool:
https://github.com/williamcotton/express-c/blob/master/src/d...
-
Cross-platform I/O built on io_uring and kqueue (in TigerBeetle)
One of the reasons is that libdispatch's I/O functions introduce extra dynamic allocations for internal queueing via `dispatch_async` ([0],[1],[2]) and from an API perspective of realloc-ing ([3]) an internally owned ([4]) buffer.
TigerBeetle, on the other hand, statically allocates all I/O buffers upfront ([5]), treats these buffers as intrusively-provided typed data ([6]) (no growing/owned buffers), and does internal queueing without synchronization or dynamic allocation ([7]).
[0]: https://github.com/apple/swift-corelibs-libdispatch/blob/469...
-
What are the best books/courses for rigorous study of concurrency in iOS?
If you want iOS in particular, read the source of GCD itself.
ideas5
-
WTF is going on with R7RS Large?
https://github.com/samsquire/ideas5#350-structured-interacti...
Knowledgegraph programming language:
-
Railway Oriented Programming
I see a lot of correlations between parsing train tracks and BNF and error handling and state machines.
I wrote a bit about it here
https://github.com/samsquire/ideas5#252-happy-path-state-mac...
-
Async rust – are we doing it all wrong?
How would you do control flow and scheduling and parallelism and async efficiently with this code?
`db.save()`, `download()` are IO intensive whereas `document.query("a")` and `parse` is CPU intensive.
I think its work diagram looks like this: https://github.com/samsquire/dream-programming-language/blob...
I've tried to design a multithreaded architecture that is scalable which combines lightweight threads + thread pools for work + control threads for IO epoll or liburing loops:
Here's the high level diagram:
https://github.com/samsquire/ideas5/blob/main/NonblockingRun...
The secret is modelling control flow as a data flow problem and having a simple but efficient scheduler.
I wrote about schedulers here and binpacking work into time:
https://github.com/samsquire/ideas4#196-binpacking-work-into...
I also have a 1:M:N lightweight thread scheduler/multiplexer:
https://github.com/samsquire/preemptible-thread
-
Ask HN: Could you show your personal blog here?
Thanks for posting this Ask HN question.
I journal ideas and thoughts about computers and software. I am interested in software architecture, parallelism, async, coroutines, database internals, programming language implementation, software design and the web.
https://github.com/samsquire/ideas (2013)
https://github.com/samsquire/ideas2
https://github.com/samsquire/ideas3
https://github.com/samsquire/ideas4 <-- this is recent but needs editing
https://github.com/samsquire/ideas5 <-- this is what I'm working on now
https://github.com/samsquire/startups
https://github.com/samsquire/blog <-- thoughts I want to write about, but incomplete
I use README.md on GitHub and create a heading at the bottom for each entry. I use Typora on Windows or the GitHub web interface to edit.
-
Our Plan for Python 3.13
My deep interest is multithreaded code. For a software engineer working on business software, I'm not sure if they should be spending too much time debugging multithreaded bugs because they are operating at the wrong level of abstraction from my perspective for business operations.
I'm looking for an approach to writing concurrent code with parallelism that is elegant and easy to understand and hard to introduce bugs. This requires alternative programming approaches and in my perspective, alternative notations.
One such design uses monotonic state machines which can only move in one direction. I've designed a syntax and written a parser and very toy runtime for the notation.
https://github.com/samsquire/ideas5#56-stateful-circle-progr...
https://github.com/samsquire/ideas4#558-state-machine-formul...
The idea is inspired by LMAX Disruptor and queuing systems.
-
Is Parallel Programming Hard, and, If So, What Can You Do About It? v2023.06.11a
https://github.com/samsquire/ideas5/blob/main/NonblockingRun...
The design is that we have three groupings of thread types. The application starts up some application threads which are not associated with a request, these service multiconsumer multiproducer thread safe ringbuffers in lightweight threads with a Go-erlang-like lightweight process runtime. (My simple lightweight thread runtime is https://github.com/samsquire/preemptible-thread) We also multiplex multiple network clients sockets across a set number of kernel threads which I call control threads. Their responsibility is to dispatch work to a work stealing thread pool ASAP which has its own group of threads. So we pay a thread synchronization cost ONCE per IO which is the dispatch from the control thread to a thread pool thread. (Presumably this is fast, because the thread pool threads are all looping on a submission queue)
We split all IO and CPU tasks into two halves: submit and handle reply. I assume you can use liburing or epoll in the control threads. The same with CPU tasks and use ringbuffers to communicate between threads. We can always serve client's requests because we're never blocked on handling someone else's request. The control thread is always unblocked.
I think this article is good regarding Python's asyncio story:
What are some alternatives?
Hopac - http://hopac.github.io/Hopac/Hopac.html
c_playground - C Playground
preemptible-thread - How to preempt threads in user space
tigerbeetle - The distributed financial transactions database designed for mission critical safety and performance.
express-c - Fast, unopinionated, minimalist web framework for C
startups - a list of startup ideas
ThreadPool - A simple C++11 Thread Pool implementation
Rouille, Rust web server middleware - Web framework in Rust
blog - My personal blog
go-cleanarchitecture - An example Go application demonstrating The Clean Architecture.