Skip to content

Comment on A Solution to CPU-intensive Tasks in IO Loopsparent

Comments

It seems clear to me that's he's talking about the performance / complexity of the algorithm that the article was about? There was significant discussion of the performance in the article, but the original commenter didn't have anything to contribute but a sassy comment. I'd be interested in hearing more about why he/she disagrees with the author's arguments, but frankly, a one-line criticism deserves a one line rebuttal.

Also -- I'm not sure the comparison is accurate. Preemptive multitasking involves suspending the running process, while the author's suggestion involves emptying the queue behind the blocking process... or am I misunderstanding?

But there are two algorithms in context here, and the more complex/efficient one is the OS preemptive scheduler. It then appears that 'willvarfar' is agreeing with 'ot' in a sentence that is structured as a critique. It confused me...

> Also -- I'm not sure the comparison is accurate. Preemptive multitasking involves suspending the running process, while the author's suggestion involves emptying the queue behind the blocking process... or am I misunderstanding?

I think the author's suggestion is to transparently spawn new threads when the event queue becomes blocked by a long running process. As soon as you do this, you lose a major advantage of the event loop in the first place -- namely that you don't have to worry about concurrency control because event handlers are atomic. I don't think (and it doesn't grep) he mentions anything about emptying the queue; why would that ever be a good idea?

spot on :)

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.