Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.3 4.3bsd-beta 6/6/85; site ucbvax.BERKELEY.EDU Path: utzoo!decvax!ittatc!dcdwest!sdcsvax!ucbvax!CSNET-RELAY.ARPA!DCATHEY%MCCORE%ti-eg.CSNET From: DCATHEY%MCCORE%ti-eg.CSNET@CSNET-RELAY.ARPA ("David L. Cathey, DEIS/DCS) Newsgroups: mod.computers.vax Subject: RE: Is it possible to do critical regions in VMS? Message-ID: <8608080837.AA00785@ucbvax.Berkeley.EDU> Date: Fri, 8-Aug-86 04:37:18 EDT Article-I.D.: ucbvax.8608080837.AA00785 Posted: Fri Aug 8 04:37:18 1986 Date-Received: Sat, 9-Aug-86 10:13:16 EDT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The ARPA Internet Lines: 35 Approved: info-vax@sri-kl.arpa Yes, it is possible to do critical regions in VMS. However, the more critical it is, the more privileged you need to be. Since you are wanting a critical region to guard against any action that the operating system might take against you, very privileged code is required (like Kernel mode at elevated IPL...). However by looking at your example, there may be a more elegant solution. Does the counter need to be in any particular form? How about ENQueueing a lock (probably a NULL lock) for the "increment" function and DEQueueing a lock for the "decrement" function. This will provide a mechanism to "increment" a variable that when the process goes away, or the image is run down, will automatically be "decremented". The $GETLKI system service (by specifing LKI$_LCKCOUNT (lock count) in the item list) will be able to tell you the "value" of the variable. If this variable is global across the entire system, you will need the SYSLCK privilege. If all the process are in the same job group, it will require no privileges. This does not really answer the question about critical regions, but allows the operating system to work for you so that the critical region isn't needed. If this doesn't help, then I think you will have to look at User-written System Services in order to control the incrementing and decrementing of a variable. The run-down vector in the USS can be used to decrement if needed so that you stay properly synchronized. David L. Cathey VAX System Support Texas Instruments Incorporated [Not only are these views not those of my employer, I had to tie him up so I could type this in...]