[Haskell-cafe] Re: About Atom
tomahawkins at gmail.com
Tue Jan 5 15:35:13 EST 2010
On Tue, Jan 5, 2010 at 7:05 PM, CK Kashyap <ck_kashyap at yahoo.com> wrote:
> Hi Tom,
> Happy new year :)
> I was wondering if I could use Atom for the purpose of an x86 operating system generator?
Ironically Atom was intended to eliminate the need for operating
systems -- at least on small embedded projects. But yes, maybe it
could be use develop an OS. (I've never written one, so I'm speaking
way out of my comfort zone.)
> I've explored Minix and wanted to get rid of all the noise introduced by C and focus on the logic.
> I am sorry, I have not really explored Atom sufficiently but I am just too eager to know :) ... I have installed Atom using cabal - I was just going through Example.hs ... One thing I noticed is that the logic to calculate gcd was not clear from the implementation (Haskell side that is) ... Perhaps I am not reading it with the right perspective - can you elaborate it?
> Also, why exactly did you name the whole thing Atom?
Because an Atom design is composed of a bunch of small atomic
operations. Take the GCD example:
-- A rule to modify A. If a > b then set a = a - b.
atom "a_minus_b" $ do
cond $ value a >. value b
a <== value a - value b
-- A rule to modify B. If b > a then set b = b - a.
atom "b_minus_a" $ do
cond $ value b >. value a
b <== value b - value a
These independent rules periodically wake up and check their guard
conditions (cond). If the guard condition is true, it performs the
action atomically, in isolation from everything else in the system.
In the case of the GCD example, the algorithm converges when a == b,
at which point both the "a_minus_b" and "b_minus_a" rules are
More information about the Haskell-Cafe