Answer:
// Producer Thread
void *producer(void *param) {
buffer_item item;
while (true) {
item = rand() % 100;
sem_wait(&empty);
pthread_mutex_lock(&mutex);
if (insert_item(item))
printf("Can't insert item\n");
else
printf("Producer %d: produced %d\n", *((int*)param), item);
pthread_mutex_unlock(&mutex);
sem_post(&full);
}
}
// Consumer Thread
void *consumer(void *param) {
while (true) {
buffer_item item = NULL;
if (in > 0)
item = buffer[in - 1];
sem_wait(&full);
pthread_mutex_lock(&mutex);
if (remove_item(&item))
printf("Can't remove item\n");
else
printf("Consumer %d: consumed %d\n", *((int*)param), item);
pthread_mutex_unlock(&mutex);
sem_post(&empty);
}
}
Explanation:
An outline of the producer and consumer threads appears as shown above.
Answer: Passive
Explanation: Passive scanning is the process that scans the possibility of the risk that can arise while data is received starting port to the destination. It does the scanning between the server and the client software to define vulnerability .
It cannot work in those network which don't persist the traffic.No false data that is present in the application is detected by it if the data is unclear.
The answer is Insert Tab. This is the button to add a picture to a spreadsheet. <span>Click </span>Insert to add something to a spreadsheet. This includes pictures, shapes, charts, links, text boxes, video and more. <span>The </span>Insert Tab<span> is used to </span>insert<span> different features such as tables, pictures, clip art, shapes, charts, page numbers, word art, headers, and footers into a document. </span>