add sample of shared memory
rearrange comments and refactor