Presentation is loading. Please wait.

Presentation is loading. Please wait.

Distributed and Parallel Processing George Wells.

Similar presentations


Presentation on theme: "Distributed and Parallel Processing George Wells."— Presentation transcript:

1 Distributed and Parallel Processing George Wells

2 eLinda Three new features: – Programmable Matching Engine (PME) – Broadcast output operation ( wr ) – Multimedia support Three implementations: – fully distributed tuple space – centralised tuple space – centralised with local caching of broadcast tuples

3 eLinda: Multimedia Support New data type: MultiMediaResource – Uses the Java Media Framework Can be used as fields in tuples Abstracts away the details of handling and streaming multimedia

4 eLinda: Recent Developments Web service implementation – eLindaWS Multicore processor version – Using Linux IPC

5 IPC in Java Java has good support for threads and for distributed processing Nothing for processes – Independent JVMs – Forced to use network-oriented distributed processing facilities Developed IPC package using “native” interfaces to Unix System V IPC

6 Performance Benefits (Linux)

7 Message Size

8 Solaris: Similar Results Sockets perform better than under Linux – More consistent with message size Using FIFOs is always more efficient than sockets

9 Linda: Tuple Space Storage

10 The Tuple Space Server

11 Commercial Linda Systems Java Spaces Sun Microsystems Complex – Part of JINI Centralised tuple space Several additional features – Support for transactions and leases

12 GigaSpaces Commercial product Adheres to the JavaSpaces specification

13 TSpaces IBM (alphaWorks) Simple Centralised tuple space Several extended operations – (e.g. countN, multiWrite, deleteTupleById ) Extended matching (XML), expiration, transactions, access control New operations can be added

14 TSpaces Operations Slightly different names

15 Example Application: Ray-Tracing Originally written as a JavaSpaces example Uses a “generic” framework – SpaceApplet class extends Applet – GenericWorker and Trace classes extend SpaceApplet – RenderTask specifies chunk of work to be done Used as a tuple field Lots of detail for ray-tracing

16 SpaceApplet import com.ibm.tspaces.*; public abstract class SpaceApplet extends Applet {... protected TupleSpacetaskSpace; protected TupleSpaceresultSpace; public void init() { String host = getHost(); try { taskSpace = new TupleSpace("RayTracingTasks", host); ResultSpace = new TupleSpace("RayTracingResults", host); } catch (TupleSpaceException e) { System.err.println("Error: " + e); }... } // init

17 GenericWorker import com.ibm.tspaces.*; public class GenericWorker extends SpaceApplet implements Runnable {... public synchronized void run() { for (;;) {... try { Tuple taskTmpl = new Tuple (new Field(Long.class), new Field(RenderTask.class)); // any TaskEntry will do Tuple taskTuple = taskSpace.waitToTake(taskTmpl); // in(?taskID, ?task) RenderTask task = (RenderTask)taskTuple.getField(1).getValue(); Long taskID = (Long)taskTuple.getField(0).getValue(); int[] result = task.execute(); // execute the task...

18 GenericWorker (continued)... Tuple resultTuple = new Tuple (taskID, new Integer(task.startX), new Integer(task.startY), result); if (result != null) // write result back resultSpace.write(resultTuple); // out(taskID, task.startX, task.startY, result) } catch (TupleSpaceException e) { // ERROR } } // for } //run

19 Master Process: Trace import com.ibm.tspaces.*;... RenderTask task = new RenderTask(); task.startX = x; task.startY = y; task.stopX = Math.min(x + (xChunk - 1), MAX_X – 1); task.stopY = Math.min(y + (yChunk - 1), MAX_Y - 1); Tuple taskTuple = null; try { taskTuple = new Tuple(taskIDObj, task); taskSpace.write(taskTuple); // out(taskID, task) } catch (TupleSpaceException e) { e.printStackTrace(System.err); } Complicated by threading and flexible tuple ordering Essentially:

20 Master Process: Retrieving Results Tuple t = null; Tuple tmpl = null; try { tmpl = new Tuple(new Long(taskID), new Field(Integer.class), new Field(Object.class)); t = resultSpace.waitToTake(tmpl); // in(taskID, ?x, ?y, ?result) x = (Integer)t.getField(1).getValue(); Y = (Integer)t.getField(2).getValue(); result = (int[])t.getField(3).getValue(); } catch (TupleSpaceException e)...

21


Download ppt "Distributed and Parallel Processing George Wells."

Similar presentations


Ads by Google