pthread in Linux vs Windows
I have some questions regarding pthread related to windows and linux. pthread is supported in both linux and windows. In multithreading environment we use mutex/critical section/semaphore to synchronize operations on shared resource.
This is specific to windows
* kernel objects
* multi-process capability
* timeout support for signals
* slow performance compare to critical section
Critical Section :
* user level objects
* no muti-process capability
* infinite wait for signals
* high performance
Currently I'm optimizing a code which used both _beginthread (Win API) and pthread_create (pthread API). As well as they used pthread mutex, CRITICAL_SECTION, and Windows Mutex.
My questions are,
1. What is the relation between thread and mutex/critical section?
2. Using of pthread_mutex_t in _beginthread() or CRITICAL_SECTION in pthread_create() will have any impact?
3. Why mutex initialization creating new handle? Why critical section initialization not creating events?
Please help me out from this.