1 / 9

Prism-MW Tutorial

Prism-MW Tutorial. CS 795 / SWE 699 Sam Malek Spring 2010. Prism-MW. Download Prism-MW 2.1 source code from http://csse.usc.edu/~softarch/Prism/ Compile and develop your code on top of it Alternatively, you could download Prism-MW Jar file and set the appropriate class paths

Download Presentation

Prism-MW Tutorial

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Prism-MW Tutorial CS 795 / SWE 699 Sam Malek Spring 2010

  2. Prism-MW • Download Prism-MW 2.1 source code from http://csse.usc.edu/~softarch/Prism/ • Compile and develop your code on top of it • Alternatively, you could download Prism-MW Jar file and set the appropriate class paths • The easiest way to compile the source code is to use Eclipse • You can download the eclipse from: http://www.eclipse.org/ • Create a Java project and import the source code • Eclipse will automatically compile the code for you

  3. Package Structure • Prism • Benchmark • Core • Exception • Extensions • Architecture • Component • Connector • Evt • Port • Style • Test • Core • Extensible_port • real_time • Style Packages you would need to be familiar with

  4. Simple Calculator

  5. Simple Calculator – Single Address Space 1/2 Creates an event queue of 100 events package Prism.test.core; import Prism.core.*; import Prism.test.*; class testArchLocally { static public void main(String argv[]) { FIFOScheduler sched = new FIFOScheduler(100); Scaffold s = new Scaffold(); RRobinDispatcher disp = new RRobinDispatcher(sched, 10); s.dispatcher=disp; s.scheduler=sched; Architecture arch = new Architecture("Demo"); arch.scaffold=s; AbstractImplementation addition = new Addition(); Component t = new Component("add", addition); t.scaffold=s; AbstractImplementation subtract = new Subtract(); Component sub = new Component("Sub", subtract); sub.scaffold=s; GUI gui = new GUI(); Component b = new Component("GUI", gui); b.scaffold=s; Connector conn1 = new Connector("conn1"); conn1.scaffold =s; arch.add(b); arch.add(conn1); arch.add(t); arch.add(sub); A data structure that is associated with the scheduler and dispatcher, may be used for monitoring and so on Creates 10 threads for processing events Creates the architecture object Creates addition, subtraction, and gui components; also attaches them to the scaffold Creates the connector Adds components and connector to the architecture

  6. Simple Calculator – Single Address Space 2/2 Port subReplyPort = new Port("subReplyPort", PrismConstants.REPLY); sub.addCompPort (subReplyPort); Port conn1RequestPort1 = new Port("conn1RequestPort1", PrismConstants.REQUEST); conn1.addConnPort(conn1RequestPort1); arch.weld(subReplyPort, conn1RequestPort1); Port tReplyPort = new Port("tReplyPort", PrismConstants.REPLY); t.addCompPort(tReplyPort); Port conn1RequestPort2 = new Port("conn1RequestPort2", PrismConstants.REQUEST); conn1.addConnPort(conn1RequestPort2); arch.weld(tReplyPort, conn1RequestPort2); Port bRequestPort = new Port ("bRequestPort", PrismConstants.REQUEST); b.addCompPort(bRequestPort); Port conn1ReplyPort1 = new Port("conn1ReplyPort1", PrismConstants.REPLY); conn1.addConnPort(conn1ReplyPort1); arch.weld(bRequestPort, conn1ReplyPort1); disp.start(); arch.start(); } } Creates the ports and attaches them to the appropriate component/connector Start the dispatcher (threads) and then the architecture

  7. Simple Calculator – Distributed

  8. Client Side – GUI Component String hostName = "localhost"; int portNum = 2601; FIFOScheduler sched = new FIFOScheduler(100); Scaffold s = new Scaffold(); RRobinDispatcher disp = new RRobinDispatcher(sched, 10); s.dispatcher=disp; s.scheduler=sched; Architecture arch = new Architecture("Demo1"); arch.scaffold=s; Connector conn=new Connector("conn"); conn.scaffold=s; ExtensiblePort ep = new ExtensiblePort ("ep", PrismConstants.REQUEST); SocketDistribution sd=new SocketDistribution(ep); ep.addDistributionModule(sd); ep.scaffold = s; conn.addConnPort(ep); GUI gui = new GUI(); Component b = new Component("GUI", gui); b.scaffold=s; arch.add(conn); arch.add(b); arch.add(ep); Port bRequestPort = new Port("bRequestPort", PrismConstants.REQUEST); b.addCompPort(bRequestPort); Port connReplyPort = new Port("connReplyPort", PrismConstants.REPLY); conn.addConnPort(connReplyPort); arch.weld(bRequestPort, connReplyPort); disp.start(); arch.start(); ep.connect(hostName, portNum);

  9. Server Side – Addition Component int portNum = 2601; FIFOScheduler sched = new FIFOScheduler(100); Scaffold s = new Scaffold(); RRobinDispatcher disp = new RRobinDispatcher(sched, 10); s.dispatcher=disp; s.scheduler=sched; Architecture arch = new Architecture("Demo"); arch.scaffold=s; Connector conn=new Connector("conn"); conn.scaffold=s; ExtensiblePort ep = new ExtensiblePort("ep", PrismConstants.REPLY); SocketDistribution sd=new SocketDistribution(ep, portNum); ep.addDistributionModule(sd); ep.scaffold = s; conn.addConnPort(ep); Addition addition = new Addition(); Component t = new Component("Add", addition); t.scaffold=s; arch.add(conn); arch.add(t); arch.add(ep); Port tReplyPort = new Port ("tReplyPort", PrismConstants.REPLY); t.addCompPort(tReplyPort); Port connRequestPort = new Port("connRequestPort", PrismConstants.REQUEST); conn.addConnPort(connRequestPort); arch.weld(tReplyPort, connRequestPort); disp.start(); arch.start();

More Related