Consider a scenario where students go to library, students study and students leave the library.
There will be 2 students in the library initially and other 3 will be entering the library.
The condition is that at any point of time there should be at least 2 students studying in the library.(eg if there are only 2 students left in the library and if 1 student is studying then the other student cannot leave.
The last student can only leave once the student who was studying is done studying). You should print the states of the each student whenever they are entering the library, studying or leaving the library and also the total number of students left in the library.
Implement this using semaphore
-
Notifications
You must be signed in to change notification settings - Fork 0
HaDoopOP/java-multithread-2_in_Critical-Section
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
No description, website, or topics provided.
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published