multiple processes, one model

Chris Muller chris at funkyobjects.org
Wed Mar 29 04:53:52 UTC 2006


> My "objects" are a plain WeakValueDictionary ... do I need to switch
 > something on?
 
I changed it back go MaWeakValueDictionary in this latest release. 
It's just a hack to compensate for poor hashing, but it works.

> What if another session modifies something while a commit is in
> progress? Could this lead to problems? I guarded the commitAndBegin
> in a mutex, though.
 
I'm afraid so.  If the model changes while its being serialized the
serialized graph emitted from the serializer will not be a
time-coherent representation of the model.  It could actually have an
invalid oid reference in the commit-package and Magma will signal a
commit error.

Regrettably, I don't think a mutex only around commitAndBegin will
guarantee safety under the shared-model approach.  You said you were
single user, so it should be fine.  You could even get lucky with
multiple users if no one changed the same parts of the model.

But without lower-level synchronization built into the language, this
is living dangerously.  Wrapping the commit in a #valueUninterruptably
or #valueUnpreemptively might actually help, crazy stuff though.

When each Seaside session has its own copy of the model, multiple
processes are not an issue, and Magma sees them as independent clients
so the concurrency detection works too.  It is the only approach with
potential to scale to multi-machines / processes as described on the
Magma Seaside page.

 - Chris



More information about the Magma mailing list