Use a binary tree structure to implement a Peterson Lock for n concurrent threads.