7 ms·
> A single context switch is in the range of 100K-1M CPU cycles. 1M cycles is roughly 300 microseconds (assume 3 GHz processor, so 3 cycles is 1 nanosecond). E
by boulos 7y ago
> A single context switch is in the range of 100K-1M CPU cycles.
1M cycles is roughly 300 microseconds (assume 3 GHz processor, so 3 cycles is 1 nanosecond). Eli’s graph from the post I referenced above, has a context switch in the 1-3 microsecond range [1] depending on taskset/core pinning. The high end (3 microseconds) is about 10000 cycles then.
Maybe you mean fork() or pthread_create for your 1M cycles?
[1] https://eli.thegreenplace.net/images/2018/plot-launch-switch.png https://eli.thegreenplace.net/images/2018/plot-launch-switch...