On Friday, 27 March 2015 at 22:32:32 UTC, ketmar wrote:
but it is broken! the whole point of async i/o servers is that such servers spend most of their time waiting for i/o. and if you need to do some lengthy calculations, you either spawns a "real thread" and commands it to wake you up when it is finished, or asking external server to do
the job (and wake you when it is finished).

Nah. The point is to get parallel work done with less complexity, but at some performance cost. A design where you have to accurately predict running time per task in order to get decent latency is basically adding back the complexity in order to get a simplistic language/runtime with no benefits to the programmer.

In essence, you should ideally be able to break a task into all it's independent parts and run them in parallel (i.e.. futures, events etc). Preferably batch them to get better performance, and sort them based on when they have to complete. Then have a mechanism that exerts back-pressure if deadlines are in danger, telling the load balancer to back off. How you go about it depends on the application, but that ought to be the ideal for anything that resembles a modern soft realtime platform.

the whole thing of cooperative multitasking is to be... cooperative.

Nah. Cooperative multitasking is a sorry excuse that belongs to the 80s. This should be as transparent as possible. You cannot insert "yield" into an external library.

Reply via email to