Skip to content
Questions
Cоnsidering the cоde: #include #include #include #include sem_t empty; sem_t full; int item = 0; vоid* producer(void* аrg) { sem_wаit(&empty); item = 100; printf("Producer produced itemn"); sem_post(&full); return NULL; } void* consumer(void* аrg) { sem_wait(&full); printf("Consumer consumed item = %dn", item); sem_post(&empty); return NULL; } int main() { pthread_t p, c; sem_init(&empty, 0, 1); sem_init(&full, 0, 0); pthread_create(&c, NULL, consumer, NULL); sleep(1); pthread_create(&p, NULL, producer, NULL); pthread_join(p, NULL); pthread_join(c, NULL); return 0; } Which statement is CORRECT?