At 09:27 -0700 on 05/06/2012, Charles Mills wrote about Re: Multiple waiting tasks, one control block?:

Robert, thanks.

I am kicking the ENQ idea around. ENQ is certainly promising. There are some
interlock issues with re-establishing the exclusive ENQ after relinquishing
it, and what do the intended waiting tasks do in the meantime, but it has
promise.

You start with an EXC ENQ with the resource not yet Available. Once it is available, you DEQ. Everyone who wants the resource does a SHR ENQ (and will fire off when the DEQ is done). As to re-establishing the EXC ENQ, you just issue it after the DEQ. This will wait until all the SHR ENQs DEQ at which point you acquire a new resource and then DEQ. Any new task that ENQ SHRs after the 2nd EXC ENQ will wait for the 2nd EXC DEQ.

The idea is that you EXC ENQ, get the resource and store its address/whatever, and DEQ. You then do the same operation. Any task looking for the current version of the resource will SHR ENQ and wait for the DEQ. The subsequent EXC ENQ cycle will wait for all the SHR DEQs. Any SHR ENQ done AFTER the waiting EXC ENQ will wait for the next EXC DEQ. There does need to be some flag to tell the EXC ENQ task not to do another EXC ENQ UNLESS there was at least one SHR ENQ waiting (to prevent useless looping). Otherwise use a STIMER loop (see below) to wait for at least once SHR ENQ. The flag that a SHR ENQ had been done can be a CS that is done by each SHR task when they come out of their wait.


The STIMER approach does not even really need an ECB -- you're just using it
as a flag.

In the STIMER loop, you just have a field that is tested and if not set you STIMER again. The test is via TM not WAIT but using PORT to set it is simplest (you can also CS or some other locking instruction).


At this moment I am still holding off. I don't have to solve this -- I can
instead simply not implement the feature I am thinking of that would require
this. At this moment none of the solutions are good enough to make the
feature viable, IMHO.

Thanks again,

Charles

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to