Pregunta

My professor said that it is recommended to use the PIT instead of the RTC to implement a epoch based round robin scheduler. He didn't really mention any concrete reasons and I can't think of any either. Any thoughts?

¿Fue útil?

Solución

I personally would use the PIT (if you can Only choose between these two, modern OSes use the HPET iirc)

One, it can generate interrupts at a faster frequency (although I question if preempting a process within milliseconds is beneficial)

two, it has a higher priority on the PIC chip, which means it can't be interrupted by other IRQs.

Personally I use the PIT for the scheduler and the RTC timer for wall clock time keeping.

Otros consejos

The RTC can be changed (it is, after all, a normal "clock"), meaning it's values can't be trusted from an OS perspective. It might also not have good enough resolution and/or precision needed for OS scheduler interrupts.

While this doesn't answer the question directly, here are some further insights into choosing the preemption timer.

On modern systems (i586+; I am not sure if i486's external local APIC (LAPIC) had timer) you should use neither, because you always get the local APIC timer, which is per-core. There's even more: using either PIT or RTC for timer interrupts is already obsolete.

The LAPIC timer is usually used for preemption on modern systems, while HPET is used for high precision events. On systems having HPET, there's usually no physical PIT; also, first two comparators of HPET are capable of replacing PIT and RTC interrupt sources, which is the simplest possible configuration for them and is preferred in most cases.

PITs are faster. RTCs typically increment no faster than 8 kHz and are most commonly configured to increment at 1 Hz (once a second).

  1. PIT has interrupt function.
  2. PIT has higher resolution than Real-Time Clock.
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top