Answer:
Following are the code to this question:
code:
wait(semaphore *S) //define method
{
S-> count++; //increment value
if( S -> count = 100) //define condition that check count is equal to 100
block; //use block keyword
else
add this connection to S -> list; //add value in list
}
signal(semaphore *S) //pass the value in method parameter
{
S -> count--; //decrement value
if(S ->count < 100) //define condition that check value count is less then 100
removeprocess P from S -> list //remove from list
else
wakeup(P) //start process
}
Explanation:
In the given Semaphores code, a count variable is used, which counts from 0 to 100, and a connection is used, that adds is value and increments by one.