Implemented createSemaphore() and mapSemaphore().