Asynchronous programming. Cooperative multitasking

Asynchronous programming. Cooperative multitasking

From the OS point of view, cooperative multitasking is just one execution thread, but inside it the application switches between processing individual requests/commands. If you allocate one process or one thread for processing a single web socket, you significantly limit how many connections you can have on one backend server at the same time. The difficulty of writing applications which uses cooperative multitasking lies on the fact that this process of switching, maintaining the context as such placed on the shoulders of poor developers.

Source: luminousmen.com