V
V
Vitaly2017-05-01 20:44:26
C++ / C#
Vitaly, 2017-05-01 20:44:26

How are low-level operations distributed across threads?

There is an Event Loop in node.js. It also contains requests to C++ libraries. When a library request is made, EL continues with other events on the stack. But how is the simultaneous execution of library services and the main event loop organized? Each request creates a separate thread, or can an actor be created for each service, or maybe all services are managed by an engine that creates actors one-time according to some optimized scheme?
I would like to understand more deeply how work with threads is going on at the system level. Any interesting solutions on this topic from the "how could it be" series will also do.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
Y
Yustas Alexu, 2017-05-01
@vitali1995

Here is a good article on the subject.
And here and here in more detail.

D
dummyman, 2017-05-01
@dummyman

I do not understand the question. If you want to understand node deeper, see the source codes. There is no more efficient way.
EventLoop is nothing but

while(1) {
   // а здесь тысячи if и switch
}

... it's fantastic. Node performs work in one thread of one process and can ask the system to start more processes, all this is described here .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question