Page 1 of 43 - PowerPoint PPT Presentation

1 / 43
About This Presentation
Title:

Page 1 of 43

Description:

Page 19 of 43. Example. Reader-writer lock ... Worker choice is 'round robin'-style ... Scheduling based on worker load. 6/1/09. AALBORG UNIVERSITET 2005. Page ... – PowerPoint PPT presentation

Number of Views:21
Avg rating:3.0/5.0
Slides: 44
Provided by: uffesr
Category:
Tags: example | of | page | robin | round | schedule

less

Transcript and Presenter's Notes

Title: Page 1 of 43


1
Nomad Distributed Programming
  • A project by
  • Morten D. Jørgensen
  • Uffe Sørensen
  • Claus R. Thrane
  • Martin Clemmensen
  • Anders Buch
  • Thomas L. Kjeldsen

2
Agenda
  • Introduction (Uffe)
  • Motivation (Uffe)
  • The Nomad Approach (Claus)
  • Chords (Morten)
  • Dist and Task (Morten)
  • Architecture (Martin)
  • Compiler (Anders)
  • Demo (Claus)
  • Performance (Thomas)
  • Conclusion (Thomas)

3
Problem Statement
  • Processing and time requirements
  • Distribution
  • Scientific computing
  • Traditional languages
  • Higher abstraction of distribution
  • Rapid development

4
Environment
  • Foundation
  • RMI
  • Functionality
  • Tuple-Space
  • Shared variables
  • Task
  • Dist

5
Base of Assumption
  • Scientists
  • Rapid development
  • High level of abstraction
  • Focus on the problem

6
Motivation
  • Java
  • Widely used
  • Relatively simple syntax
  • Cross-platform
  • No built-in support for distribution
  • C
  • Mostly like Java
  • More full-featured than Java
  • Not stable cross-platform

7
Motivation
  • C?
  • New model of concurrency
  • More intuitive code
  • Chords over monitors
  • Ada
  • Comprehensive language
  • Parallel processing (Task)
  • Rendezvous between tasks

8
Motivation
  • Linda
  • Tuple-Space
  • Occam
  • Low-level constructs

9
The Nomad Approach
  • Communication
  • Synchronization
  • Distribution

10
Multi Computer
11
Communication
Parallel programming models
Adopted in Nomad
  • Multi-computer Shared variables
  • Tuple-Space
  • Shared Variables
  • Message passing
  • Parallel Objects
  • Tuple-Space
  • Data-parallel

12
Synchronization
  • Threads and processes
  • Synchronization mechanisms
  • Async (C?)
  • Chords (C?)
  • Tuple-Space (Linda)

public async demo()
public int take() signal put(int i)
in(myTupl, i, ? j)
13
Distribution
task
dist
  • Method inspired
  • Shared parameters
  • Class inspired
  • methods
  • Fields (a state)

14
Chords
15
Motivation
  • Make intentions more apparent
  • Conditions expressed more clearly in chords
    without technical details
  • Compiler optimization
  • Local and distributed synchronization

16
The Chord
  • Lives in classes, like traditional methods
  • One traditional method, one or more signals
  • Synchronization patterns
  • When pending method calls match a pattern, its
    body runs
  • If there is no match, the invocations are queued
    up
  • If there are several matches, a pattern is
    non-deterministically selected
  • Async chords run body in a new thread
  • Dist chords run body in a new thread on the
    network

17
Properties
  • Equivalent to monitors
  • OOP and chords
  • No upper bound on invocations

18
Compiler Translation
  • Introduces queues for holding (and blocking) the
    threads of methods and for arguments for signals
  • Generate code for each method
  • Check for matching chords. If match is found
    dequeue signals arguments - invoke scan() -
    execute body - return
  • Enqueue (and block) thread
  • Generate code for each signal
  • Enqueue arguments
  • Invoke scan() if signal invocation changed state
  • Generate code for scan() method
  • Iterate over all chords and wake up thread if
    match is found
  • Uses bitmasks to look for matches

19
Example
  • Reader-writer lock
  • Only one writer blocks other writers and readers
    until release
  • Unlimited readers when no writers
  • Fair
  • A write-request blocks new read-requests until
    writer is given exclusive access

20
Example - Nomad
  • class NomadReaderWriter
  • NomadReaderWriter()
  • free()
  • public void Shared() private signal free()
  • isShared(1)
  • public void Shared() private signal
    isShared(int n)
  • isShared(n 1)
  • public void ReleaseShared() private signal
    isShared(int n)
  • if (n 1) free() else isShared(n - 1)
  • public void ReleaseShared() private signal
    exclusiveWaiting(int n)
  • if (n 1) freeExclusive() else
    exclusiveWaiting(n - 1)
  • public void Exclusive() private signal free()
  • public void Exclusive() private signal
    isShared(int n)
  • exclusiveWaiting(n) wait()

