The 2nd row of ur keyboard its called home row !
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.
Explanation:
Some regions may not have the full suite for the utilization of the Microsoft Azure platform or they may possess limited capabilities for them to fully function.
Answer:
The correct answer for the given question is option(b) i.e syntax
Explanation:
Syntax is the grammar of the structure format or order of the data meaning in which they are presented .syntax is the set of rules that define the words,symbol are to be a correctly structured or documented in that language.
Semantics differentiate the meaning of an data from its format it is not describe structure or format of the data so this option is wrong.
timing is not the correct option so correct answer is syntax.
Answer:
txt = input("Enter numbers: ")
numbers = txt.split(" ")
total = 0
max = 0
for i in numbers:
total = total + int(i)
if(int(i)>max):
max = int(i)
print(round(total/len(numbers)))
print(max)
Explanation:
This solution is implemented using Python programming language
This prompts user for input
txt = input("Enter numbers: ")
This splits user input into list
numbers = txt.split(" ")
The next two line initialize total and max to 0, respectively
total = 0
max = 0
This iterates through the list
for i in numbers:
This sum up the items in the list (i.e. user inputs)
total = total + int(i)
This checks for the maximum
if(int(i)>max):
max = int(i)
This calculates and prints the average
print(round(total/len(numbers)))
This prints the max
print(max)