Question: . Many current language specifications, such as for C and C + + , are inadequate for multithreaded programs. This can have an impact on
Many current language specifications, such as for C and C are inadequate for multithreaded programs. This can have an impact on compilers and the correctness of code, as this program illustrates. Consider the following declarations and function definition:
#include
#include
#include
#include
int globalpositives ;
typedef struct list struct list next; double val;
list;
void countpositivesstruct list l struct list p;
forp l; pnext ; p p next
if p val
globalpositives;
Now consider the case in which thread A performs.
countposivites;
While thread B performs:
globalpositives;
a What does the function do
b The C language only addresses single threaded execution. Does the use of two parallel threads create any problems or potential problems?
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
