5)Producerconsumer
5)Producerconsumer
h>
#include <pthread.h>
#include <semaphore.h>
#include <unistd.h>
int main() {
pthread_t p, c;
sem_init(&mutex, 0, 1);
sem_init(&empty, 0, N);
sem_init(&full, 0, 0);
pthread_join(p, NULL);
pthread_join(c, NULL);
sem_destroy(&mutex);
sem_destroy(&empty);
sem_destroy(&full);
return 0;
}