1. A method, in a data processing system comprising a plurality of nodes, each node being a computing device, for controlling access to a critical section of code, the method comprising: sending, by a sender node of the data processing system, an access request for requesting access to the critical section of code, wherein the critical section of code is a portion of code that accesses a shared resource; receiving, by the sender node, from a plurality of receiver nodes in the data processing system, responses to the access request, wherein each response in the responses includes a number of active nodes perceived by a corresponding receiver node that transmitted the response; and controlling, by the sender node, access to the critical section of code based on the number of active nodes identified in each of the responses received from the receiver nodes.