• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Operating Systems Question on Semaphores

sdaccord01

Senior member
Hi,

I'm taking a CS class over the summer and this problem is bugging me:

Implement a binary semaphore with general semaphores.

I have to do this using pseudocode but I don't know if it's possible since I've googled for a while and have only come up with implementing a general semaphore using binary semaphores. Can anyone please help me?

Ken
 
What a stupid pointless question. Just use the general semaphore to lock a boolean variable and have it only have the P and V operations. for the increamenting one:
lock general semphore
while( bool == true );
bool = true;
unlock general semphore and for the other operation
lock general semphore
bool = false;
unlock.
 
Back
Top