Login
You're viewing the y.diskcat.com public feed.
  • Nov 12, 2026, 5:18 PM

    @mei "Multithreading" in JavaScript is only possible through the Worker API, which executes a script (by URL or stringified code) in a new V8 runtime (process) in node, and various levels of isolation in browsers.

    How the Worker API is implemented is defined somewhere deep in the weeds of the engine, but it has the same effect as just fork, execv into a new runtime, and a couple extra steps to set up the default messaging channels and some global constants.

    💬 1🔄 0⭐ 0

Replies

  • Nov 12, 2026, 5:25 PM

    @mei ah, actually, it appears that Worker calls libuv, which simply wraps pthread_create. So it isn't a separate process. The V8 runtime is entirely isolated tho, so the thread is in no way "light weight".

    💬 1🔄 0⭐ 0
  • 💬 0🔄 0⭐ 0
  • Nov 12, 2026, 5:56 PM

    @mei heh, it very nearly abused $1, because that's the most reliable way of finding the location of the JS file that was first executed.

    I ended up not needing it, but only narrowly.

    💬 0🔄 0⭐ 0