
update every second or every resched()?
Quote:
> Should I UPDATE the current process' priority every time resched is
called?
> or need I only update all process' priority once a second?
That's difficult to answer without more details.
If you're only updating the priority for the current process, and if your
priority computation is simple, then yes. If your priority computation is
not simple, you should rethink it. If you're recomputing the priority for
everything in the system at every context switch, you should rethink your
design.
The goal of the scheduler is to impose minimal overhead on the system while
switching between tasks. A few clock cycles worth of priority computation
isn't going to hurt. A few hundred (or worse -- a few thousand!) might. Then
again, 1000 cycles on a 1 GHz CPU is only 1 microsecond.
-Matt