Finalized the design of three shared memories and refactor the openning and creating of the shared memory functions