The producer and consumer execute in different threads, possibly on different computers. The only synchronization is data-flow. The producer may outpace the consumer and produce elements faster than the consumer can deal with them. In this case the elements are buffered. However the consumer cannot outpace the producer and must wait if no next element is available.
|Execution time||17.6 seconds||3.9 seconds|
Comments: In general Mozart and Java have comparable performance. But Mozart has superior mechanisms for data-flow and multi-threading both of which are important in this application.
|Execution time||1 hour||8.0 seconds|
Comments: The main reason that Java is so much slower is that for each element the producer produces a network message will be sent and the thread synchronizes on the return of the rmi call. The Mozart system will automatically gather together groups of elements that the producer has produced and thus sends less messages across the net. In addition in Mozart the producer does not need to synchronize only the consumer.
The Java program can, of course, be optimized for the given distributed structure, but this makes the program larger and more complicated. Also, the distributed program would differ from the centralized program even more, demonstrating that efficient distributed programming is considerably more difficult in Java than in Mozart. Note that the only difference between the centralized and distributed program in Mozart is that the provision for sharing the stream between the two processes, consumer and producer. The rest of the program is identical.
|main | centralized | distributed|