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.
Recommended Answers
Jump to PostI don't see why (nor how) semaphores would be used in this problem. My solution would have a 4-integer array representing the lanes which contains the number of customers in it. A loop looks at the values and finds the minimum value. That's your chosen lane.
All 2 Replies
Reply to this topic
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.