Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Modify below assignment 2 solution to use FORK instead of FORALL to implement the parallel rank sort. You may use the posted solution to Assign
Modify below assignment solution to use FORK instead of FORALL to implement the parallel rank sort. You may use the posted solution to Assign if necessary. If it has not been posted because of late assignments still to be submitted, ask the TA for a copy. Assume that only seven processors in addition to the main processor are available and design the solution to run on plus the main processors. Set the number of processors as a #define value so you can change the number of processors. Also test your code with processors, but submit the processor solution. Count the number of JOIN's that are executed and write them out after the sorted display. For processors, the output should look something like this.
TS S KH H H JD D AC C C QS S S
TH H KD D D JC C AS S S QH H H
TD D KC C C JS S AH H H QD D D
TC C KS S S JH H AD D D QC C C
C C C C C C C C TC JC QC KC AC
D D D D D D D D TD JD QD KD AD
H H H H H H H H TH JH QH KH AH
S S S S S S S S TS JS QS KS AS
joins executed
SEQUENTIAL EXECUTION TIME:
PARALLEL EXECUTION TIME:
SPEEDUP:
NUMBER OF PROCESSORS USED:
Assignment
Name: sunkara dineshgopi
#define DECK
#define SUITSZ
#define RANKSZ
typedef struct
char suit;
int suitr;
char rank;
int rankr;
card;
char suitsSUITSZCDHS;
int suitrSUITSZ;
char ranksRANKSZTJQKA;
int rankrRANKSZ;
card unsorteddeckDECK sorteddeckDECK;
boolean comparecardscard cardA, card cardB
if cardAsuit cardB.suit
return cardB.suitr cardA.suitr ;
return cardB.rankr cardA.rankr ;
void deal
int i m v r;
m ;
v m;
for i ; i DECK; i
r v DECK;
unsorteddeckisuit suitsr RANKSZ;
unsorteddeckisuitr suitrr RANKSZ;
unsorteddeckirank ranksr RANKSZ;
unsorteddeckirankr rankrr RANKSZ;
v m;
void displaycard dk
int i;
for i ; i DECK; i
cout dkirank
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