class mutex

jay.krell at cornell.edu jay.krell at cornell.edu
Wed Oct 25 03:12:22 EDT 2000


Sorry..I kind of misspoke. Though what I said is all true, it's not all
relevant. Many kernel objects are unnamed, and therefore have no presence in
the namespace. This is what happens when you pass NULL for the name to
CreateEvent, CreateMutex, CreateSemaphore. Processes and threads are
also..uh, I think impossible to name from the Win32 api. Files too. File
opening does relate to the namespace, as things like c: are there.

Still, NT definitely does not use tempfiles for mutexes. Nor does
Win95/98/Me..
Whether or not Win9x has this internal hierarchical namespace, I don't know.
Win9x critical sections should also be much more efficient than Win9x
mutexes, but I'm not familiar with their details.

Mutexes have the extra features of
    work cross process
    locking them can accept a non infinite timeout parameter (critical
sections on NT4+ and maybe Win98 have TryEnterCriticalSection, but that's
still weaker than a timeout parameter).

The features are not free, and sometimes are needed, sometimes not.

 - Jay

-----Original Message-----
From: Olivier Dagenais <olivierS.dagenaisP at canadaA.comM>
Newsgroups: comp.lang.python
To: python-list at python.org <python-list at python.org>
Date: Tuesday, October 24, 2000 8:55 AM
Subject: Re: class mutex


>Great!  I learn something new every day...
>So... what would Win95/98/Me do?
>
>--
>----------------------------------------------------------------------
>Olivier A. Dagenais - Software Architect and Developer
>"Someone called 'Type your name here' is impersonating me on the
>internet and is posting exactly the same things I am posting!"
>
>
><jay.krell at cornell.edu> wrote in message
>news:mailman.972384960.25318.python-list at python.org...
>> No. Windows does not use a tempfile. That would be crude.
>>
>> NT at least has an internal in-memory-mostly hierarchical namespace. The
>> file system and registry namespaces rooted in the in memory namespace.
>Lots
>> of different types of named objects can live in the namespace, and the
>> system is extensible (there's a toplevel directory \ObjectTypes). Types
>> include Type, Directory, Port, Device, Event (Win32/NT kernel event, same
>> thing), Mutant (something that an implement the semantics of both Win32
>> mutexes and OS/2 mutexes), SymbolicLink, Section (file memory mapping,
>> possibly pagefile backed), Process, Thread, Timer, Token (security),
>Driver,
>> File, Key (registry). Win32 objects live in \BaseNamedObjects, at least
on
>> non Terminal Server logins.
>>
>> Run winobj from www.sysinternals.com.
>>
>> Win32 critical sections are much cheaper than Win32 mutexes.
>> Every mutex operation is a syscall.
>> Critical sections only involve syscalls when there is contention on
>them --
>> they on demand create a kernel object and wait on it.
>>
>>  - Jay
>>
>> -----Original Message-----
>> From: Olivier Dagenais <olivierS.dagenaisP at canadaA.comM>
>> Newsgroups: comp.lang.python
>> To: python-list at python.org <python-list at python.org>
>> Date: Sunday, October 22, 2000 6:16 PM
>> Subject: Re: class mutex
>>
>>
>> >MSDN says this about an article relating to CreateMutex:  "You can use a
>> >mutex object to protect a shared resource from simultaneous access by
>> >multiple threads or processes."  Does Unix/Linux also have something
like
>> >this (at the process level)?  What about Mac and (maybe) other
platforms?
>> >It would be nice if they were wrapped in one convenient Python
>> >module/object.
>> >
>> >It sounds like Windows uses a tempfile to accomplish this and I would
>guess
>> >Unix/Linux - a file-oriented OS - would do the same thing.  However,
>these
>> >are just guesses, we'd need to confirm this...
>> >
>> >--
>> >----------------------------------------------------------------------
>> >Olivier A. Dagenais - Software Architect and Developer
>> >"Someone called 'Type your name here' is impersonating me on the
>> >internet and is posting exactly the same things I am posting!"
>> >
>> >
>> >"Darrell" <news at dorb.com> wrote in message
>> >news:MUII5.70068$JS3.10348560 at typhoon.nyroc.rr.com...
>> >> If your on Windows then try "win32event.CreateMutex"
>> >>
>> >> --Darrell
>> >>
>> >> "Prof. Peter Stoehr" <peter.stoehr at weihenstephan.org> wrote in message
>> >> > Based on that, I have two questions:
>> >> > 1) Does python provide a real mutex object.
>> >> > 2) What is the use of the class mutex
>> >> >
>> >>
>> >>
>> >>
>> >
>> >
>> >--
>> >http://www.python.org/mailman/listinfo/python-list
>>
>>
>
>
>--
>http://www.python.org/mailman/listinfo/python-list





More information about the Python-list mailing list