doubts regarding POSIX semaphores

sashti srinivasan svasn_rtems at yahoo.com
Wed Mar 31 12:15:56 UTC 2004


Hello All,

    I have a few doubts to ask:

(1)  I configure with a maximum posix semaphores of
110.  Create 100 semaphores, delete all of them, again
do sem_init 100 times, again delete them.  i.e., I
created 100 posix semaphores and deleted them 100
times.  I liked to repeat this for a large number of
times.  But while doing on 3rd time, sem_init fails
and puts ENOSPC on errno.  According to the posix_user
document, the reasons for this are:
   (a) A resource required to initialize the semaphore
has been exhausted.  I am not very clear with this. 
May anyone give me some ideas regarding what might
have went wrong.
   (b) The limit on semaphores(SEM_VALUE_MAX)reached. 
I do not think this might be the reason.  I gave 5 for
semvalue.  Moreover, I gave same value all the times. 
If this is wrong, sem_init could not have succeeded
first two(hundred) times.
     Thanks in advance for ideas and suggestions.

(2)  I have been doing some timing tests and have been
asking for ideas and suggestions based on them.  Among
others, I have been asked to double check the timing
tests.  I too have this suspicion on these results. 
Particularly, I see a substantial overhead in
measurement.  I suppose it takes 3 uSec to measure.  I
ensured that effect of this overhead is minimum, by
measuring only before and after a large number of
operations and took average.  Regarding errors, I am
not getting sufficient hints of bugs/errors, other
than the obvious ones which I have corrected even
before asking for ideas.  Now, assuming that results
are OK, may I have some clarification on the following
aspect?
    I run a test.  sleep for a while.  Run the tests
again.  I get different results.  But If I reboot the
system(pc686), I get repeatable results.  May I have
some explanation of this?

With Regards
Srinivasan

__________________________________
Do you Yahoo!?
Yahoo! Finance Tax Center - File online. File on time.
http://taxes.yahoo.com/filing.html



More information about the users mailing list