0

According to this Wikipedia page (https://en.wikipedia.org/wiki/System_time#Implementation) computers use a programmable interval timer (PIT) that periodically interrupts (when reaching a certain value) the CPU with a timer interrupt routine, adding one tick to the system clock.

Could I make the computer go faster (for processes that use system time as reference) if I alter the value required for the PIT so that it is lower? that way the PIT would generate an interrupt more frequently and the system time would increase faster.

My objective is to make the computer execute time-sensitive processes faster than it should. For example, when playing an audio file, the audio would sound accelerated, or when using an instruction like time.sleep(5) in python, the real-time would actually be lower than 5 seconds (so it would be wrong). I dont want more precision I want the computer to have an internal clock that does not reflect real-time. Is this possible? Maybe altering the hardware?

1 Answer 1

2

According to this Wikipedia page (https://en.wikipedia.org/wiki/System_time#Implementation) computers use a programmable interval timer (PIT) that periodically interrupts (when reaching a certain value) the CPU with a timer interrupt routine, adding one tick to the system clock.

Uff. That's a bit of a broad statement, but let's assume your CPU and your operating systems do that. OK.

Could I make the computer go faster if I alter the value required for the PIT so that it is lower?

No. That has nothing to do with the speed of your computer.´

that way the PIT would generate an interrupt more frequently and the system time would increase faster.

Highly undesirable. That means the actual work that needs to be done is interrupted by a routine that actually contributes nothing.

My objective is to make the computer execute time-sensitive processes faster than it should.

Then you'd program a timer interrupt for your problem, instead of depending on the system tick!

Linux has the High Resolution Timers API, and I'm sure Windows and other operating systems have similar functionality.

For example, when playing an audio file, the audio would sound accelerated, or when using an instruction like time.sleep(5) in python, the real-time would actually be lower than 5 seconds. Is this possible?

Neither audio handling, nor sleeping, require any better precision than the systick would have anyways, AND audio handling might very well be interrupt driven by the actual audio hardware, anyway.

So, you're really barking up the wrong tree here. I think your computer is much faster than you think.

Modifying a default timer is not the solution (aside from breaking thousand other things). If you actually needed low-latency processing, again, your program would directly interface with timers itself, or with interrupt-generating hardware with no or a very thin layer of hardware abstraction through your operating system.

7
  • See the third paragraph, the intention is not to make it actually faster, but to make proccesses that use real-time as reference faster.
    – gabriel
    Jul 14, 2021 at 20:14
  • "processes that use real-time as reference": That doesn't work like that. If you want to write a process that waits exactly, say 2831 nanoseconds, you do that, by programming a timer. You don't do that by waiting for your OS to wake you after some OS-internal tick, or other wakeup reason. Jul 14, 2021 at 20:17
  • And where does this timer get the reference for how much those 2831 nanoseconds actually lasted? It needs to use the system clock, or at least a regular interval with the CPU.
    – gabriel
    Jul 14, 2021 at 20:21
  • "Neither audio handling, nor sleeping, require any better precision than the systick would have anyways, AND audio handling might very well be interrupt driven by the actual audio hardware, anyway" Is not precision what I want, what I want is to make the computer think the sleep period is different than the real time period. I know my computer is faster, thats precisely why I want it to work faster in that sense. Ignore the usefullness of this, just answer if you know a solution.
    – gabriel
    Jul 14, 2021 at 20:23
  • So, you're really barking up the wrong tree here. I think your computer is much faster than you think. <--- Too true!
    – John
    Jul 14, 2021 at 20:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.