A Comparison of the Concurrency and Real-Time Features of Ada 95 and Java
Both Ada and Java support concurrent pro- gramming, but through quite different approaches.Ada has built-in tasking features with concurrency semantics, independent of the language’s OOP model, whereas Java’s thread support relies on OOP and is based on special execution properties of methods in several predefined classes. Ada achieves mutual exclusion through protected objects with encapsulated components; Java uses the classical “monitor” construct with “synchronized” methods/blocks. Ada models condition-based synchronization and communication through suspension objects, protected entries, and rendezvous; Java provides the low-level “wait” / “notification” methods. Both languages offer timing control; Ada additionally provides user-specifiable scheduling policies.
Compared to Java, Ada’s concurrency model is less susceptible to deadlock and race conditions. Neither language is intrinsically superior in run-time performance. In some areas Ada’s semantics entail less run-time overhead; in other areas Java may have the advantage.
Ada offers direct support for real-time programming through a combination of facilities in the core language and the Systems Programming and Real-Time Systems Annexes. Java lacks some critical functionality, and its semantics for thread scheduling are not completely defined. Depending on dynamic allocation and garbage collection, Java raises issues of time and space predictability. Work is in progress on making Java more applicable to real-time systems; at present Ada is the more appropriate language