That´s almost the same case. CS if suffice for me. Thanks -----Mensagem original----- De: IBM Mainframe Assembler List <ASSEMBLER-LIST@LISTSERV.UGA.EDU> Em nome de Jonathan Scott Enviada em: domingo, 8 de dezembro de 2024 09:34 Para: ASSEMBLER-LIST@LISTSERV.UGA.EDU Assunto: Re: RES: SETLOCK OBTAIN CML/CMS
This is definitely not a case where one should be using system locks or ENQ as the primary serialization mechanism. About 30 years ago I wrote some product code using compare and swap techniques to allow tasks running in multiple address spaces to write entries (in storage managed as a cell pool) to a queue which is read in FIFO sequence by a single task. The general scheme is that the writing tasks add their entries to a LIFO stack using compare and swap and the reading task uses compare and swap to take away the whole stack at once, clearing the stack pointer (and avoiding the ABA problem). It runs through the stack taking each entry off and adding it to another private stack which has the effect of reversing the sequence back into FIFO queue order. It then processes queue entries one at a time until the queue is empty. An ECB is posted by the writing task whenever the LIFO stack becomes non-empty (using CS if the ECB is not already waiting). For waking up from another address space, this requires a cross-memory POST, which in the general case requires careful integrity checks to ensure that the ECB address remains valid. The ECB is unposted by the reading task before processing the stack, and the reading task waits on it when both the queue and the LIFO stack are empty. The timing needs care to ensure that the reading task will never end up waiting when there is something to process, but there is no problem if occasionally the reading task finds the stack empty because it had already processed it by the time the writing task posted the ECB. In my case, the implementation did not involve any ECSA storage. The writing process did a PC into the address space of the reading process and all of the storage was private in that address space. The ECB could be posted using a normal POST LINKAGE=SYSTEM, as the code was running with the reading address space as primary. Jonathan Scott, HLASM IBM Hursley, UK