Strumenti Utente

Strumenti Sito


magistraleinformaticanetworking:spm:farmposix

Differenze

Queste sono le differenze tra la revisione selezionata e la versione attuale della pagina.

Link a questa pagina di confronto

Entrambe le parti precedenti la revisioneRevisione precedente
Prossima revisione
Revisione precedente
magistraleinformaticanetworking:spm:farmposix [22/03/2011 alle 17:47 (14 anni fa)] Marco Daneluttomagistraleinformaticanetworking:spm:farmposix [22/03/2011 alle 18:02 (14 anni fa)] (versione attuale) – [Task farm (POSIX TCP/IP)] Marco Danelutto
Linea 1: Linea 1:
 ===== Task farm (POSIX TCP/IP) ===== ===== Task farm (POSIX TCP/IP) =====
  
 +//(The code presented here does not pretend to be efficient, nor completely correct. It has been designed with the aim of illustrating several of the problems related to the implementation of fairly simple parallel applications)//
 ==== Version 1 ==== ==== Version 1 ====
 This version uses two servers (emitter and collector). Emitter accepts requests from workers and delivers tasks to be executed. Collector accepts results from workers and print them out on the screen. Workers open a separate connection with both emitter and collector for each task. The two connections are closed after processing the task and delivering the result. Tasks and results are (positive) integers. Emitter and worker termination is handled correctly. Collector does not terminate (suggestion: each worker should propagate EOS to collector. Collector should count EOS and terminate after receiving EOS from all the workers).  This version uses two servers (emitter and collector). Emitter accepts requests from workers and delivers tasks to be executed. Collector accepts results from workers and print them out on the screen. Workers open a separate connection with both emitter and collector for each task. The two connections are closed after processing the task and delivering the result. Tasks and results are (positive) integers. Emitter and worker termination is handled correctly. Collector does not terminate (suggestion: each worker should propagate EOS to collector. Collector should count EOS and terminate after receiving EOS from all the workers). 
  
 === Emitter code ===  === Emitter code === 
-<code>+<code c emitter.c>
 #include <stdio.h> #include <stdio.h>
 #include <string.h> #include <string.h>
Linea 80: Linea 81:
  
 === Worker code ===  === Worker code === 
-<code>+<code c worker.c>
 #include <stdio.h> #include <stdio.h>
 #include <string.h> #include <string.h>
Linea 172: Linea 173:
  
 === Collector code ===  === Collector code === 
-<code>+<code c collector.c>
 #include <stdio.h> #include <stdio.h>
 #include <string.h> #include <string.h>
Linea 230: Linea 231:
         return 0;          return 0; 
 } }
 +</code>
 +
 +=== Makefile ===
 +<code makefile makefile>
 +CC = gcc 
 +CFLAGS = 
 +TARGETS = emitter collector worker
 +
 +all:    $(TARGETS)
 +
 +clean:  
 +        rm -f $(TARGETS)
 +
 +worker:         worker.c
 +        $(CC) -o worker $(CFLAGS) worker.c
 +
 +collector:      collector.c
 +        $(CC) -o collector $(CFLAGS) collector.c
 +
 +emitter:        emitter.c
 +        $(CC) -o emitter $(CFLAGS) emitter.c
 +
 +dist:   $(SOURCES)
 +        rsync -avz ../FarmSocket ottavinareale:
 +        rsync -avz ../FarmSocket backus:Downloads/
 +        rsync -avz ../FarmSocket pianosau: 
 </code> </code>
  
 === Deployment code (Perl) ===  === Deployment code (Perl) === 
-<code>+<code perl deploy.pl>
 #!/usr/bin/perl  #!/usr/bin/perl 
 $sourcedir = "/home/marcod/Documents/Didattica/SPM/Dispensa/Codice/FarmSocket"; $sourcedir = "/home/marcod/Documents/Didattica/SPM/Dispensa/Codice/FarmSocket";
Linea 245: Linea 272:
  
 === Deployment code (BASH) ===  === Deployment code (BASH) === 
-<code>+<code bash deploy.bash>
 #!/bin/bash #!/bin/bash
 for m in $@  for m in $@ 
Linea 256: Linea 283:
 The launcher gets parameters from the command line (see comments) and saves the names of the machines used in the <code>machine.used</code> file. These machine names are then used by the <code>terminator.pl</code> program.  The launcher gets parameters from the command line (see comments) and saves the names of the machines used in the <code>machine.used</code> file. These machine names are then used by the <code>terminator.pl</code> program. 
  
-<code>+<code perl launcher.pl>
 #!/usr/bin/perl #!/usr/bin/perl
  
Linea 284: Linea 311:
  
 === Terminator code (Perl) ===  === Terminator code (Perl) === 
-<code>+<code perl terminator.pl>
 #!/usr/bin/perl #!/usr/bin/perl
 open FD, "<machines.used" or die "Cannot open log file for reading";  open FD, "<machines.used" or die "Cannot open log file for reading"; 
Linea 303: Linea 330:
  
 === Emitter code ===  === Emitter code === 
-<code>+<code c emitter.c>
 #include <stdio.h> #include <stdio.h>
 #include <string.h> #include <string.h>
Linea 426: Linea 453:
  
 === Worker code ===  === Worker code === 
-<code>+<code c worker.c>
 #include <stdio.h> #include <stdio.h>
 #include <string.h> #include <string.h>
Linea 525: Linea 552:
  
 === Collector code ===  === Collector code === 
-<code>+<codec collector.c>
 #include <stdio.h> #include <stdio.h>
 #include <string.h> #include <string.h>
Linea 596: Linea 623:
  
 === Emitter code ===  === Emitter code === 
-<code>+<code c emitter.c>
 #include <stdio.h> #include <stdio.h>
 #include <string.h> #include <string.h>
Linea 778: Linea 805:
  
 === Worker code ===  === Worker code === 
-<code>+<code c worker.c>
 #include <stdio.h> #include <stdio.h>
 #include <string.h> #include <string.h>
Linea 883: Linea 910:
  
 === Collector code ===  === Collector code === 
-<code>+<code c collector.c>
 #include <stdio.h> #include <stdio.h>
 #include <string.h> #include <string.h>
Linea 974: Linea 1001:
  
 **Attention**: this code has an error (it does not work perfectly). Try to figure out which error (which is the erroneous behaviour of the code) and how it can be corrected.  **Attention**: this code has an error (it does not work perfectly). Try to figure out which error (which is the erroneous behaviour of the code) and how it can be corrected. 
- 
- 
- 
- 
- 
- 
magistraleinformaticanetworking/spm/farmposix.1300816063.txt.gz · Ultima modifica: 22/03/2011 alle 17:47 (14 anni fa) da Marco Danelutto

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki