Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6864723
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T02:56:52+00:00 2026-05-27T02:56:52+00:00

what is the difference between mutex and monitor implementation. Can any one please help

  • 0

what is the difference between mutex and monitor implementation. Can any one please help me to learn both of these for wp7(implementable code for wp7). Please try to add some code snippets that help me to understand the techniques in a simple way.
Thanx in advance
Stezma

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T02:56:53+00:00Added an answer on May 27, 2026 at 2:56 am

    A mutex can lock across multiple processes. This would be useful in Windows Phone if you have a scheduled task running that needs exclusive access to a resource. In order to lock a mutex across processes the Mutex must be given a name.

    A monitor can lock only within a process.

    Mutex Example:

    Phone App Task:

       public class DatabaseService
        {
        private Mutex _mut=new Mutex("mutex control",false);
        public void AddToDatabase(DbObject row)
        {
            mut.WaitOne();
            SaveRow(row);
            mut.ReleaseMutex();
        }
        }
    

    Scheduled Task class:

     public class ResourceUtilisation
        {
        private Mutex _mut=new Mutex("mutex control",true);
        //.. does stuff
        private static void UseResource()
        {
            // Wait until it is safe to enter.
            _mut.WaitOne();
    
            //Go get dataabse and add some rows
            DoStuff();
    
            // Release the Mutex.
            _mut.ReleaseMutex();
        }
        }
    

    In the above example we’re only allowing one app at a time access to the local database resource. This is why we’d use a Mutex.

    Monitor Example (using lock syntax):

    Phone App Task:

       public class DatabaseService
        {
        private object _locker=new object();
        public void AddToDatabase(DbObject row)
        {
            lock(_locker)
                SaveRow(row);
        }
        }
    

    Scheduled Task class:

     public class ResourceUtilisation
     {
        private object _locker=new object();
        //.. does stuff
        private static void UseResource()
        {
    
            //Go get dataabse and add some rows
            lock(_locker)
                DoStuff();
        }
     }
    

    In this example we can stop more than one application thread entering SaveRow and we can stop more than one ScheduledTask thread from entering the DoStuff method. What we can’t do with a Monitor is ensure that only one thread is accessing the local DB at once.

    That’s basically the difference. Monitor is much faster than a Mutex as well.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What is the real difference Conceptually and Implementation point of view between Semophore, Mutex,
Any difference between these two statements? $(document).ready(function() { // Code }); $(function() { //
What is the difference between lock and Mutex? Why can't they be used interchangeably?
Difference between a bus error and a segmentation fault? Can it happen that a
The difference between Chr and Char when used in converting types is that one
Is there any difference between int on_exit(void (*function)(int , void *), void *arg); and
What is actually the difference between these two casts? SomeClass sc = (SomeClass)SomeObject; SomeClass
If one Googles for difference between notify() and notifyAll() then a lot of explanations
There is an existing question regarding difference between Mutex and Critical section but it
how does a mutex can be shared between processes? does it mean a different

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.