nptl.BullOpenSource.Org Forum Index nptl.BullOpenSource.Org
NPTL Tests & Trace project. Homepage.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

pthread_mutex_init

 
Post new topic   Reply to topic    nptl.BullOpenSource.Org Forum Index -> Tests - Mutex related functions
View previous topic :: View next topic  
Author Message
tHeDoc
Project Maintener


Joined: 21 Apr 2004
Posts: 237
Location: Echirolles, France

PostPosted: Thu Apr 22, 2004 11:12 am    Post subject: pthread_mutex_init Reply with quote

POSIX

POSIX is a registered trademark from the IEEE. The following assertions are derived from copyrighted material. Original text and copyright information can be found at http://www.opengroup.org.

Here is what POSIX requires for this function:

  1. The function pthread_mutex_init(...) initializes a mutex referenced by 'mutex' with attributes specified by 'attr'.
  2. If the mutex attribute pointer passed to pthread_mutex_init is NULL, the effects on the mutex are the same as if a default mutex attribute object had been passed.
  3. Upon successful initialization, the mutex becomes initialized and unlocked.
  4. The macro PTHREAD_MUTEX_INITIALIZER can be used to initialize mutexes that are statically allocated. The effect are equivalent to dynamic initialization by a call to pthread_mutex_init() with parameter attr specified as NULL, except that no error checks are performed.
  5. Upon success the function returns 0.
  6. The function fails and returns:

    1. EAGAIN if system lacks a resource (other than memory).
    2. ENOMEM if there is not enough memory.
    3. EPERM if caller has not the privilege to perform the operation.

  7. The function does not return an error code of EINTR

_________________
Sebastien Decugis.


Last edited by tHeDoc on Mon Apr 26, 2004 2:59 pm; edited 3 times in total
Back to top
View user's profile Send private message Send e-mail Visit poster's website
tHeDoc
Project Maintener


Joined: 21 Apr 2004
Posts: 237
Location: Echirolles, France

PostPosted: Thu Apr 22, 2004 11:18 am    Post subject: Conformance Status Reply with quote

Conformance Status

  • Assertion 1 will be tested in the pthead_mutexattr_* routines tests.
  • Assertion 2 is claimed to be tested in OPTS (1-1.c) but it appears that it does not test much. New testcase shall be written here.
  • Assertion 3 is implicitely tested each time a mutex is used after having been initialized, and does not need more testing.
  • Assertion 4 is claimed to be tested in OPTS (3-1.c) but the test only checks for compilation errors. The macro is used in others OPTS tests and in glibc NPTL tests, but the behavior is not tested. New testcase is needed here.
  • Assertion 5 is implicitely tested each time a mutex is used, and does not need more testing.
  • Assertion 6.a, 6.b and 6.c are not tested yet. New testcases are needed here.
  • Assertion 7 is not tested yet. New testcase is needed here.


*Update* May 07, 2004
All assertions but 6.a are now tested. See below for the test cases.

_________________
Sebastien Decugis.


Last edited by tHeDoc on Fri May 07, 2004 2:25 pm; edited 2 times in total
Back to top
View user's profile Send private message Send e-mail Visit poster's website
tHeDoc
Project Maintener


Joined: 21 Apr 2004
Posts: 237
Location: Echirolles, France

PostPosted: Thu Apr 22, 2004 11:23 am    Post subject: Stress status Reply with quote

Stress Status

The limits issues will be covered in the assertions 6.a and 6.b conformance tests.

A stress sample looping on mutexes creations and destructions with different attributes has to be written to ensure the function does not leak memory.

_________________
Sebastien Decugis.


Last edited by tHeDoc on Thu Apr 29, 2004 4:47 pm; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail Visit poster's website
tHeDoc
Project Maintener


Joined: 21 Apr 2004
Posts: 237
Location: Echirolles, France

PostPosted: Thu Apr 22, 2004 11:25 am    Post subject: Scalability status Reply with quote

Scalability Status

