Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Maybe one day someone will invent a mechanism that can assign some kind of time slice to each event being processed, and if it doesn't return control to the master event coordinator, it could preempt that task somehow, storing the context in which it is executing, and switching to a different one: that way we could write code without having to worry about this kind of stuff.

Thinking about it more, while most people are using these event loops to process unrelated web requests (the data being shared between these different contexts likely being small), we'd still run into mild data corruption issues. :( I guess we'd also then have to figure out a way to protect these critical sections of our code... maybe some way to lock people out of your data while you are using it.

(Silly pipe dream, I know.)

(edit: I've been thinking a lot about this idea, and I realized that once we figure out all of those critical sections in the code, we might actually be able to run multiple event loops on the same machine at once, taking advantage of multiple CPUs or other types of execution core, without having to make any other serious changes to our code. I'm starting to think someone should actually work on this.)



Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: