✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.
Consider the following code to initialize the concurrent Michael and Scott Queue from class.
void Queue_Init(queue_t *q) {
node_t *tmp = malloc(sizeof(node_t));
tmp->next = NULL;
q->head = q->tail = tmp;
pthread_mutex_init(&q->headLock, NULL);
pthread_mutex_init(&q->tailLock, NULL);
}
Why does an empty queue have a node allocated?
Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!