Question 1
Question 3
Question 4
Question 5
Question 8
Question 9
semaphore n = 0;
semaphore s = 1;
// Producer Function
void producer(){
while(true){
produce();
semWait(s);
addToBuffer();
semSignal(s);
semSignal(n);
}
}
// Consumer function
void consumer(){
while(true){
semWait(s);
semWait(n);
removeFromBuffer();
semSignal(s);
consume();
}
}
Question 10
#include <stdio.h>
int main()
{
const int x;
x = 10;
printf(\"%d\", x);
return 0;
}
There are 15 questions to complete.