The following files include a implementation of semaphores in ANSI C, I solve them in a Operative Systems lecture and uploaded them here hoping some one could find them useful.
Here is a simple list with a reference to wikipedia of each problem included in this repo:
1.- Cigarrette Smokers : Wiki Reference
2.- Dining philosophers : Wiki Reference
3.- No Starve Mutex : Wiki Reference
4.- Producer Consumer : Wiki Reference
5.- Reader Writer : Wiki Reference
And finally here is the Little book of semaphores which helped me to understand some doubts I had during the lecture, hope can do the same for you.
Remember to use this with responsability.