implemented STM instead of monitorLockSynchro for exercise1