Although this question has been asked in different ways in SO, i will ask it from pthreads perspective in a different way to know the tools to provide synchronization.
We know that each thread has it's own thread stack, but shares the heap and global data. When the heap is shared, i am confused how and which synchronization tool to provide to protect the full heap?