* Semaphores and Signals Clash?
@ 1997-04-15 4:00 Shripad Lale
0 siblings, 0 replies; only message in thread
From: Shripad Lale @ 1997-04-15 4:00 UTC (permalink / raw)
Hi!
I am facing a strange problem with Digital Unix (OSF/1) semaphores and
signals and wonder if any one of you have encountered something
similar.
I have two processes called Scheduler and Task. The Scheduler
schedules Task in a deterministic manner. It releases the semaphore
when it wants to allow the Task to run and sends it a signal when it
wants to stop it. The Task releases the semaphore in it's signal
handler, so that the semaphore comes back to the Scheduler.
In order to time the execution, I give the semaphore to the Task, set
the alarm for the required duration and then go into a blocking wait
for the semaphore. If the semaphore is released earlier, the wait
unblocks and I reset the alarm and proceed. If the semaphore is not
released (the Task does not finish its job, I get the sigAlarm signal
after the timer expires and I send the SigUsr1 signal to the task.
Now, for the problem.
If the Task finishes it's processing AND within a very short time
(like 10ms) the timer expires THEN the sem_take function, which should
unblock (since cronologically the semaphore was given first and the
timer expired later), actually 'breaks' indicating that the sem_take
was interrupted by a signal. This leads me to believe that the Task
has not finished it's job and thus not released the semaphore. So, I
send it a signal and expect the semaphore back from it (in it's signal
hander). But this is a dead lock situation. The Task does not have a
semphore to give, while I keep waiting for one.
The question here is, are there any latency issues involved while
using semphores and signals? If a semaphore is being transfered from
one process to another AND a signal arrives at this time, can the
semaphore operation get lost? (This is what seems to happen in my
case).
Would appreciate some help from someone out there.
You may either post your replys to this newsgroup or mail them to me.
Thanks in advance for any help, or even for any thought given to this
problem!
Shripad
-------
--
+--------------------------------+------------------------------+
| Shripad Lale | |
| Tata Consultancy Services,Pune | Tel(O) : (407)-242-4204 |
| c/o General Electric-Harris | Tel(R) : (407)-956-2547 |
| 407, John Rodes Blvd, | email : slale@ge-harris.com |
| Melbourne, FL 32901, USA | |
+--------------------------------+------------------------------+
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~1997-04-15 4:00 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1997-04-15 4:00 Semaphores and Signals Clash? Shripad Lale
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox