I have been personally reading the source code of node.js & v8.
I went into a similar problem like you when I tried to understand node.js architecture in order to write native modules.
What I am posting here is my understanding of node.js and this might be a bit off track as well.
Libev is the event loop which actually runs internally in node.js to perform simple event loop operations. It’s written originally for *nix systems. Libev provides a simple yet optimized event loop for the process to run on. You can read more about libev here.
LibUv is an abstraction layer on the top of libeio , libev, c-ares ( for DNS ) and iocp (for windows asynchronous-io). LibUv performs, maintains and manages all the io and events in the event pool. ( in case of libeio threadpool ). You should check out Ryan Dahl’s tutorial on libUv. That will start making more sense to you about how libUv works itself and then you will understand how node.js works on the top of libuv and v8.
- JSConf2011 ( has very irritative sfx)
- Understanding event driven programming
- Understanding the node.js event loop
To see how libeio is used with node.js in order to create async modules you should see this example.
Which appears in all modules is usually calling the function
Task in the threadpool. When it’s complete, it calls the
AfterTask function in the main thread. Whereas
Eio_REQUEST is the request handler which can be a structure / object whose motive is to provide communication between the threadpool and main thread.