[BIOSAL] Random values vs BASE + xyz vs enum for actions
George K. Thiruvathukal
gkt at cs.luc.edu
Wed Nov 5 22:46:01 CST 2014
Seb,
Let's keep the BASE approach in place for now. One of the things I like in
your project in general is that many of the decisions are based on best
practices that occur in great projects like Linux (and other free/open
source projects). Today we basically adopted a great practice from Minix.
I'm confident that what we did today is highly portable and would even work
with other compilers (ok, non-gcc compiler toolchains). That said, we can
still make it better!
One thing I will continue to investigate is whether we can reliably
generate GUIDs (at runtime) in a distributed fashion for user-defined
actions. One possibility is to use the initial node to assign the IDs
(almost like an RPC service). We could have a Thorium script for GUID
handling that acts as an RPC (remote procedure call). I'm thinking this
could be a great example for how to use Thorium as well.
Ok, I had better call it quits for the evening. It was great working with
you today. Thanks for being so receptive to some of my crazy ideas.
George
George K. Thiruvathukal, PhD
*Professor of Computer Science*, Loyola University Chicago
*Director*, Center for Textual Studies and Digital Humanities
*Guest Faculty*, Argonne National Laboratory, Math and Computer Science
Division
Editor in Chief, Computing in Science and Engineering
<http://www.computer.org/portal/web/computingnow/cise> (IEEE CS/AIP)
(w) gkt.tv (v) 773.829.4872
On Wed, Nov 5, 2014 at 10:31 PM, Boisvert, Sebastien <boisvert at anl.gov>
wrote:
> > From: George K. Thiruvathukal [gkt at cs.luc.edu]
> > Sent: Wednesday, November 05, 2014 9:16 PM
> > To: Boisvert, Sebastien
> > Cc: biosal at lists.cels.anl.gov
> > Subject: Re: Random values vs BASE + xyz vs enum for actions
> >
> >
> >
> >
> > I am potentially ok with this. One thing to consider, however, is that
> C++ (should we ever go in this direction) enum and int don't play nicely
> together. Someone might even "wrap" Thorium computations in C++ at some
> point, which means we will want the code
> > to pass through the C compiler without errors. I'm not sure whether
> this was intentional, but you also don't have an enum type name in your
> example.
>
> Yes, it is intentional so that there not an type associated to the listed
> values. Otherwise, one would need
> to put every actions in one single "enum action_type { ACTION_1, ACTION_2,
> ..., ACTION_N};".
>
>
> >
> >
> > So I would be careful with enum, because in C, they convert implicitly
> to/from int. That said, I do like being able to get the auto-increment
> functionality out of the box. I can be talked into it,
>
> The decision is yours. I like the BASE thing.
>
> > but were I to guess, Andy Tanenbaum did what we did today in
> > Minix for good reasons (possibly still living in his head!)
> >
> >
> > Best,
> > George
> >
> >
> >
> >
> > George K. Thiruvathukal, PhD
> >
> > Professor of Computer Science, Loyola University Chicago
> >
> > Director, Center for Textual Studies and Digital Humanities
> > Guest Faculty, Argonne National Laboratory, Math and Computer Science
> Division
> > Editor in Chief, Computing in
> > Science and Engineering (IEEE CS/AIP)
> >
> > (w) gkt.tv (v)
> > 773.829.4872
> >
> >
> >
> >
> >
> >
> >
> > On Wed, Nov 5, 2014 at 9:08 PM, Boisvert, Sebastien
> > <boisvert at anl.gov> wrote:
> >
> > Hi George,
> >
> > The new action definitions that use a base and an offset is great [1].
> >
> > #define ACTOR_ACTION_BASE -1000
> >
> > #define ACTION_START (ACTOR_ACTION_BASE + 0)
> > #define ACTION_START_REPLY (ACTOR_ACTION_BASE + 1)
> > #define ACTION_STOP (ACTOR_ACTION_BASE + 2)
> > #define ACTION_STOP_REPLY (ACTOR_ACTION_BASE + 3)
> > #define ACTION_ASK_TO_STOP (ACTOR_ACTION_BASE + 4)
> > #define ACTION_ASK_TO_STOP_REPLY (ACTOR_ACTION_BASE + 5)
> >
> >
> > I was told by a friend (from industry) of mine that the following would
> be better:
> >
> > enum {
> > ACTOR_ACTION_BASE = -1000,
> > ACTION_START,
> > ACTION_START_REPLY,
> > ACTION_STOP,
> > ACTION_STOP_REPLY,
> > ACTION_ASK_TO_STOP,
> > ACTION_ASK_TO_STOP_REPLY
> > };
> >
> >
> > What do you think ?
> >
> >
> > ---
> > [1]
> >
> https://github.com/gkthiruvathukal/biosal/commit/8e0448d4c98babd9e471d134745791165fb08536
> >
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cels.anl.gov/pipermail/biosal/attachments/20141105/a4a6e286/attachment.html>
More information about the BIOSAL
mailing list