Slashdot Mirror


Robert Love Explains Variable HZ

An anonymous reader writes "Robert Love, author of the kernel preemption patch for Linux, has backported a new performancing boosting patch from the 2.5 development kernel to the 2.4 stable kernel. This patch allows one to tune the frequency of the timer interrupt, defined in 2.4 as "HZ=100". Robert explains 'The timer interrupt is at the heart of the system. Everything lives and dies based on it. Its period is basically the granularity of the system: timers hit on 10ms intervals, timeslices come due at 10ms intervals, etc.' The 2.5 kernel has bumped the HZ value up to 1000, boosting performance."

7 of 62 comments (clear)

  1. In FreeBSD by CounterZer0 · · Score: 3, Interesting

    This is actually a easy to tune kernel config variable. Quick and easy performance boosts to be had by all!

  2. Re:It doesn't improve performance. by pyman · · Score: 2, Interesting
    Interestingly enough, that is basically the only major difference between NT4 Server and NT4 Workstation. I believe there was also a flag in the registry somewhere which apps could query to determine whether they were on a Server or Workstation. If you changed this setting, it inexplicably was reset when you next viewed the registry. After some research I discovered there is a tiny thread in the kernel specifically for checking and resetting that particular registry setting...

    NT Server has a larger timeslice and more caching for some system functions, while NT Workstation has a smaller timeslice with caching geared for user apps.

    I know NT is old technology, and I'm not sure if this still applies to the latest MS offerings. Hardly justifies the price difference between Server and Workstation!

    --
    a ^= b; b ^= a; a ^= b;
  3. Re:It doesn't improve performance. by Piquan · · Score: 3, Interesting

    Okay, after re-reading the article, I did see one performance gain this could get: the case of select/poll. (This is blatantly stated in the article; I shot my mouth off before reading the article closely enough.)

    Under BSD, as I understand it (I don't have the Daemon Book handy, but a quick reading of the source seems to agree), select will put a process on the wait queue until something arrives. During a select, the kernel does nothing with the process-- timer or not.

    From the look of the article, under Linux, select actually does some sort of polling at or related to HZ. It may be on some sort of almost-run queue: a selecting process gets allocated timeslices; on its slice, it polls and either returns to userland or goes back to onto the almost-run queue. I don't have time to verify that-- I don't know my way around the Linux kernel-- but it seems to be reasonable, based on the article. Can I get a Linux developer to confirm/deny my guess?

    So it seems that in the case of something selecting, primarily on an otherwise idle or near-idle system, increasing HZ may improve performance. This situation is less common than it used to be in today's world of multithreaded servers (since each thread typically blocks only on a single fd), but it's still potentially significant.

  4. Re:Moore's law by WolfWithoutAClause · · Score: 4, Interesting
    Whoa! What architecture is that!

    All of them AFAIK.

    That just doesn't sound right.

    Well, it is. Deal ;-)

    The problem occurs when the memory management unit gets modified to maintain the virtual memory 'illusion'. Then you have to flush the caches to maintain consistency. Of course it doesn't happen on every clock tick, you hope.

    That means that all the caches above the memory management unit need to get flushed. This includes the program cache; and any other data too.

    I did a quick check on the web for this, but I haven't managed to find a good reference to where the MMU is placed in the different architectures yet.

    Anyway, that's one of the main reasons the OS scheduling isn't shorter, but any decent OS has to do quite a bit of dorking around at that time.

    --

    -WolfWithoutAClause

    "Gravity is only a theory, not a fact!"
  5. Re:It doesn't improve performance. by Anonymous Coward · · Score: 1, Interesting

    This setting is still there in W2K
    System Control Panel -> Performance -> Optimize Performance for 'Applications' or 'Background Services'.

    NT 4.0 Server's default was oddly "Applications"!

    NT also has a priority boost for interactive apps. However, if the GUI is 'dead' for a long period of time (such as on a server), it will stop doing this. That's why if you walk up to an even lightly loaded W2K server, it's got that X11-style laggy mouse that your workstation never has.

    AFAICT, there's no real operational difference between "Server" and "Workstation" at least for NT4 and 5, althout at least W2K Server has some sane non-workstation default settings. The kernel thread/registry entries are for licencing purposes only.

  6. Robert Love to talk about all this in LA by irabinovitch · · Score: 2, Interesting

    Robert Love will be giving a talk 2.5 and the preption patches at the Southern California Linux Expo
    If you use the promo code: F633F you can get into the expo free.

    1. Re:Robert Love to talk about all this in LA by irabinovitch · · Score: 2, Interesting