Hacker News new | ask | show | jobs
by derefr 3392 days ago
> Some programs can use gettimeofday extremely frequently

This is what's usually considered the "root cause" of this problem, though. It's easy enough, if it's your own program, to wrap the OS time APIs to cache the evaluated timestamp for one event-loop (or for a given length of realtime by checking with the TSC.) Most modern interpreters/VM runtimes also do this.

1 comments

Why cache it when the vdso has already solved the problem? Seems best to not stack another mitigation on top of it.
Because you're writing portable code and not every (or even most) systems do said caching.