Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I have written the following code for the following: Developing an efficient parallel Jacobi relaxation program on a multiprocessor with convergence test and efficient barrier
I have written the following code for the following:
- Developing an efficient parallel Jacobi relaxation program on a multiprocessor with convergence test and efficient barrier and aggregation functions.
I want the code in the c* programming language
I am getting the deadlock as shown in the screenshot
#include #include #define n 32 #define numiter 1 #define tolerance 0.0001 float A[n+2][n+2], B[n+2][n+2]; int i,j,k; int count; spinlock Arrival, Departure; boolean globaldone; boolean done; float change, maxchange; boolean Aggregate(boolean mydone) { boolean result; /* Arrival Phase - Count the processes arriving */ Lock(Arrival); count = count + 1; globaldone = globaldone && mydone; /* aggregation */ if (count 0) { Unlock(Departure); /* continue Departure Phase */ } else { Unlock(Arrival); /* terminate Departure Phase */ globaldone = true; /* reset for new Aggregation */ } return result; } void Barrier() { /* Arrival Phase - Count processes as they arrive */ Lock(Arrival); count = count + 1; if (count 0) { Unlock(Departure); /* continue Departure Phase */ } else { Unlock(Arrival); /* end Departure Phase */ } } main() { count = 0; Unlock(Arrival); Lock(Departure); for (i=0;i> A[i][j]; } B=A; do { maxchange=0; for (j=1;j maxchange) maxchange = change; } Barrier(); A[i]=B[i]; done = Aggregate(maxchange *open jacobi.c Program Successfully Compiled To View a Complete Program Listing, See File LISTFILE.TXT *input=RandomFloats.txt *run DEADLOCK: All Processes are Blocked For Further Information Type STATUS Command SEQUENTIAL EXECUTION TIME: 92065 PARALLEL EXECUTION TIME: 102320 SPEEDUP: 0.90 NUMBER OF PROCESSORS USED: 1 *status PROCESS \# FUNCTION LINE NUMBER STATUS PROCESSOR 0 BARRIER 52 SPINNING 0 <>
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started