28.10.2014 Views

Synergy User Manual and Tutorial. - THE CORE MEMORY

Synergy User Manual and Tutorial. - THE CORE MEMORY

Synergy User Manual and Tutorial. - THE CORE MEMORY

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Synergy</strong> <strong>User</strong> <strong>Manual</strong> <strong>and</strong> <strong>Tutorial</strong><br />

}<br />

// Get terminal<br />

else if(!strcmp(tpname, "D_term")){<br />

printf("Worker: Received terminal\n");<br />

// Set name to sem<br />

strcpy(tpname,"sem");<br />

// Set length for semaphore<br />

tplength = sizeof(int);<br />

// Replace the semaphore signal in problem ts<br />

printf("Worker: Putting semaphore\n");<br />

status = cnf_tsput(tsd, tpname, &sem, tplength);<br />

break;<br />

}<br />

// Set name to sem<br />

strcpy(tpname,"sem");<br />

// Set length for semaphore<br />

tplength = sizeof(int);<br />

// Replace the semaphore signal in problem ts<br />

printf("Worker: Putting semaphore\n");<br />

status = cnf_tsput(tsd, tpname, &sem, tplength);<br />

// Sleep 1 second<br />

sleep(1);<br />

}<br />

// Terminate program<br />

printf("Worker: Terminated\n");<br />

cnf_term();<br />

}<br />

The makefile <strong>and</strong> csl file are similar to the last two applications except in the naming of<br />

the application objects <strong>and</strong> files. To run the data passing distributed application:<br />

1. Make the executables by typing “make” <strong>and</strong> pressing the enter key.<br />

2. Run the application by typing “prun tuplePass” <strong>and</strong> pressing the enter key.<br />

The screen output for the master terminal with <strong>Synergy</strong>’s initialization <strong>and</strong> termination<br />

output removed should resemble:<br />

[c615111@owin ~/fpc03 ]>prun tuplePass2<br />

Master: Opening tuple spaces<br />

Master: Tuple spaces open complete<br />

Master: Processors 2<br />

Master: Putting semaphore<br />

Master: Putting '12000' Length 4 Name D_num<br />

Master: Put '12000' complete<br />

Master: Putting '1000000' Length 4 Name D_lnum<br />

Master: Put '1000000' complete<br />

Master: Putting '0.500000' Length 4 Name D_frac<br />

148

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!