I can nto find anything that explains semaphores well. From what I understand, you can create an array of the type sem_t , for instance. Like a "semaphore array", I guess. And you use loops somehow to create them. Or can somebody explain this to me, please? I'm trying to do a problem about customers in a supermarket who are ready to pay and pick a lane ( semaphores ), and up to 4 lanes. They pick lowest numbered lane and with the fewest customers.