Add the August 2024 report
All threads resolved!
All threads resolved!
Compare changes
- Ribbon authored
content/news/this-month-240831.md
0 → 100644
+ 116
− 0
Thanks to the recent kernel proflling implementation, 4lDO2 discovered that a huge bottleneck in the context switching code, was simply reading the system time. That involves reading hardware registers from the [HPET](https://en.wikipedia.org/wiki/High_Precision_Event_Timer), which although reasonably fast on real hardware, is particularly slow on VMs as it requires expensive VM exits. This cost is now avoided by using the [TSC](https://en.wikipedia.org/wiki/Time_Stamp_Counter) using [KVM's](https://en.wikipedia.org/wiki/Kernel-based_Virtual_Machine) paravirtualized system time API, resulting in a massive speedup.
This improvement is unfortunately not applicable for Redox running on real hardware. However, most recent CPUs support an *invariant TSC*, in which case the logic would be very similar to the paravirtualized logic, after the frequency has been determined at boot time by calibration. This will be implemented in the future, but for now, the real HPET is reasonably fast.
Running in a VM, Redox is now becoming slightly faster than Linux at certain synthetic benchmarks, for example the same-core context switch latency when using POSIX pipes (tested with `mitigations=off`). More exciting optimizations are coming, both to reduce context switch overhead further towards the hardware limit, and to reduce unnecessary context switches overall.