4 ms·
Yeah, it makes a lot of sense in the JVM or Golang runtime where you're already paying for indirection. My first guess for why JS didn't do greenthreading is si
by hot_gril 2y ago
Yeah, it makes a lot of sense in the JVM or Golang runtime where you're already paying for indirection. My first guess for why JS didn't do greenthreading is simplicity of implementation.
I know that threads are expensive to schedule in the OS, but admittedly I don't remember exactly why. There's context-switching and such, but greenthreads also have to do their own analog of that. I know there are answers online of why OS threads can't be cheap like Golang greenthreads, just gotta dig through them.
Also turns out someone asked a similar question on Reddit, but I don't see an answer that nails it: https://www.reddit.com/r/ProgrammingLanguages/comments/prr8ju/arent_green_threads_just_better_than_asyncawait/ https://www.reddit.com/r/ProgrammingLanguages/comments/prr8j...