add semaphore func
add shared memory declare