An approach is proposed for the implementation of distributed semaphores in the IEC 61499 architecture on the basis of protocols for solving consensus in a network of unreliable processes that allows developing function blockbased control applications with complex types of interactions using the resources sharing. The models of distributed semaphores (in the form of coloured Petri nets) based on Paxos and Raft protocols for solving consensus are developed, simulation experiments are performed in the CPN Tools, comparative analysis and recommendations are given.