Menu

Post image 1
Post image 2
Post image 3
Post image 4
Post image 5
1 / 5
0

Node Turns Waiting Into Events. Go Moves Context Switching Into User Space.

DEV Community·Harrison Guo·about 1 month ago
#Lm79o82t
#include#go#node#function#runtime#user
Reading 0:00
15s threshold

Most discussions of TypeScript/Node vs Go concurrency stop at the surface: Node is async, Go is threaded. That framing isn't wrong — it just isn't deep enough to be useful when you're picking a runtime, debugging a tail-latency problem, or explaining to your team why one of the services keeps falling over under CPU load. The real difference is not async vs threaded. It's a question about where, in the system, suspended work lives — and what shape it takes when it's resumed. tl;dr — Both Node and Go refuse to let the CPU sit idle while a request waits on I/O. They disagree on the unit of scheduling. Node's unit is the continuation — the tail of an async function captured as a heap closure. Go's unit is the goroutine — a full call stack the runtime can suspend and resume in user space. That single decision cascades into every other property of each runtime. The Wrong Question "Async vs threaded" is the wrong frame because it makes you think the choice is between paradigms. It isn't.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More