32-bit PM (WARP) and Graphics Engine use a composite semaphore structure to serialise their resources.
This semaphore has the structure:
PM uses a technique of polling this semaphore by waiting on the imbedded event semaphore handle for a limited time.
This technique has the advantage of speed combined with accountability but a thread waiting for a PMSEM or GRESEM may appear blocked, ready or running depending on the polling cycle. However it will be executing in a routine with a name such as PMRequestMutexSem. If the PMMERGE symbols are loaded this is readily detected.
The PM and GRE SEMs are contiguous and located at label pmSemaphores.
The handle (linear address) of the PM/GRE Semaphore is passed on entry to PMREquestMutexSem and tends to be retained in the EDX register.
The following semaphores are defined by PM:
10
In this example one of the shell threads seems to be getting very little CPU, though is frequently ready:
# .p 3a Slot Pid Ppid Csid Ord Sta Pri pTSD pPTDA pTCB Disp SG Name *003a# 000d 0005 000d 000a rdy 0200 abd61000 abe4b5b4 abe2ee60 0ee4 11 PMSHL32 # .r eax=13e30025 ebx=00000000 ecx=000a000d edx=13e7b4d4 esi=ffffffff edi=0068e55c eip=1bd0d7ea esp=00637f44 ebp=00637f60 iopl=2 -- -- -- nv up ei pl nz na po nc cs=005b ss=0053 ds=0053 es=0053 fs=150b gs=0000 cr2=00000000 cr3=001ad000 005b:1bd0d7ea ff4a10 dec dword ptr [edx+10] ds:13e7b4e4=00000006 # ln %1bd0d770 PMMERGE PMREQUESTMUTEXSEM + 7a # db %edx %13e7b4d4 50 4d 53 45 4d 00 00 00-10 00 01 00 02 00 00 00 PMSEM........... %13e7b4e4 06 00 00 00 00 00 00 00-05 00 01 80 00 00 00 00 ................ %13e7b4f4 50 4d 53 45 4d 00 00 00-00 00 00 00 00 00 00 00 PMSEM........... %13e7b504 00 00 00 00 00 00 00 00-06 00 01 80 00 00 00 00 ................ %13e7b514 50 4d 53 45 4d 00 00 00-00 00 00 00 00 00 00 00 PMSEM........... %13e7b524 00 00 00 00 00 00 00 00-07 00 01 80 00 00 00 00 ................ %13e7b534 50 4d 53 45 4d 00 00 00-00 00 00 00 00 00 00 00 PMSEM........... %13e7b544 00 00 00 00 00 00 00 00-08 00 01 80 00 00 00 00 ................ >> PMSEM owner is pid 10 tid 1 and it has been requested twice by tid/pid 10/1. There are 6 waiting threads. # .p 42 Slot Pid Ppid Csid Ord Sta Pri pTSD pPTDA pTCB Disp SG Name 0042 0010 0005 0010 0001 blk 0500 abd69000 abe4c19c abe2fe20 0ed8 13 MRFILEPM # .pb 42 Slot Sta BlockID Name Type Addr Symbol 0042 blk fdf8841c MRFILEPM >> The owner is blocked. # .m %fdf8841c *har par cpg va flg next prev link hash hob hal 0003 %feeef04c 00001000 %fdeef000 001 0002 0021 0000 0000 0003 0000 =0000 hob har hobnxt flgs own hmte sown,cnt lt st xf 0003 0003 ff05 0000 ffec 0000 0000 00 02 00 00 vmkrhrw # dd %fdf8841c-10 l4 %fdf8840c 000101c1 00000000 fdf88406 ffc20018 # .mo ffc2 ffc2 semstruc # .d sem32 %fdf8841c Type: Shared Event Flags: Reset pMuxQ: 00000000 Post Count: 0000 pOpenQ: fde305f8 pName: NULL (anonymous) Create Addr: abe2fe20 # .d openq %fde305f8 PID Open Count ---------------- 0010 0001 # # ln pmsemaphores 9f3f:0000b4b4 PMMERGE PMSEMAPHORES # dl 9f3f 9f3f Data Bas=13e70000 Lim=0000ffff DPL=3 P RW A # >> The sem we were waiting on was at %13e7b4d4 so must be the >> USER SEM.