21
Example - Java
  • class JavaReaderWriter
  • private int isShared 0
  • private boolean writing false
  • private int waitingWriters 0
  • public synchronized void Shared()
  • while (writing waitingWriters gt 0) wait()
  • isShared
  • public synchronized void ReleaseShared()
  • isShared--
  • if (isShared 0) notifyAll()
  • public synchronized void Exclusive()
  • waitingWriters
  • while (isShared gt 0 writing) wait()
  • waitingWriters--
  • writing true

22
Task Construct
  • Entrypoint method
  • wait() and active()
  • Supports async, dist and normal methods

23
Dist vs. Task
  • Similarities
  • Distributed
  • Parameters
  • Explicit synchronization
  • Differences
  • Methods
  • Uses
  • ?? Dist SETI_at_home
  • ?? Task Server
  • Easy to model Dist (and other models) using Task

24
Architecture
  • Topology
  • Implementation
  • Scheduler
  • Tuple-Space
  • Shared variables
  • Using the RTE

25
Topology
  • Worker
  • RMI registry server
  • Executes jobs from its queue
  • Server
  • RMI registry server
  • Scheduler
  • Shared variables
  • Tuple-Space
  • Runner (user program)

26
Implementation
  • Scheduler
  • Maintains a list of workers
  • Synchronous calls
  • Returns when the job has been assigned to a
    worker
  • Worker choice is round robin-style
  • Adding and removing workers can be done at
    runtime (when not executing jobs)
  • Alternate worker choice can easily be implemented

27
Implementation
  • Tuple-Space
  • Maintains a list of tuples (which are also lists)
  • Synchronous calls
  • Linear search time
  • Blocks if a desired tuple is not found

28
Implementation
  • Shared Variables
  • Synchronous calls
  • Returns a remote reference (stub)
  • Garbage collection provided by the JVM.

29
Using the RTE
  • Creating and submitting Jobs for execution
  • Implementing the IJob interface
  • Submitting via the SchedulerAccess class
  • Using Shared Variables and the Tuple-Space
  • Submitting desired shared objects via. the
    SharedMemAccess class.
  • Adding and getting tuples from the Tuple-Space
    via. the TupleSpaceAccess class.

30
The Compiler
  • Syntactic analysis / SableCC
  • Contextual analysis
  • Code-generation
  • Usage of the Environment

31
Compiler Overview
32
Accessing the Environment
33
Accessing the Environment
  • Tuple space out
  • public void caseATsOut(ATsOut node)
  • int listname _varName
  • createAJasminStmt(1,0,
  • "new java/util/ArrayList\n"
  • "dup\n"
  • "invokenonvirtual
    java/util/ArrayList/ltinitgt()V\n"
  • "astore " listname "\n"
  • ).apply(this)
  • AListExp exps ( AListExp )
    node.getListExp()
  • write("aload "listname"\n")
  • doAutoBoxing(exps.getExp())
  • write("invokevirtual java/util/ArrayList/add
    (Ljava/lang/Object)Z\n")
  • write("pop\n")
  • Object list exps.getListExpTail().toArra
    y()
  • for (int i 0 i lt list.length i)

34
Performance
  • Test setup and results
  • Tuple-Space
  • Distributed methods
  • Improvements

35
Tuple-Space
  • Method
  • Put and take a tuple is considered one operation
  • Tuple-Space and test program on separate hosts
  • Average of 5 tests
  • Test setup
  • Server
  • AMD2600, 512Mb Ram
  • Linux 2.6, Sun JVM 1.5
  • User program
  • Intel P3, 1Ghz, 384Mb Ram
  • Linux 2.4 kernel, Sun JVM 1.5

36
Tuple-Space Overview
37
Tuple-Space Details
38
Distributed Methods
  • Method
  • Dist method does nothing
  • Average of 5 tests
  • 1 to 4 workers
  • Test setup
  • Server
  • AMD2600, 512Mb Ram
  • Linux 2.6, Sun JVM 1.5
  • Workers
  • Private PCs ranging from 1 to 2.6Ghz

39
Distributed Methods Overview
40
Distributed Methods Details
41
Improvements
  • Hash elements in the Tuple-Space
  • Scheduling based on worker load

42
Conclusion
  • Building the nomad compiler
  • Language features
  • Chords (new and interesting approach)
  • Dist methods (idea mixing with chords)
  • Tuple-Space (intuitive and handy)
  • The objective of Nomad

43
Demonstration
Chords Tuple-Space Dist
Write a Comment
User Comments (0)
About PowerShow.com