Implements system calls sem_init and sem_destroy.