× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx]On Behalf Of Scott Klement
Sent: Friday, October 03, 2003 7:15 PM
To: Midrange Systems Technical Discussion
Subject: RE: why linux?

>> A simple feature comparison.  In WIN32 a mutex name can be up to
>> MAX_PATH length.  I think that is 400 characters.
>> On POSIX on the 400, I think the max length of the name is
>> 16 characters counting the null term.

>You're talking about the name that's printed when debugging?
>(That's the bit that's limited to 16 bytes on the iSeries)
>It has no size limit in either Linux or BSD.
>If you can allocate enough memory to store the
>string, you can use it.  At any rate, it's a whole lot
>more than 400 bytes.

I am looking at the pthread_mutex family of APIs.

http://publib.boulder.ibm.com/iseries/v5r2/ic2924/info/apis/users_61.htm

The lock global mutex is a good example.

http://publib.boulder.ibm.com/iseries/v5r2/ic2924/info/apis/users_66.htm

"The pthread_lock_global_np() function locks a global mutex provided by the
pthreads run-time. The global mutex is a recursive mutex with a name of
"QP0W_GLOBAL_MTX". The global mutex is not currently used by the pthreads
run-time to serialize access to any system resources, and is provided for
application use only."

The global mutex name, "QP0W_GLOBAL_MTX" is 15 characters long. 16 including
the null term.

>> Now I dont know how things are done in POSIX, but in WIN32 when I have
>> to assign a name that will never clash with another on the system, I
>> create a guid ( 16 bytes ) and convert the hex to character ( 32
>> characters ).  Then as I need more names that are offshoots of the base
>> name, I just add on a few more characters. Works out pretty well.  Not
>> minding being proved wrong, I dont know how that is done in POSIX/LINUX.

>The name isn't used to differentiate mutexes in POSIX, it's just used for
>debugging.  A "mutex id" is used to differentiate them (the mutex id is a
>4-byte integer assigned by the system)

>To me it makes a whole lot more sense to have the system assign the ID
>when it's important that it be kept unique.  Having to come up with a
>unique string doesn't make much sense to me, but it may be because the
>early versions of Windows didn't have "real" multitasking, and
>therefore there were no process ids, thread ids, etc.

When different jobs refer to the same mutex to lock the same resource (
sharing a socket port or writing to the end of an IFS text file ), how is
the unique 4 byte, system assigned, identifier known by all of those jobs?

The WIN32 way is for the programmer to assign a long, unique name to the
mutex.  The OS400 way is to ALCOBJ an object in a library.  The MI way is to
LOCKSL ( lock space location ) on a space object in a library.

What is the POSIX way?

( BTW, the OS400 way has advantages over the WIN32 way.  With the library in
the mix, the application can easily be run in TEST and PROD environments.
( Library name is different ).  To make the WIN32 mutex name unique to a
PROD or TEST run environment, the programmer has to remember to add maybe
the path name of the files directory to the common mutex name. )

-Steve


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.