4 ms·
It looks like this is a case where a process is holding lock A while waiting on lock B; and every other process is waiting on lock A. That's normal enough, thou
by jeffdavis 7y ago
It looks like this is a case where a process is holding lock A while waiting on lock B; and every other process is waiting on lock A. That's normal enough, though it seems like there are two mistakes:
First: Never spin waiting on a lock for 3 seconds. If you expect a lock to be released very quickly, you spin K times and then, if you still don't have the lock, try something heavier that can deschedule your process. K should be small enough that your time slice is unlikely to expire while spinning, otherwise, it just causes confusion and wasted work because it looks like your process is doing work when it's not.
Second: It seems dubious that using a feature like system restore causes all Write calls to wait for a lock held by a process in the middle of I/O. I'm sure there are some cases where that must happen (like if out of buffer space to hold the writes), but I would think it would be harder to hit.
EDIT: Rephrased my comment in terms of two problems rather than just the first one.
- caf 7y agoLook again - that tight loop in RtlFindNextForwardRunClear isn't spinning on a lock - it's scanning forward through memory, 4 bytes at a time, looking for 4 bytes not equal to the pattern in %ebp. So it looks more like "process is holding lock A while doing a very long scan through memory". That would fit with the name of the function, too.
- brucedawson 7y agoCorrect. Nobody was spinning on a lock. Everybody was waiting politely. The problem was that the system process held the lock for too long, due to some inefficiency in system restore (root cause not yet understood by me).
- brucedawson 7y ago> Second: It seems dubious that using a feature like system > restore causes all Write calls to wait for a lock I agree that it seems dubious, but it is indisputably what was happening, repeatedly.