gluster-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gluster-devel] thread-safety and stack based design


From: Vikas Gorur
Subject: Re: [Gluster-devel] thread-safety and stack based design
Date: Thu, 15 Jan 2009 12:02:12 +0530

Corin,

I think you are referring to STACK_WIND/UNWIND when you say
"stack-based" design. The STACK_WIND/UNWIND macros in effect implement
a continuation-like mechanism in C.

The original reason we introduced this was to make file operations
asynchronous, in that we didn't have to wait for the reply to come
back from a server to issue another request.

Simulating our own stack over the normal C stack has given us many
other advantages. To take a concrete example, if the posix-locks
translator wishes to block a call, all it needs to do is save the
frame for the call and return (return in the C stack). When it needs
to unblock, it simply does a STACK_UNWIND on the saved frame.

Similarly the stack mechanism allows a great deal of control for
translators like unify and afr, where control flow branches, loops,
etc.

By having the stack mechanism we explicitly transfer control from one
translator to another, which gives us enormous flexibility.

Vikas
-- 
Engineer - Z Research
http://gluster.com/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]