Operating Systems Question on Semaphores

sdaccord01

Senior member
Jul 9, 2003
291
0
0
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
 

Spencer278

Diamond Member
Oct 11, 2002
3,637
0
0
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.