Hi can anyone explain about the synchronization objects
types and where we are using in the code.

Answer Posted / nishant

CRITICAL_SECTION :- CRITICAL_SECTION (CS) objects are initialized and deleted but do not have handles and are not shared by other processes. A variable should be declared to be of type CRITICAL_SECTION. Threads enter and leave a CS, and only one thread at a time can be in a specific CS. EnterCriticalSection blocks a thread if another thread is in the section. The waiting thread unblocks when another thread executes LeaveCriticalSection. If a thread already owns the CS, it can enter again without blocking; that is, CRITICAL_SECTIONs are recursive. CRITICAL_SECTIONs have the advantage of not being kernel objects and are maintained in user space. This usually, but not always, provides performance improvements.

Mutex: - mutexes can be named and have handles, they can also be used for interprocess synchronization between threads in separate processes. Mutex objects are similar to CSs, but, in addition to being process-sharable, mutexes allow time-out values and become signaled when abandoned by a terminating process.A thread gains mutex ownership (or locks the mutex) by waiting on the mutex handle (WaitForSingleObject or WaitForMultipleObjects), and it releases ownership with ReleaseMutex.

Semaphore :- Semaphores maintain a count, and the semaphore object is signaled when the count is greater than 0. The semaphore object is unsignaled when the count is 0.

Event :- Events are used to signal other threads that some event, such as a message being available, has occurred.

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between Struts and JSF? Pls list some most suitable differences.

2849


what is the meaning of constant FILE EXCEEDS LENGTH LIMIT while loading from ps file to vsam in the jcl?

3346


How to handle dynamic menus in mfc? What happens when client calls cocreateinstance?

699


I want recent paper pattern for HP company?

1791


what is functioning of DIalodDataXchange ..?

1198






How do I create a dialog box in mfc?

615


Do you have an idea about MFC?

920


What is mfc class hierarchy?

625


how to repaint when working with horizontal scroll bar

1549


What does mfc stand for?

962


List out the basic features of MFC.

13709


plzz tell me what we can do and dont in tally ERP & sap business one?

1883


what message is sent to an application when the user presses the primary button?

1388


2.create for 10 batch: Employee_Number Employee_name Employee_Dateofjoining Employee_address Employee_salary 1.select the employee name who deriving more than 10 thousand salary and joined before august 08. use structure and pointers

1811