what is mutex?

Answer Posted / rock star

Mutual exclusion (often abbreviated to mutex) algorithms are
used in concurrent programming to avoid the simultaneous use
of a common resource, such as a global variable, by pieces
of computer code called critical sections.

Examples of such resources are fine-grained flags, counters
or queues, used to communicate between code that runs
concurrently, such as an application and its interrupt
handlers. The problem is acute because a thread can be
stopped or started at any time.

To illustrate: suppose a section of code is mutating a piece
of data over several program steps, when another thread,
perhaps triggered by some unpredictable event, starts
executing. If this second thread reads from the same piece
of data, the data, in the process of being overwritten, is
in an inconsistent and unpredictable state. If the second
thread tries overwriting that data, the ensuing state will
probably be unrecoverable. These critical sections of code
accessing shared data must therefore be protected, so that
other processes which read from or write to the chunk of
data are excluded from running.

A mutex is also a common name for a program object that
negotiates mutual exclusion among threads, also called a lock.

Is This Answer Correct ?    8 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what is the current salary package in India for a lamp programmer

1872


When will you use shell script/Perl ahead of C/C++?

655


What is web.configuration? how is it work? & wht is use this?

1361


Delta 5 weight scale not connect with oracle application what i can do?

1805


hi viewers, tell me,what is scripting and programming, define and difference...pls

1500






hi This is radhika.Can anyone help me to know the question papers of NATIONAL INFORMATICS CENTRE for the post of scientific officer/engineer? if anyone know plz tell me question paper pattern

1528


can we extend a class having only one parameterised constructor.Suggest the process to do it.

2054


what is the similarity between networking devices?

1676


How do you pass variables forwrd to future CECI sessions

4076


public static void main(String args[]) describe it

1575


What is test execution and when will we start execution please send me one example for this question

1424


they asked me about srs (software requirement specifcation)? how can i get anydocumentation about srs & other documnts infomation like bdd, in testing? its urgent?

1452


how can i split string in a textbox in windows appication using C#.net

2210


What ports must be open for DCOM over a firewall? What is the purpose of Port 135?

7176


How to get the index of the clicked field in reports in ABAP?

1155