×
Jinxia Li

I/O multiplexing and JavaScript Event Loop

No Comments

While some said #JavaScript is easy to learn, some said It’s easy to learn partially, but much harder to learn completely or even sufficiently. I agree with the latter point of view.

Just because JavaScript is single-threaded, doesn’t make it easier to learn, why? 

1 ) Concurrency model with a single thread

JavaScript still has a concurrency model that is based on the event loop,  the event loop is NOT part of JavaScript, but the JavaScript runtime environment. 

2 ) Complex control flow 

JavaScript uses a more complex control flow abstraction, I/O multiplexing (vs. process and thread) to achieve application concurrency.

3 ) Memory reasoning

It’s much easier to reason about how threads and processes in a programming language interact or not interact through memory than reasoning about how state changes in I/O multiplexing.

4 ) Code complexity 

I/O multiplexing-based concurrent server requires more code than process-based or thread-based concurrent server.

Please correct me if I’m wrong.

Leave a Comment

Your email address will not be published. Required fields are marked *

By commenting you accept the Privacy Policy