Reading Notebook: 09-September-09
Comments in italics are mine and express my own views, thoughts and opinions
Windows Internals by M. Russinovich, D. Solomon and A. Ionescu:
InitializeCriticalSectionAndSpinCount (p. 187) - API description: http://msdn.microsoft.com/en-us/library/ms683476(VS.85).aspx
Tricky behaviour of keyed events (p. 188)
0: kd> dt _ETHREAD
nt!_ETHREAD
+0x000 Tcb : _KTHREAD
+0x330 CreateTime : _LARGE_INTEGER
+0x338 ExitTime : _LARGE_INTEGER
+0×338 KeyedWaitChain : _LIST_ENTRY
+0×348 ExitStatus : Int4B
+0×348 OfsChain : Ptr64 Void
+0×350 PostBlockList : _LIST_ENTRY
+0×350 ForwardLinkShadow : Ptr64 Void
+0×358 StartAddress : Ptr64 Void
+0×360 TerminationPort : Ptr64 _TERMINATION_PORT
+0×360 ReaperLink : Ptr64 _ETHREAD
+0×360 KeyedWaitValue : Ptr64 Void
+0×360 Win32StartParameter : Ptr64 Void
+0×368 ActiveTimerListLock : Uint8B
+0×370 ActiveTimerListHead : _LIST_ENTRY
+0×380 Cid : _CLIENT_ID
+0×390 KeyedWaitSemaphore : _KSEMAPHORE
+0×390 AlpcWaitSemaphore : _KSEMAPHORE
Safe and unsafe acquisition of fast and guarded mutexes (p. 189)
Gate primitive as an optimized event (pp. 189 - 190)
Executive resources (pp. 190 - 192) - These objects make analysis of synchronization issue easier because they have an owner thread:
0: kd> dt _ERESOURCE
nt!_ERESOURCE
+0x000 SystemResourcesList : _LIST_ENTRY
+0×010 OwnerTable : Ptr64 _OWNER_ENTRY
+0×018 ActiveCount : Int2B
+0×01a Flag : Uint2B
+0×020 SharedWaiters : Ptr64 _KSEMAPHORE
+0×028 ExclusiveWaiters : Ptr64 _KEVENT
+0×030 OwnerEntry : _OWNER_ENTRY
+0×040 ActiveEntries : Uint4B
+0×044 ContentionCount : Uint4B
+0×048 NumberOfSharedWaiters : Uint4B
+0×04c NumberOfExclusiveWaiters : Uint4B
+0×050 Reserved2 : Ptr64 Void
+0×058 Address : Ptr64 Void
+0×058 CreatorBackTraceIndex : Uint8B
+0×060 SpinLock : Uint8B
0: kd> dt _OWNER_ENTRY
nt!_OWNER_ENTRY
+0×000 OwnerThread : Uint8B
+0×008 OwnerCount : Int4B
+0×008 TableSize : Uint4B
There are some crash dump analysis pattern examples that involve executive resources: Deadlock (executive resources), High Contention (executive resources) and Wait Chain (executive resources)
Pushlocks are built on gates, pointer-size and have shared/exclusive mode (p. 192)
Lock convoys (p. 193) - This article explains them using critical section example: http://en.wikipedia.org/wiki/Lock_convoy
Shared vs. exclusive use of user mode critical sections (pp. 194 - 195)
Condition variables (p. 195) - New in Vista and W2K8. MSDN example of usage: http://msdn.microsoft.com/en-us/library/ms682052(VS.85).aspx. So it seems (if I understand it correctly) Windows implemented Monitor concept at OS level. I’m not accustomed to think in “high-level ” monitor terms when designing concurrency on Windows although it is a natural concept in Java. Even when I was programming in Java in the past I was thinking Windows primitives.
SRW (Slim Reader Writer) Locks to replace critical sections in user mode (p. 196) - Looks like new to Vista and W2K8
SRW + conditional variable as ideal combination (p. 196)
- Dmitry Vostokov @ SoftwareGeneralist.com -
_1125.png)
Coming Soon:
Management Bits: An Anthology from Reductionist Manager
Debugging Notebook: Essential Concepts, WinDbg Commands and Tools
Crash Dump Analysis for System Administrators and Support Engineers
New Magazines:
Debugged! MZ/PE: MagaZine for/from Practicing Engineers
New Books:
Memory Dump Analysis Anthology: Color Supplement for Volumes 1-3
Memory Dump Analysis Anthology, Volume 3
First Fault Software Problem Solving: A Guide for Engineers, Managers and Users
x64 Windows Debugging: Practical Foundations
Also available:
Windows Debugging: Practical Foundations
DLL List Landscape: The Art from Computer Memory Space
Dumps, Bugs and Debugging Forensics: The Adventures of Dr. Debugalov
WinDbg: A Reference Poster and Learning Cards
Memory Dump Analysis Anthology, Volume 2
Memory Dump Analysis Anthology, Volume 1
New Children's Book: