Process VS thread : can two processes share the same shared memory ? can two threads ?

Viewed 28141

After thinking about the the whole concept of shared memory , a question came up:

can two processes share the same shared memory segment ? can two threads share the same shared memory ?

After thinking about it a little more clearly , I'm almost positive that two processes can share the same shared memory segment , where the first is the father and the second is the son , that was created with a fork() , but what about two threads ?

Thanks

4 Answers
Related