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

Running a separate scheduling thread seems very wasteful and non scalable. What is your preemption condition? Can't you just increment a counter in isScheduled(this) and synchronously invoke the scheduler every N or so checks?


The preemption condition is literally time. Just need to set a flag in threads after so much time.

There is only one scheduling thread.

That could work but that would slow down while loops of lightweight threads, but it shall work.

The design is designed to avoid putting if statements inside loops for performance reasons.

If you have 128 core machine then 1 thread for scheduling might be worthwhile rather than slow down 128 cores worth of work with an if statement.

But is there a way to run something a timer on the kernel or something so I don't need to waste a thread? It would presumably be asleep most of the time anyway.




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

Search: