Many thanks John for idea. It's more easier to use WaiterPID values.

One correction to your code:

s rs=##class(%ResultSet).%New("%SYS.LockQuery:Detail")
s status=rs.Execute()
k graph
f i=1:1 q:'rs.%Next()  d
. s ref="L"_i,graph(ref,rs.Owner)=1
. f j=1:1:$l(rs.WaiterPID,",") d
. . s pid=$p(rs.WaiterPID,",",j) s:pid]"" graph(pid,ref)=1

WaiterPID values are separated by "," not by " "

Thank you Dmitry for response.

I need to detect only all mutual dependence of locks and locks attempts of different processes.

Dead lock sample:
1 process: Lock +^Glb(1)
2 process: Lock +^Glb(2)
1 process: Lock +^Glb(2)
2 process: Lock +^Glb(1)

1 process waiting for unlocking of ^Glb(2). But it's impossible because 2 processes is waiting unlocking of 1 process node.

^$LOCK contain information only about successful locks. Do detect 'dead' locks we need information about lock attempts too (%SYS.LockQuery:WebList query result that SMP displays).
SMP 'View Lock' mode can display thousands of records. But I need to filter only  mutual dependence of locks.

Sergey has no followers yet.
Sergey has not followed anybody yet.
Global Masters badges:
Sergey has no Global Masters badges yet.