[MUD-Dev] Re: atomic functions
Shawn Halpenny
malachai at iname.com
Thu May 7 10:10:56 CEST 1998
On Wed, May 06, 1998 at 09:34:27PM +0200, Felix A. Croes wrote:
> J C Lawrence <claw at under.engr.sgi.com> wrote:
>
> > Delving futher into the FAIL state semantics, if the caller is to also
> > FAIL because of the atomic function's failure, then the only gain from
> > the atomic function overhead is is that it may get earlier
> > notification of its impedending C&C failure via the atomic function
> > than it would have otherwise. This can be a notable performance
> > enhancement, but comes at significant cost in complexity of the
> > execution environment (which is now heirarchial as vs flat) and in
> > code. Additionally the benefit is only gained for callers of atomic
> > functions -- all other events suffer the penalty of the more complex
> > environment without any gain.
>
> In my design, events are only cancelled if they fail to commit their
> changes. Uncaught errors cause the event to terminate, but do not
> make it skip the commit phase.
I do not understand how that can work. A careless builder who forgets a
range check on some value could corrupt objects and the results are not
easily traceable. Perhaps I'm using a different definition of "error"?
Simplistic example:
function SetMaxDamage(n)
{
if (n < 0)
throw out_of_range
max_damage = n
}
SetMaxDamage(-1) is called in context of an event. The exception is what I
term an error: throw out all local data and forget this event. There is
no other clause to catch that exception and recovery is not possible, so it
must terminate the event. Letting it continue on and commit changes, let
alone schedule other events because it is allowed to commit, isn't
acceptable.
> > It is only when the calling function is intended to continue execution
> > despite the failure of the atomic function (at the C&C level), that
> > the execution pattern is different. However the functional gain here
> > I find (and found, I implemented somethign like this for a while)
> > to be illusionary. There just is no practical use for the feature.
>
> I contest this :) I claim that it is very useful indeed, and not
> at all illusionary. I frequently find that actions which have to
> be atomic -- for instance, moving a hungry dragon into a room,
> which changes both the environment of the dragon and the inventory
> of the room -- are part of a larger event, the actions of which
> I want to be executed precisely in that other without other
> events intervening.
Moving the hungry dragon into the room does not have to be an atomic
action. Removing the dragon from its current room is one event, putting it
into the next room is another. This is an attempt to minimize the number
of C&C collisions if you have a lot of these things going on (get rid of the
container-room ideology and this is even less a factor--something I'll
probably end up going with). The movement events will be executed in the
correct order, since the dragon removal event posts the dragon insertion
event only if it successfully C&C's.
--
Shawn Halpenny
I know that you believe you understand what you think I said, but,
I am not sure you realize that what you heard is not what I meant.
--
MUD-Dev: Advancing an unrealised future.
More information about the mud-dev-archive
mailing list