Download VDMTools®
Transcript
The VDM++ to Java Code Generator 5 Code Generation of Concurrent VDM++ Specifications 5.1 Introduction VDM++ provides a number of features for specifying systems with concurrently executing threads. These allow specification of the functionality of individual threads, and specification of synchronization for objects shared amongst threads. Java provides support for threads via the Thread class, and allows synchronization of shared objects using monitors. However VDM++ provides a more sophisticated mechanism for synchronizing access, so the translation from VDM++ specifications to Java is somewhat more subtle than might be expected. 5.2 Overview In addition to the code generation described in the preceding chapters, the Concurrent VDM++ to Java Code Generator allows generation of the following constructs: • procedural threads • periodic threads • the start statement • permission predicates • mutex synchronization • history expressions 5.2.1 Code Generation From the graphical user interface of the VDM++ Toolbox, the “Generate code with concurrency constructs” option should be selected. From the command line the -e flag should be used to specify generation of concurrency constructs: vppde -j -e [other options] specfile(s) 5.3 Translation Approach Code generation of concurrent VDM++ specifications is less straightforward than code generation of sequential specifications largely because mechanisms for synchronization 47