Monitor PC;
int nextin,nextout,count;
char buer[n];
condition notfull,notempty;
append(char x)
{
if (count= =n) Cwait(notfull);
buer(nextin)=x;
nextin=(nextin+1) % n;
count++;
Csignal(notempty);
}
take(char x)
{
if (count= =0)Cwait(notempty);
x=buer(nextout);
nextout=(nextout+1)% n;
count--;
Csignal(notfull);
}
{
count=0; nextin=0; nextout=0;