Hi, I have a very simple hello world program that prints hello world, and then uses a pair of gettimeofday() to bracket around a usleep(50) call. I will then printf if the elapsed time between the two gettimeofday() calls is greater than 5ms.
When running on a Linux Vmware VM, and even on a native Linux laptop, I noticed that sometimes I would get elapsed time from 5ms to 10ms. I see much less printf on the native Linux laptop compared to the VMware, but it still does show up. On the native Linux laptop, the elapsed time is even up to 20ms, but I see much less printf than on the VMWare.
Why is this happening? Neither the VMware or the native Linux laptop is very busy at all.
How to mitigate this?
Thanks any insight.
When running on a Linux Vmware VM, and even on a native Linux laptop, I noticed that sometimes I would get elapsed time from 5ms to 10ms. I see much less printf on the native Linux laptop compared to the VMware, but it still does show up. On the native Linux laptop, the elapsed time is even up to 20ms, but I see much less printf than on the VMWare.
Why is this happening? Neither the VMware or the native Linux laptop is very busy at all.
How to mitigate this?
Thanks any insight.