R
Richard Banville
Guest
The majority of the stats collection are not performed under latch control. In all our modern systems an update to a 64 bit field is consistent - that is the value will not be corrupted (unlike on 32 bit systems where such an update is performed under several instructions by the OS (a low part then a high part) However, the ordering of concurrent increments are not atomic meaning that an increment could be lost. It has been long decided that the performance cost of making every statistic update atomic outweighs the benefit of having the increment be 100% accurate. We could implement atomic statistics without latching however, the performance of this is still relatively poor without any visibility into the cost. (not as costly as a latch however but then you have insights into the latch activity.) An OS atomic increment internally implements a spin loop when the value being incremented changes out from under the current executing thread. high level operation is as follows: 1. Attempt to Increment a variable having a current value just retrieved, 2. rtc from increment states if increment occurred successfully or if the value of the variable changed and therefore the increment failed. 3. if increment not successful, goto to step 1 (spin).
Continue reading...
Continue reading...