There is currently no sample test concerning the scalability issues in this function. As pthread_mutex_init() might allocate some resources, one could think such a sample has a meaning. A sample will be written to test the maximum number of mutexes that can be initialized (the memory limitation will not be our concern here) and whether the initialization duration is dependent on the number of mutexes already initialized.

_________________
Sebastien Decugis.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
tHeDoc
Project Maintener


Joined: 21 Apr 2004
Posts: 237
Location: Echirolles, France

PostPosted: Mon Apr 26, 2004 2:47 pm    Post subject: Tests Reply with quote

Here are some additionnal conformance tests for assertions not tested yet.

NOTE:
There is no testcase for assertion 6.a because the function should not use any other ressource ( priori). It will eventually be added later.

*Update Apr 30, 2004*
-> Added testfrmw.c file in each test; allow file output without changing the tests.

*Update May 04, 2004*
-> Renaming of test cases for PTS integration
-> Changing return codes for PTS integration

*Update May 12, 2004*
Some of the tests have been integrated in the PTS:
  • 1-2
  • 3-2
  • 5-3

You can find the source code here:
http://cvs.sourceforge.net/viewcvs.py/posixtest/posixtestsuite/conformance/interfaces/pthread_mutex_init/

The test case for EPERM error code was erroneous. Old code is here: 5-2old.c

*Update May 14, 2004*
Remaining tests have been integrated in the PTS:
  • speculative/5-2
  • 5-1



5-2old.c.tar.gz
 Description:
This test was meant to test the EPERM error code; but the test case is erroneous.

Download
 Filename:  5-2old.c.tar.gz
 Filesize:  10.23 KB
 Downloaded:  2292 Time(s)


_________________
Sebastien Decugis.


Last edited by tHeDoc on Fri May 14, 2004 2:24 pm; edited 14 times in total
Back to top
View user's profile Send private message Send e-mail Visit poster's website
tHeDoc
Project Maintener


Joined: 21 Apr 2004
Posts: 237
Location: Echirolles, France

PostPosted: Fri Apr 30, 2004 10:26 am    Post subject: Stress test Reply with quote

Here is a sample to stress the pthread_mutex_init/destroy subsystem.

Please read comments in the file for more details.

The sample will run continuously until it receives SIGUSR1. It will then terminate cleanly.

*Update May 14, 2004*
->Some cleanups

*Update*: June 03, 2004
-> Cosmetics Embarassed

* Update * Jun 29, 2004
The stress test is now included in PTS and can be found here (stress.c).

_________________
Sebastien Decugis.


Last edited by tHeDoc on Tue Jun 29, 2004 10:27 am; edited 4 times in total
Back to top
View user's profile Send private message Send e-mail Visit poster's website
tHeDoc
Project Maintener


Joined: 21 Apr 2004
Posts: 237
Location: Echirolles, France

PostPosted: Fri Apr 30, 2004 3:28 pm    Post subject: Scalability sample Reply with quote

Here is a sample designed to test the scalability of pthread_mutex_init

The output looks like:
Code:

Duration for the operations:
        0 :  0.000015 s
        1 :  0.000004 s
        2 :  0.000004 s
        3 :  0.000004 s
 [...]
   103105 :  0.000004 s
   103106 :  0.000004 s
   103107 :  0.000004 s
   103108 :  0.000004 s

Where "Operation" consists in N mutex { init, destroy, init, lock, unlock, lock} where the mutexes have different attributes.

The sample does not decide by himself whether the function is scalable or not; it will require human intervention to look whether the latest duration are bigger than the first ones or it is comparable.

*Update May 14, 2004*
-> source cleaning.

* Update * Jun 29, 2004
* Added support for PLOT_OUTPUT macro (will enable output usable for do-plot script)
* Added result analysis (least squares approximation) to give a result PASSED or FAILED. -- A human eye is not required anymore.

The test has been integrated into the PTS testsuite and can be found here (s-c.c).



Screenshot.png
 Description:
PLOT_OUTPUT results
 Filesize:  20.34 KB
 Viewed:  1962 Time(s)

Screenshot.png



_________________
Sebastien Decugis.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    nptl.BullOpenSource.Org Forum Index -> Tests - Mutex related functions All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group