Implementation of Join Semantics in Java - PowerPoint PPT Presentation

1 / 14
About This Presentation
Title:

Implementation of Join Semantics in Java

Description:

Despite the relative simplicity of Javas' threading model, ... Why is there no message passing in Java threads? Shared memory model defeats encapsulation ... – PowerPoint PPT presentation

Number of Views:33
Avg rating:3.0/5.0
Slides: 15
Provided by: stewarti
Category:

less

Transcript and Presenter's Notes

Title: Implementation of Join Semantics in Java


1
Implementation of Join Semantics in Java
  • G Stewart von Itzstein
  • University of South Australia

2
Overview
  • Motivation
  • Syntax Changes
  • Asynchronous Methods
  • Message Passing
  • State Charts/Diagram

3
Motivation
  • Despite the relative simplicity of Javas
    threading model, writing concurrent programs in
    Java can still be strange and confusing.
  • Tim Lindholm, Javasoft

4
Motivation
  • Why is there no message passing in Java threads?
  • Shared memory model defeats encapsulation
  • Concurrent application are hard to understand.
  • Visualise, Barrier Synchronisation, Thread Pools
  • We need a higher level of abstraction to
    represent more complex concurrent problems.

5
Syntax
  • Chemical Abstract Machine
  • Two changes to the Java Syntax
  • signal return representing asynchronous
    operation.
  • Compound method signatures (join patterns)
  • A Method body is not executed until all methods
    have been called.
  • The first method can be synchronous (normal Java)
    or asynchronous (signal return type).
  • The second and subsequent methods must be
    asynchronous.

6
Chemical Abstract Machine
  • All Join Patterns Represent Available Molecules
  • A Method is an Atom.
  • When you make a call to a method is made the call
    is placed into the chemical machine.
  • When a complete join pattern is in the machine it
    reacts changing the composition of the pool
    (executing the code associated with the join
    pattern)

7
Asynchronous Methods
  • class threader
  • signal thread1()
  • //code
  • System.out.println(Hello World)
  • //code
  • public static void main(String argv)
  • threader x new threader()
  • x.thread1()
  • x.thread1()

8
Message Passing
  • class Message
  • public Message() thread1()thread2()
  • String receiver() sender(String value)
  • return value
  • signal thread1()
  • //do some work that produces a string value
  • sender(value)
  • signal thread2()
  • String value receiver()
  • //use value

9
State Diagrams
  • Conversion of State Diagrams to Code

10
State Diagram Code
  • class statediagram
  • public statediagram() A()
  • void x() A() C()
  • void b() A() B()
  • void a() B() A()
  • void y() C() B()

11
State Charts
  • Conversion of State Charts to Code

12
State Chart Code
  • class StateChart
  • public StateChart() inA() inD() D() A()
  • void y() D() inD()
  • E() inD()
  • void x() A() inA()
  • B() inA()
  • void c() inA() inD()
  • //clean up
  • void leaveA() A()
  • void leaveA() B()

13
Compiler
  • Translation of Join Patterns
  • Tree Structure Representation.

14
Next Steps
  • Add Synchronous Trailing Methods.
  • Benchmarking.
  • Add parent types?
  • eg A() B() -gt partOfInA
Write a Comment
User Comments (0)
About PowerShow.com