Considering the code: #include #include #include #includ…
Considering the code: #include #include #include #include sem_t empty; sem_t full; int item = 0; void* producer(void* arg) { sem_wait(&empty); item = 100; printf(“Producer produced item\n”); sem_post(&full); return NULL; } void* consumer(void* arg) { sem_wait(&full); printf(“Consumer consumed item = %d\n”, 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?
Read DetailsA system uses a semaphore queue to control access to a share…
A system uses a semaphore queue to control access to a shared printer. Process P1 requests access first and is placed in the waiting queue. However, every time the printer becomes available, newly arriving higher-priority processes (P2, P3, P4, …) are always selected before P1. As a result, P1 never gets access to the printer even though the system continues running normally. What synchronization issue is demonstrated?
Read Details