In a distributed system, the protocol entities must exchange some data values and synchronization messages in order to ensure the temporal ordering of the events described in a service specification. It is desirable that the protocol entities' specifications can be derived automatically from the service specification. In this paper, we propose an algorithm to synthesize automatically the protocol entities' specifications from a given service specification where the service specification and derived protocol entities' specifications are described as extended finite state machines (EFSM's). Each EFSM has a finite state control and a finite number of registers. In our model, the next state and the next values of the registers are determined depending on not only the current state and input but also the current values of the registers. The registers correspond to the system resources and they are allocated to some of the protocol entities in a distributed system. The derived protocol entities' spec$cations satisfy the resource allocation specified by the designer. A procedure solving 0-1 integer linear programming problems is used to reduce the number of the messages exchanged among the protocol entities.