Swarm resource deadlock detector constructing Wait-For-Graphs to detect cycles and trigger preemption