Readit News logoReadit News
catern commented on Cap'n Web: a new RPC system for browsers and web servers   blog.cloudflare.com/capnw... · Posted by u/jgrahamc
kentonv · 6 months ago
Almost all ocap systems seem to use event loops -- and many of the biggest ocap nerds I know are also the biggest event loop nerds I know. I'm not actually sure if this is a coincidence or if there's something inherent that makes it necessary to pair them.

But one thing I can't figure out: What would be the syntax for promise pipelining, if you aren't using promises to start with?

catern · 6 months ago
>What would be the syntax for promise pipelining, if you aren't using promises to start with?

Oh, great point! That does seem really hard, maybe even intractable. That's definitely a reason to like cooperative concurrency, huh...

Just to tangent even further, but some ideas:

- Do it the ugly way: add an artificial layer of promises in an otherwise pre-emptive, direct-style language. That's just, unfortunately, quite ugly...

- Use a lazy language. Then everything's a promise! Some Haskell optimizations feel kind of like promise pipelining. But I don't really like laziness...

- Use iterator APIs; that's a slightly less artificial way to add layers of promises on top of things, but still weird...

- Punt to the language: build an RPC protocol into the language, and promise pipelining as a guaranteed optimization. Pretty inflexible, and E already tried this...

- Something with choreographic programming and modal-types-for-mobile-code? Such languages explicitly track the "location" of values, and that might be the most natural way to represent ocap promises: a promise is a remote value at some specific location. Unfortunately these languages are all still research projects...

catern commented on Cap'n Web: a new RPC system for browsers and web servers   blog.cloudflare.com/capnw... · Posted by u/jgrahamc
kentonv · 6 months ago
I disagree that async/await is purely about avoiding overhead of kernel threads. Kernel threads are actually not that expensive these days. You can have a server with 10,000 threads, no problem.

The problem is synchronization becomes extremely hard to reason about. With event loop concurrency, each continuation (callback) becomes effectively a transaction, in which you don't need to worry about anything else modifying your state out from under you. That legitimately makes a lot of things easier.

The Cloudflare Workers runtime actually does both: There's a separate thread for each connection, but within each thread there's an event loop to handle all the concurrent stuff relating to that one connection. This works well because connections rarely need to interact with each other's state, but they need to mess with their own state constantly.

