Same old bloody same old...

Discussion in 'NZ Computing' started by Lawrence D'Oliveiro, Jul 13, 2007.

  1. I wonder how many times people have "discovered" this old attack

    The fundamental issue is that, on your typical multitasking system,
    measuring the CPU time usage of a process is an inherently imprecise act.
    Doing it more accurately would itself use up so much CPU time that it
    wouldn't be worth doing. So the usual procedure is to have a per-CPU
    interrupt routine run every clock tick and increment a CPU usage counter
    for whatever process happens to be current on that CPU at the time.

    Of course, if a process can arrange to confine most of its CPU usage to the
    times _between_ clock ticks, that usage will end up underreported.

    I discovered this by accident many years ago, as a student. I was trying to
    write a program that would consume precisely-controlled amounts of CPU, by
    putting itself to sleep at specified intervals. On my first test, it was
    sleeping every 1/100th of a second (which happened to coincide with the
    clock tick interrupt rate on the VAX-11/750 machine I was using). It
    succeeded in bringing the entire machine to its knees, while recording
    hardly any CPU usage at all.
    Lawrence D'Oliveiro, Jul 13, 2007
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.