[Python-Dev] Python Benchmarks

Tim Peters tim.peters at gmail.com
Sat Jun 3 15:16:04 CEST 2006


[Fredrik Lundh]
>> ...
>> since process time is *sampled*, not measured, process time isn't exactly in-
>> vulnerable either.

[Martin v. Löwis]
> I can't share that view. The scheduler knows *exactly* what thread is
> running on the processor at any time, and that thread won't change
> until the scheduler makes it change. So if you discount time spent
> in interrupt handlers (which might be falsely accounted for the
> thread that happens to run at the point of the interrupt), then
> process time *is* measured, not sampled, on any modern operating
> system:  it is updated whenever the scheduler schedules a different
> thread.

That doesn't seem to agree with, e.g.,

    http://lwn.net/2001/0412/kernel.php3

under "No more jiffies?":

    ...
    Among other things, it imposes a 10ms resolution on most timing-
    related activities, which can make it hard for user-space programs
    that need a tighter control over time. It also guarantees that
    process accounting will be inaccurate. Over the course of one
    10ms jiffy, several processes might have run, but the one actually
    on the CPU when the timer interrupt happens gets charged for the
    entire interval.

Maybe this varies by Linux flavor or version?  While the article above
was published in 2001, Googling didn't turn up any hint that Linux
jiffies have actually gone away, or become better loved, since then.


More information about the Python-Dev mailing list