source code of shm