* Require help with msync() functionality in OpenVMS Cluster env. @ 1999-12-06 5:00 Simon Maslin 1999-12-07 5:00 ` Jan Vorbrueggen 1999-12-18 5:00 ` Roger Tucker 0 siblings, 2 replies; 10+ messages in thread From: Simon Maslin @ 1999-12-06 5:00 UTC (permalink / raw) I am analysing applications that use shared memory (global sections) mapped to a disk file to allow access to information on one machine to a similar application on another machine. Both are running within a OpenVMS Alpha cluster. Using msync() to synchronise disk & memory. How exactly does the msync() call actually synchronise the cluster-wide applications that are mapped to the disk file ? More importantly, how and when are the writes/reads on each machine actually performed and is there anything to look-out for ? Thanks for any assistance, Simon Maslin. Please reply to:- Simon.Maslin@dlr.de ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Require help with msync() functionality in OpenVMS Cluster env. 1999-12-06 5:00 Require help with msync() functionality in OpenVMS Cluster env Simon Maslin @ 1999-12-07 5:00 ` Jan Vorbrueggen 1999-12-07 5:00 ` Simon Maslin 1999-12-18 5:00 ` Roger Tucker 1 sibling, 1 reply; 10+ messages in thread From: Jan Vorbrueggen @ 1999-12-07 5:00 UTC (permalink / raw) "Simon Maslin" <Simon.Maslin@dlr.de> writes: > How exactly does the msync() call actually synchronise the cluster-wide > applications that are mapped to the disk file ? AFAIK, you can't do that across cluster members. Presumably, msync() writes all modified pages to the section file, and maps to the $UPDSEC system call. However, there is no way, short of unmapping and remapping the section file, that the other node can invalidate its local copy of those modified pages so that they will be read from disk the next time they are accessed. Describe in more detail the problem you want to solve, if you want help. Jan ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Require help with msync() functionality in OpenVMS Cluster env. 1999-12-07 5:00 ` Jan Vorbrueggen @ 1999-12-07 5:00 ` Simon Maslin 0 siblings, 0 replies; 10+ messages in thread From: Simon Maslin @ 1999-12-07 5:00 UTC (permalink / raw) >AFAIK, you can't do that across cluster members. Presumably, msync() writes >all modified pages to the section file, and maps to the $UPDSEC system call. >However, there is no way, short of unmapping and remapping the section file, >that the other node can invalidate its local copy of those modified pages so >that they will be read from disk the next time they are accessed. > >Describe in more detail the problem you want to solve, if you want help. > > Jan Jan, Thanks for taking an interest. I am analysing software written by someone else. According to my understanding they are using msync() to write the shared memory (global section) data to disk and then to INVALIDATE it so that the next read by those mapped to the area causes a read from the disk into memory, (does it?) The question is whether this function works correctly on a Open VMS cluster and if so how are the writes/reads on each machine synchronised. For example does read I/O on the second machine hold-up write I/O on the first machine ? I assume that msync() has similar features to $UPDSEC although the parameter options are far fewer wih msync(). Are there situations/problems to be aware of using this function ? Thanks, Simon. ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Require help with msync() functionality in OpenVMS Cluster env. 1999-12-06 5:00 Require help with msync() functionality in OpenVMS Cluster env Simon Maslin 1999-12-07 5:00 ` Jan Vorbrueggen @ 1999-12-18 5:00 ` Roger Tucker 1999-12-21 5:00 ` Hoff Hoffman 1 sibling, 1 reply; 10+ messages in thread From: Roger Tucker @ 1999-12-18 5:00 UTC (permalink / raw) This may not answer all of your questions but maybe it will be a start. msync() calls one of the sys$updsec() system service routines (SYS$UPDSEC(), SYS$UPDSECW(), $UPDSEC_64, or SYS$UPDSEC_64W) depending on the flags argument being set to MS_ASYNC and depending on if the section is a 32 bit or 64 bit section. You can read about theses services from the system service reference manual. But they flush any modified pages out to the disk file. If you also specify MS_INVALIDATE msync() uses a VMS LOCK and lock value block to notify other nodes that the section is invalid. This is done by taking out an exclusive lock, incrementing a sequence number in the lock value block, and converting the block back to NL mode. The other processes that have the global section mapped wait on a blocking-ast. If they don't have AST's disabled they will invalidate their copy of the global section and fault it from the disk the next time they read it. Two locks are used in real-life (a door bell lock and sequence number lock) to avoid a problem of a process being hung or having AST's off. The writes/reads on each machine are not synchronised. That is up to your application, but MS_INVALIDATE will force the next read on any node to get the new data from disk. <For example does read I/O on the second machine hold-up write I/O on the first machine ?> NO. That is up to your application. I hope this is enough information to help. Thanks, Roger Tucker - MCIWorldCom ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Require help with msync() functionality in OpenVMS Cluster env. 1999-12-18 5:00 ` Roger Tucker @ 1999-12-21 5:00 ` Hoff Hoffman 1999-12-23 5:00 ` Roger Tucker 0 siblings, 1 reply; 10+ messages in thread From: Hoff Hoffman @ 1999-12-21 5:00 UTC (permalink / raw) In article <385A6F18.277AE9D2@mci.com>, Roger Tucker <roger.tucker@mci.com> writes: :This may not answer all of your questions but maybe it will be a :start. msync() calls one of the sys$updsec() system service :routines (SYS$UPDSEC(), SYS$UPDSECW(), $UPDSEC_64, or SYS$UPDSEC_64W) :depending on the flags argument being set to MS_ASYNC... :If you also specify MS_INVALIDATE msync() uses a VMS LOCK and :lock value block to notify other nodes that the section is invalid.... I just looked at the C RTL code for msync and don't see any locking activity... I didn't follow the sys$updsec* code down deep into the executive, but one of the other locals followed it as far as the XQP... :The writes/reads on each machine are not synchronised. That :is up to your application, but MS_INVALIDATE will force the next :read on any node to get the new data from disk. <For example :does read I/O on the second machine hold-up write I/O on the first :machine ?> NO. That is up to your application. .. I've been chatting with the C RTL engineer and with one of the local OpenVMS memory management gurus. I'm completely baffled about the abovementioned solution -- neither the C RTL nor the global section system services handle access to the shared memory from multiple nodes within a cluster. Across accessors on the same node, yes... My recollection is that shared memory is node-local. Further, the backing storage accesses "behind" shared memory section updates are not coordinated across cluster nodes, hence updates can be lost... Unless there's something really nifty happening deep inside the XQP or the I/O subsystem here that none of us know about or remember, I don't see how this approach would be reliable... If you handle your own intra-cluster communications, you could work out a scheme where the information was distributed to the shared memory of other cluster members. (Or of course -- if this was an OpenVMS Galaxy configuration -- you could use galactic memory...) If the above discussion intends to describe the creation of your own intra-cluster protocol (based on the lock manager) to coordinate the updates, then that might be feasible... (I'd want to watch for the potential of some interesting timing issues on the completions of the updates to the backing section. And I'd take a serious look at just passing over the information, via an application network protocol connection or via RTR or otherwise -- the "fun" part comes in because there isn't really any direct control over when OpenVMS decides to write pages of the memory information out to the backing storage, and this I/O can occur in the absence of an $updsec call.) We do need to update the msync documentation as well as the various shared memory documentation -- I've passed along that report to the technical writers for inclusion into the next release of the OpenVMS programming concepts and system service reference manuals... --------------------------- pure personal opinion --------------------------- Hoff (Stephen) Hoffman OpenVMS Engineering hoffman#xdelta.zko.dec.com ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Require help with msync() functionality in OpenVMS Cluster env. 1999-12-21 5:00 ` Hoff Hoffman @ 1999-12-23 5:00 ` Roger Tucker 1999-12-23 5:00 ` Jan Vorbrueggen 0 siblings, 1 reply; 10+ messages in thread From: Roger Tucker @ 1999-12-23 5:00 UTC (permalink / raw) I'm not sure what source code Stephen Hoffman is looking at, but my source code for msync() on the VMS 7.1 source distribution performs locking. I'm looking at the file [v71.acrtl.lis]mmap.lis. I cannot post the source code, but msync() calls force_invalidate() if (flags & MS_INVALIDATE). force_invalidate() increments a sequence number in the lock value block of a lock, remaps the section, then calls ring_bell(). ring_bell() notifies other processes by taking out an excluseive lock, then reverts it back to concurrent read. All other processes that have the current region mapped are have a blocking ast pending. I haven't tested this across the cluster but it looks like it would work. It's still up to the application to only have one writer at a time, but the updates should be readable by any other process that has the same section mapped on the next access. If someone has an exmple they can post it, or if I get time I'll write one. ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Require help with msync() functionality in OpenVMS Cluster env. 1999-12-23 5:00 ` Roger Tucker @ 1999-12-23 5:00 ` Jan Vorbrueggen 2000-01-13 5:00 ` martin.schmidt 0 siblings, 1 reply; 10+ messages in thread From: Jan Vorbrueggen @ 1999-12-23 5:00 UTC (permalink / raw) Roger Tucker <roger.tucker@mci.com> writes: > I haven't tested this across the cluster but it looks like it would work. That's what I think as well. The problems I see are that I'm not sure that $UPDSECW _guarantees_ the data actually is on disk when it returns - I'm pretty sure there isn't one when you use $DELVA on a global section, e.g., via image rundown - and with the re-mapping of the section by its other users: historically, VMS has had a number of problems with global sections being unmapped and mapped in rapid succession. Jan ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Require help with msync() functionality in OpenVMS Cluster env. 1999-12-23 5:00 ` Jan Vorbrueggen @ 2000-01-13 5:00 ` martin.schmidt 2000-01-14 5:00 ` Jan Vorbrueggen 2000-01-21 5:00 ` Hoff Hoffman 0 siblings, 2 replies; 10+ messages in thread From: martin.schmidt @ 2000-01-13 5:00 UTC (permalink / raw) In article <y44sdarkwm.fsf@mailhost.neuroinformatik.ruhr-uni-bochum.de>, Jan Vorbrueggen <jan@mailhost.neuroinformatik.ruhr-uni-bochum.de> wrote: > Roger Tucker <roger.tucker@mci.com> writes: > > > I haven't tested this across the cluster but it looks like it would work. > > That's what I think as well. The problems I see are that I'm not sure that > $UPDSECW _guarantees_ the data actually is on disk when it returns - I'm > pretty sure there isn't one when you use $DELVA on a global section, e.g., > via image rundown - and with the re-mapping of the section by its other > users: historically, VMS has had a number of problems with global sections > being unmapped and mapped in rapid succession. > > Jan Hi there, I've tested it on the cluster and it works (I'm the one who works at the moment on the software mentioned in the first posting). The mapping is done by mmap() on a file created with creat(). msync() is called with MS_INVALIDATE | MS_SYNC. But under some strange circumstances it seems that updates aren't seen by a reader on the other node of the cluster (as you said: it may be not 'guaranteed'). In addition we have an performance problem if the changes on the mapped file are distributed randomly: VMS seem to make no difference between the Writer (who called msync()) (or any other process on the same node which has mapped the file) and the Reader on an other node. So if the former Writer reads its own data a file access is done (but of course it is not necessary). If I'm not wrong, in a one node system msync() is not necessary at all, to see changes from one process made by an other to the shared memeory (mapped file) ? Am I ? Has anyone any ideas/hints on performance relevant arguments of the creat()-function or anything else ? And is there a chance that the data is on disk after the msync() call has returned or a way to 'guarantee' this. Thanks in advance, Martin Schmidt Sent via Deja.com http://www.deja.com/ Before you buy. ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Require help with msync() functionality in OpenVMS Cluster env. 2000-01-13 5:00 ` martin.schmidt @ 2000-01-14 5:00 ` Jan Vorbrueggen 2000-01-21 5:00 ` Hoff Hoffman 1 sibling, 0 replies; 10+ messages in thread From: Jan Vorbrueggen @ 2000-01-14 5:00 UTC (permalink / raw) martin.schmidt@cam-comp.de writes: > If I'm not wrong, in a one node system msync() is not necessary at all, > to see changes from one process made by an other to the shared memeory > (mapped file) ? Am I ? You are correct. Remember you have to make sure that you actually read the shared memory section, i.e., that the compiler doesn't optimize the memory access away (for instance, declare variables volatile or some such). > And is there a chance that the data is on disk after the msync() call > has returned or a way to 'guarantee' this. I'd say no way. Jan ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Require help with msync() functionality in OpenVMS Cluster env. 2000-01-13 5:00 ` martin.schmidt 2000-01-14 5:00 ` Jan Vorbrueggen @ 2000-01-21 5:00 ` Hoff Hoffman 1 sibling, 0 replies; 10+ messages in thread From: Hoff Hoffman @ 2000-01-21 5:00 UTC (permalink / raw) Follow-ups set to comp.os.vms. In article <85l10d$7bu$1@nnrp1.deja.com>, martin.schmidt@cam-comp.de writes: :But under some strange circumstances it seems that updates aren't seen :by a reader on the other node of the cluster (as you said: it may be :not 'guaranteed'). I'd assume it was unreliable... I'd also assume that the harder you push it (eg: constrained memory, heavy system load), the more problems and the more data inconsistencies you will see across the cluster members -- shared memory is node-specific, and is not cluster-aware. :If I'm not wrong, in a one node system msync() is not necessary at all, :to see changes from one process made by an other to the shared memeory :(mapped file) ? Am I ? You will want to look at the discussion over in Ask The Wizard topic (2681), particularly if this code will ever operate on an SMP system. :Has anyone any ideas/hints on performance relevant arguments of the :creat()-function or anything else ? :And is there a chance that the data is on disk after the msync() call :has returned or a way to 'guarantee' this. On the same node, you will get consistent behaviour, assuming you have the memory barriers (qv: 2681) working... The problem, as I have been saying for a while now, is that there is no synchronization of the contents of the global section and the backing storage across nodes within an OpenVMS Cluster -- each node has its own page tables, and can manipulate and update these and the associated backing storage in a fashion that is completely unsynchronized with the other cluster member nodes. Specific suggestions: o use the system services. (The C stuff does works fine, but it maps a UNIX memory managment model onto the OpenVMS model, and this can potentially get confusing.) The system services also make it rather more clear what is going on here, and what options are available. o use one section per node, and use some other means of skulking the data over to the other node. (eg: middleware, lock manager value blocks, IP or DECnet network transport, RTR, etc...) o Use RMS files and RMS Global Buffers. This gets you completely out of the buffer management and backing storage management, and this also operates across all nodes within an OpenVMS Cluster. You _might_ get away with one global section writer and multiple read-only accessors (readers on other cluster members), but I'm not certain that this will be entirely reliable... (ie: You might just see stale data, rather than corrupted data.) Far and away the easiest approach is RMS... Otherwise, you get to design, implement, and debug what RMS (or RTR) provides for you... --------------------------- pure personal opinion --------------------------- Hoff (Stephen) Hoffman OpenVMS Engineering hoffman#xdelta.zko.dec.com ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2000-01-21 5:00 UTC | newest] Thread overview: 10+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 1999-12-06 5:00 Require help with msync() functionality in OpenVMS Cluster env Simon Maslin 1999-12-07 5:00 ` Jan Vorbrueggen 1999-12-07 5:00 ` Simon Maslin 1999-12-18 5:00 ` Roger Tucker 1999-12-21 5:00 ` Hoff Hoffman 1999-12-23 5:00 ` Roger Tucker 1999-12-23 5:00 ` Jan Vorbrueggen 2000-01-13 5:00 ` martin.schmidt 2000-01-14 5:00 ` Jan Vorbrueggen 2000-01-21 5:00 ` Hoff Hoffman
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox