Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
acconsta
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
10 ms
·
91.
▲
by
acconsta
11y ago
>You can also write "actual" synchronous code which does the same thing in the kernel. :P And there are several CPU schedulers to choose from to fine-tune when things get woken up. You can. But no matter how good your kernel sc
92.
▲
by
acconsta
11y ago
State machines aren't a general solution — you have to write a state machine by hand for every application. Stackless coroutines are — the compiler (or a clever library) transforms your ordinary function into a state machine.
93.
▲
by
acconsta
11y ago
>It's not the fastest way to do I/O, but Go's approach isn't either Though Go's is fast er . >forego the thread management syscalls and the stack, like nginx does. The problem is nginx uses state machines, whi
94.
▲
by
acconsta
11y ago
The key number for server applications is latency — it doesn't matter if you can spawn 200,000 threads if it takes you four seconds to serve a request. And if a thread can't serve a request before its time slice is up, it gets s
95.
▲
by
acconsta
11y ago
That doesn't seem that unrealistic — you could allocate your stacks using slab allocation, for example. I wonder why the Kernel allocator doesn't do a better job though.
96.
▲
by
acconsta
11y ago
>(Do you have an example of a standards complaint C++ freestanding standard library?) Yes, you've probably heard of libstdc++: https://gcc.gnu.org/onlinedocs/libstdc++/faq.html#faq.what_i... In other words
97.
▲
by
acconsta
11y ago
Just to be clear, the C++ equivalent of Box is unique_ptr. I don't see equivalents of new and delete, but I might be missing them. I see Box::from_raw and core::ops::Placer. Is that what you mean by in-place boxing? But now there are t
98.
▲
by
acconsta
11y ago
The docs (which are generally very good, especially for a language this young) should: 1. Distinguish between abort and panic. 2. Explain that allocation failure is an abort. 3. Explain that a vec can allocate up to twice its nominal size,
99.
▲
by
acconsta
11y ago
> it's basically just some syntactic niceties over existing functionality. OK, cool! Can you point us to the existing functionality, or any example of it being used for stackless coroutines?
100.
▲
by
acconsta
11y ago
1. In practice most embedded toolchains will give you some of the standard library. A standards compliant C++ freestanding library provides new and delete, for example. 2. The libcore allocator API is marked unstable, so even if you go th
101.
▲
by
acconsta
11y ago
1. Stackless coroutines will probably require help from the compiler team (hint hint). It'll be worth it! Think web frameworks with Nginx performance and Rust memory safety. 2. Documentation, stability, portability, quality. I'll
102.
▲
by
acconsta
11y ago
OOM is an abort, not a panic (contrary to the official docs, interestingly) > you're free to provide an alternative stdlib But like... should you have to? > for those rare occasions In kernel programming, allocation failures are
103.
▲
by
acconsta
11y ago
I don't understand that scenario — isn't message B the message thread 1 is waiting for? And to be fair, it does significantly reduce the risk of deadlock by avoiding the complexity of explicit mutexes and condition variables.
104.
▲
by
acconsta
11y ago
I've seen an OCaml library, but I'm searching for solutions in other languages: https://blogs.janestreet.com/introducing-incremental/ http://www.umut-acar.org/self-adjusting-computation
105.
▲
by
acconsta
11y ago
There are still other blockers on embedded though. LLVM doesn't target every architecture, and still no allocator API or OOM handling.
106.
▲
by
acconsta
11y ago
I'm not sure what you mean by the "syscall overhead", but I 100% agree that stackless coroutines in Rust would be amazing. But I'm also skeptical that they can be implemented as a library without compiler support. C++ on
107.
▲
by
acconsta
11y ago
What do you think of C++ coroutines? Two competing standards proposals, already available as libraries: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n445... http://blogs.m
108.
▲
by
acconsta
11y ago
Rust's green threading was... unusual. It attempted to abstract green and native threads into a single API, which lead to a lot of unnecessary overhead: https://github.com/rust-lang/rfcs/blob/0806be4f2821
109.
▲
by
acconsta
11y ago
>This scale isn't unusual at all How many apps are used by 13% of the world population every month?
110.
▲
by
acconsta
11y ago
Maybe Reddit now then? 200 million monthly uniques: https://www.reddit.com/about/
111.
▲
by
acconsta
11y ago
Yeah, but what's the best way to explain concurrency to a general audience?
112.
▲
by
acconsta
11y ago
Sure, but what's the most popular application hosted on AWS? Does it approach 900 million users?
113.
▲
by
acconsta
11y ago
>I feel the language choice is probably the least contributing factor in terms of what's interesting at that scale Erlang and BEAM were designed for highly concurrent messaging applications. Surely that's of some importance.
114.
▲
by
acconsta
11y ago
Also mobile. ARM processors have less-sophisticated branch prediction, and on the lower end, no branch prediction at all!
115.
▲
by
acconsta
11y ago
With OCaml, that depends what you mean by concurrency. There's good async IO, but the runtime is still single threaded (just like Node!). The overall library ecosystem is a disappointing though. https://github.com/janes
116.
▲
by
acconsta
11y ago
>iterators mean that the bounds only need to be checked once. How is that possible with random access or mutable containers?
117.
▲
by
acconsta
11y ago
>I've learned to design the internals of my code around a functional style that makes code composable and the data flow simple. Curious: why not go all the way and use Scala, F#, Clojure, maybe even Haskell?
118.
▲
by
acconsta
11y ago
>Rust gets memory safety without a hit in performance Interesting. How does rust statically verify that array accesses are in bounds?
119.
▲
by
acconsta
11y ago
>Operating systems/embedded applications can generally use `core`. Which doesn't, correct me if I'm wrong, provide a stable allocator API or OOM handling yet. >E.g. games When your client pings 400 servers, how is it do
120.
▲
by
acconsta
11y ago
>Your example is tiny and trivial, the same thing written with locks/whatever would be equally easy to debug. Write the version with explicit locks and condition variables and we'll see if it's as easy to debug. :P >Exa
More ›