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_cond_timedwait

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


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

PostPosted: Thu May 13, 2004 5:17 pm    Post subject: pthread_cond_timedwait 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. pthread_cond_timedwait() causes the thread (which must own the mutex) to block on the conditionnal variable.
  2. When inside the function, the thread releases the mutex before waiting for the conditionnal variable. Those two operations are atomic in the mean that no other thread can gain access to the mutex then signal (or broadcast) the condition without the blocked thread behaving as if this signal (or broadcast) had happened after it blocked on the conditionnal variable.
  3. When the function returns successfully, everything is as if the thread had locked the mutex.
  4. While a thread is blocked on a conditionnal variable, a dynamic binding exists between this conditionnal variable and the mutex which was the second argument. This dynamic binding stops existing when the last thread is unblocked. Even if the conditionnal variable can then be reused with another mutex, the thread which have been unblocked must still acquire the mutex they had associated with the conditionnal variable at call time.
  5. This function is a cancelation point: when cancelability is PTHREAD_CANCEL_DEFERRED and a cancel request falls, the thread must relock the mutex before the first (if any) clean up handler is called.
  6. When a cancel request unblocks the thread, it must not consume any pending condition signal request.
  7. The function must return with an error when the system time is bigger than or equal to the abstime parameter, and the condition has not been signaled or broadcasted yet.
  8. If the POSIX Clock Selection option is supported, the conditionnal variable must provide the information of which clock is used to measure abstime.
  9. When the function fails because of a timeout, it must reacquire the mutex (as when it is successful)
  10. When successful, the function must return 0.
  11. When a timeout occurs, the function must return ETIMEDOUT
  12. When the abstime parameter is invalid, the function must return EINVAL and the mutex state must not have changed during the call.
  13. The function must not return EINTR.

_________________
Sebastien Decugis.


Last edited by tHeDoc on Fri May 14, 2004 1:58 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 May 13, 2004 5:32 pm    Post subject: Conformance Status Reply with quote

Conformance Status


  • Assertion 1 is covered in the 1-1.c test in the PTS, but this test might report FAILED with the function being inside the POSIX scope (in case of a spurious wake up). Anyway, I think this assertion cannot be tested differently, and hope spurious wakeups won't happen there Very Happy . The libc tst-cond3.c tests for this assertion for the pthread_cond_wait() routine.
  • Assertion 2 is not tested yet. It will be tested in a stress test.
  • Assertion 3 is partially tested in the 2-1.c test. A new test will be written here, dealing with different mutex attributes and with different condvar attributes.
  • Assertion 4 is not tested yet. A new testcase will be written.
  • Assertion 5 is not tested yet. A new testcase will be written.
  • Assertion 6 is not tested yet. It will be tested in a stress test.
  • Assertion 7 is tested in PTS 2-2.c and does not need more testing.
  • Assertion 8 is tested in libc tst-cond11.c.
    This test might be ported to the PTS.
  • Assertion 9 is not tested yet. A similar test as for assertion 3 must be written.
  • Assertion 10 cannot be tested.
  • Assertion 11 is tested in PTS 2-2.c ans does not need more testing.
  • Assertion 12 is not tested yet. A new sample will be written here
  • Assertion 13 is tested in libc tst-eintr5.c. This test might be ported to the PTS.

_________________
Sebastien Decugis.


Last edited by tHeDoc on Fri Jun 11, 2004 10:00 am; 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: Fri May 14, 2004 2:06 pm    Post subject: Stress Status Reply with quote

Stress Status

Two stress sample will be written for conformance issues described in the previous post.

Another sample will be written to ensure that no condition signal or broadcast are lost.

_________________
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: Fri May 14, 2004 2:16 pm    Post subject: Scalability Status Reply with quote

Scalability Status

A sample will be written to try and discover if there is a limit in the number of thread blocked in pthread_cond_timedwait which can be awaken with a call to pthread_cond_broadcast.
*Update* This will be tested in the pthread_cond_broadcast conformance tests.

Another sample will measure the duration between the abstime parameter and the moment the function returns the timeout error, trying to discover the influence of some parameters: the number of threads waiting on this conditionnal variable, the number of independent conditionnal variables in use in the system ...

_________________
Sebastien Decugis.


Last edited by tHeDoc on Mon Aug 09, 2004 10:32 am; 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: Fri Jun 11, 2004 5:51 pm    Post subject: Conformance Sample Reply with quote

Conformance Samples



* Update * Jun 29, 2004

The following tests are now included in PTS:

_________________
Sebastien Decugis.


Last edited by tHeDoc on Tue Jun 29, 2004 10:21 am; 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: Tue Jun 22, 2004 5:03 pm    Post subject: Scalability sample Reply with quote

Scalability sample

Here is a sample which will measure the time between the end of the timeout and the actual function return, when the number of threads waiting on the condition increases; and with several mutex & condition attributes.

Alternatively, the output can be graphical. Thanx to the "do-plot" script from Iñaky Pérez-González - RobustMutexes project. Below is a (lightly) modified version of this script.

do-plot requires gnuplot to be installed.

Usage:
compile s-c.c with the macro PLOT_OUTPUT defined.
put the output from the run into a file, "datafile" for example.
./do-plot datafile

An example of output is also provided below.

* Update * 2004 - 08 - 13
The do-plot utility and scalability test are now part of the Open POSIX Test Suite.



Screenshot.png
 Description:
do-plot sample result.
 Filesize:  73.63 KB
 Viewed:  1685 Time(s)

Screenshot.png



_________________
Sebastien Decugis.


Last edited by tHeDoc on Fri Aug 13, 2004 11:38 am; 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 Jul 01, 2004 10:02 am    Post subject: Stress tests Reply with quote

Stress Tests

Three stress tests have been written and integrated to Open POSIX Test Suite.
  • stress1.c tests for conformance assertion 2.
  • stress2.c tests for conformance assertion 6.
  • stress.c checks that no condition signal is lost.

_________________
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 - Conditionnal variables 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