(Actually we have now gone further and stacked a custom green-threading implementation on top of this, but that's really a separate story and only a small incremental optimization.)

catern · 6 months ago
I totally agree with your framing of the value of async/await, but could you elaborate more on why you think that this behavior (which I would call "cooperative concurrency") is important for (ocap?) RPC systems? It seems to me that preemptive concurrency also suffices to make RPC viable. Unless you just feel that preemptive concurrency is too hard, and therefore not workable for RPC systems?
catern commented on Guess I'm a rationalist now   scottaaronson.blog/?p=890... · Posted by u/nsoonhui
achierius · 9 months ago
I think the group that most reliably and effectively funds global health -- at least in terms of total $ -- would be the United Nations, or perhaps the Catholic Church, or otherwise one national government or another.

If you exclude "nations" then it does look to be the Church: "The Church operates more than 140,000 schools, 10,000 orphanages, 5,000 hospitals and some 16,000 other health clinics". Caritas, the relevant charitable umbrella organization, gives $2-4b per year on its own, and that's not including the many, many operations run by religious orders not under that umbrella, or by the hundreds of thousands of parishes around the world (most of which operate charitable operations of their own).

And yet, rationalists are totally happy criticizing the Catholic Church -- not that I'm complaining, but it seems a bit hypocritical.

catern · 9 months ago
Rationalists and EAs spend far more time praising the Catholic Church and other religious groups than criticizing them - since they spend essentially no time criticizing them, and do occasionally praise them.
catern commented on Problems with Go channels (2016)   jtolio.com/2016/03/go-cha... · Posted by u/mpweiher
t8sr · a year ago
When I did my 20% on Go at Google, about 10 years ago, we already had a semi-formal rule that channels must not appear in exported function signatures. It turns out that using CSP in any large, complex codebase is asking for trouble, and that this is true even about projects where members of the core Go team did the CSP.

If you take enough steps back and really think about it, the only synchronization primitive that exists is a futex (and maybe atomics). Everything else is an abstraction of some kind. If you're really determined, you can build anything out of anything. That doesn't mean it's always a good idea.

Looking back, I'd say channels are far superior to condition variables as a synchronized cross-thread communication mechanism - when I use them these days, it's mostly for that. Locks (mutexes) are really performant and easy to understand and generally better for mutual exclusion. (It's in the name!)

catern · a year ago
>If you take enough steps back and really think about it, the only synchronization primitive that exists is a futex (and maybe atomics). Everything else is an abstraction of some kind.

You're going to be surprised when you learn that futexes are an abstraction too, ultimately relying on this thing called "cache coherence".

And you'll be really surprised when you learn how cache coherence is implemented.

catern commented on The Comet is a handheld Linux computer that brings extensibility   mecha.so/comet... · Posted by u/marcodiego
tsm · a year ago
Tangential: I'm looking for a handheld Linux computer that's the approximate size and shape of a GameBoy Advance SP, but with a QWERTY keyboard and wifi. The old Zipit Z-2 would've been perfect. All it needs to run is git and Emacs/org-mode.

It's a surprisingly hard form factor to shop for—anyone have any recommendations?

catern · a year ago
Emacs 30 has a native graphical port to Android, maybe you can just use that on any Android device.
catern commented on Differential: Type safe RPC that feels like local functions   differential.dev... · Posted by u/interpol_p
EdSchouten · 2 years ago
The downside of an approach like this is that it limits you to a single programming language on both the frontend and backend. This is exactly the reason RPC frameworks like gRPC use an IDL.
catern · 2 years ago
Well, that's not fundamental. There are plenty of projects that support generating typed bindings for libraries in one language for use by programs in another language. You could do the same thing here.
catern commented on Let futures be futures   without.boats/blog/let-fu... · Posted by u/ingve
withoutboats3 · 2 years ago
This is what I describe as "stackful coroutines" in the final section of the post.
catern · 2 years ago
Is stackfulness required for what the grandparent describes? It seems possible to do this stacklessly: all functions implicitly compile down to a state machine, but futures are never visible.
catern commented on Write libraries instead of services, where possible   catern.com/services.html... · Posted by u/mooreds
yawboakye · 2 years ago
> By library, I mean any software that can be run by the user: shared objects, modules, servers, command line utilities, and others. By service, I mean any software which the user can't run on their own; anything which depends (usually through an API) on a service provider for its functionality.

this definition makes (open source) self-hosted services libraries too, and so i think it’s wrong and unusable. the distinction between a library and a service is clear enough and colloquial at this point that a redefinition probably obscures rather than clarifies. a library isn’t runnable (~has no binary), a service is runnable (~has a binary)

catern · 2 years ago
What do you suggest as an alternative way to express these concepts?

Colloquially, "library" and "service" have 95% of the correct connotations.

catern commented on Write libraries instead of services, where possible   catern.com/services.html... · Posted by u/mooreds
wqtz · 2 years ago
I don't get it. Can anyone kindly share where this practice can be applied to a commercial software? I am struggling to wrap my head around "how run by user" works where they are using a commercial software service.
catern · 2 years ago
Ultimately, it can't. Proprietary software has fundamental limitations that force proprietary software developers to choose technically inferior designs. It's why in the long run proprietary software is doomed.
catern commented on Write libraries instead of services, where possible   catern.com/services.html... · Posted by u/mooreds
rascul · 2 years ago
> By library, I mean any software that can be run by the user: shared objects, modules, servers, command line utilities, and others. By service, I mean any software which the user can't run on their own; anything which depends (usually through an API) on a service provider for its functionality.

These seem to be odd definitions and they make the article hard to reason about.

catern · 2 years ago
Do you have better suggestions for what words/phrases to use to refer to these two categories?

u/catern

KarmaCake day2276January 3, 2014
About
http://catern.com/

@zcatern on twitter

View Original