Multiple answers: Select two answers that are *CORRECT* when…

Multiple answers: Select two answers that are *CORRECT* when the following program executes. You can reference pthread man page if you need. #include #include #include #define CORE 4#define MAX 8pthread_t thread;int mat_A, mat_B, sum;void* add(void* arg) {  int i, j;  int core = (int)arg; for (i = core * MAX / 4; i < (core + 1) * MAX / 4; i++)   for (j = 0; j < MAX; j++)      sum = mat_A + mat_B;  return NULL;}int main() {  int i, j, step = 0;                                                                  for (i = 0; i < MAX; i++)     for (j = 0; j < MAX; j++) {      mat_A = rand() % 10;      mat_B = rand() % 10;    }  for (i = 0; i < CORE; i++) {    pthread_create(&thread, NULL, &add                   (void*)step);    step++;  }  for (i = 0; i < CORE; i++)    pthread_join(thread, NULL);  return 0;}

Multiple answers: Suppose the followings while executing a p…

Multiple answers: Suppose the followings while executing a program execution on a 32bit x86 CPU computer system; %esp=0xffffcf8c %eip=0x804842b. The instruction at the memory address 0x804842b is call 0x80483dd. 0x8048430 is the next sequential instruction memory address after 0x804842b Select three statements that are *CORRECT* right after CPU fetch-and-executes the instruction “call 0x80483dd” at 0x804842b. 

The following code is an incorrect implementation of the bou…

The following code is an incorrect implementation of the bounded-buffer single producer and single consumer program. Pick three answers that are *CORRECT* in fixing the program to work even when the consumer and producer threads run simultaneously. #include #include #include #include #define BUFFER_SIZE 10#define COUNT 100int buffer;int in=0;int out=0;void enqueue(int data) {   buffer=data;   in = (in + 1) % BUFFER_SIZE;}int dequeue() {   int data;   data = buffer;   out = (out + 1) % BUFFER_SIZE;   return data;}void *producer(void *dummy) {   int i=0;   int count = (int) dummy;   while(i < count) {       enqueue(i++);      printf("Producing value %d\n",i);   }  return NULL;}void *consumer(void *dummy) {   int data;   int count = (int) dummy;   int i = 0;   while(i < count) {        data=dequeue();        printf("Consuming value %d\n",data);        i++;   }   return NULL;}int main() {   pthread_t tid;   pthread_create(&tid,NULL,producer,(void *)COUNT);   consumer((void *)COUNT);   pthread_join(tid,NULL);   return 0;}