asynchronous programming c#/.NET vs node.js: Does C#/.NET use an event loop?
OK so as far as I can tell, the semantics of using async/await with C# and Node.js are roughly equivalent for asynchronous IO (and fundamentally it's Tasks and Promises). This is on the surface only as TPL is more flexible since it can leverage threads which enable parallelism.
Under the covers libuv provides the eventloop for Node.js. As per the Node docs
The event loop is what allows Node.js to perform non-blocking I/O operations — despite the fact that JavaScript is single-threaded — by offloading operations to the system kernel whenever possible.
So it seems that the heart of asychronous I/O for Node.js is the event loop. Similarly, I'd expect C#/.NET to offload asynchronous operations to the system kernel (not by default, but with async/await or Task continuations). Is this true? If so, then how? For example, does .NET use an event loop? I've never heard of one.
0 comments:
Post a Comment