Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


What is Thread ?(VC++)What is the difference between Cmutex
and Csemaphone?

Answers were Sorted based on User's Feedback



What is Thread ?(VC++)What is the difference between Cmutex and Csemaphone? ..

Answer / jitendra

An object of class CMutex represents a "mutex" ? a
synchronization object that allows one thread mutually
exclusive access to a resource. Mutexes are useful when
only one thread at a time can be allowed to modify data or
some other controlled resource. For example, adding nodes
to a linked list is a process that should only be allowed
by one thread at a time. By using a CMutex object to
control the linked list, only one thread at a time can gain
access to the list.
An object of class CSemaphore represents a "semaphore" ? a
synchronization object that allows a limited number of
threads in one or more processes to access a resource. A
CSemaphore object maintains a count of the number of
threads currently accessing a specified resource.

Is This Answer Correct ?    12 Yes 2 No

What is Thread ?(VC++)What is the difference between Cmutex and Csemaphone? ..

Answer / k.santhoshkumar

A thread is basically a path of execution through a
program. It is also the smallest unit of execution that
Win32 schedules. A thread consists of a stack, the state of
the CPU registers, and an entry in the execution list of
the system scheduler. Each thread shares all the process's
resources.

Is This Answer Correct ?    2 Yes 0 No

What is Thread ?(VC++)What is the difference between Cmutex and Csemaphone? ..

Answer / mahesh vanama

A mutex provides mutual exclusion, either producer or consumer can have the key (mutex) and proceed with their work. As long as the buffer is filled by producer, the consumer needs to wait, and vice versa.
A semaphore is a generalized mutex. In lieu of single buffer, we can split the 4 KB buffer into four 1 KB buffers (identical resources). A semaphore can be associated with these four buffers. The consumer and producer can work on different buffers at the same time.

Is This Answer Correct ?    0 Yes 0 No

What is Thread ?(VC++)What is the difference between Cmutex and Csemaphone? ..

Answer / zero zero

CMutex CSemaphore

Allows at most one thread allows more than one thread to
access the resource(RES) Access the RES simultaneousl
y

Prevents more than one It allows more that
one thread 2
Thread to access the res access the resource

Using mutex, we can Using semaphore, we can
sync
Synchronize one/more threads threads with in the process
In different process or with in
Process.

CMutex is a single lock CSemaphore is a
multilock.

CMutex Implementation CSemaphore Implementation
API’s in CMutex Dev:
::Create Mutex() ::CreateSemaphore()
::WaitForSinglrObject() ::WaitForSinglrObject
()
::WaitForMultipleObject
() ::WaitForMultipleObject()
::Release Mutex() ::Release Semaphore
()
::CloseHand
le()

Is This Answer Correct ?    0 Yes 2 No

What is Thread ?(VC++)What is the difference between Cmutex and Csemaphone? ..

Answer / dhanya shajit

Thread is the smallest set of instructions that can be
executed.

Cmutex and Csemaphore are the ways used for synchronization
purpose.

the difference between the above two is..Cmutex is a single
lock where as csemaphore is a multilock..


mutex is used for mutual exclusion while semaphore is a
synchonozation variabl

Is This Answer Correct ?    4 Yes 7 No

Post New Answer

More MFC Interview Questions

1)why we cant create more than one instance of the class Derived from CWinApp

5 Answers   Alstom,


What is socket?

3 Answers  


What is the difference between Synchronous sockets and asynchronous sockets?

2 Answers  


If i derive a new class from CObject what are the basic features my derived wil get ?

4 Answers   Microsoft,


what is the use of Mutex and critical section

2 Answers  


List out the basic features of MFC.

4 Answers   Mphasis,


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

0 Answers  


What are the advantages of using Doc/View or SDI over DialogBox

2 Answers  


What is CArchive class dowes?

4 Answers  


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

1 Answers  


if both base and derived class have the constructors if i create an object for derive class which class constructor is executed first

10 Answers   Siemens, Symphony,


Does the application have more than one object? If Yes, Briefly explain.

2 Answers   Soltius Infotech,


Categories