The purpose of the SYNCJ project is to develop a solution to facilitate the learning of synchronization tools for 4th year programming students from INSA Rennes. In order to do that, we have implemented the synchronization counters mechanism in JAVA.
Synchronization counters are a synchronization mechanism which is less restrictive than mutual exclusion. This mechanism allows an automatic management of alarms and an automatic update of the synchronization variables.
Synchronizations relate to the state of the counters which account for and control access to methods.
When invoking a method, the counters are updated automatically.
Code written by the pogrammer
These synchronization counters are used through conditions to manage the synchronization of the program.
Example of the reader/writer :
We impose a condition on the reading: no writing should be ongoing.
We also impose a condition on the writing: no writing and no reading should be ongoing.
From the user’s declared conditions, we manage the declaration of the synchronization counters and the testing methods.
Then, we automatically generate the counters’ updates and the Java synchronization primitive calling, depending on the method’s name.
Final code generated
Finally, the reader/writer’s code written by the user above is translated as follows:
We can note here the generation of the synchronization counters and the testing methods.