This paper addresses distributed task scheduling problems as a distributed version of the Resource-Constrained Project Scheduling Problem (RCPSP). We propose and evaluate a novel approach for the distributed RCPSP based on theoretical models of division of labor in social insect colonies. Our approach uses a probabilistic decision-making model based on the social insect tendency to perform certain tasks, and was implemented as an algorithm called Swarm-RCPSP. We show that the results of the Swarm-RCPSP algorithm are better than those obtained with a distributed greedy algorithm, are not very far from the best-known solutions, and have the advantage of being computed in a distributed manner, which is an important issue when dealing with multiagent systems.