[#365153] synchronize a "mocked" clock in a distributed system — Chuck Remes <cremes.devlist@...>

I've been banging on a problem for a few days now and don't feel any closer to solving it. I'm hoping some of the big brains on the ruby ML can shed some light. Following are a few paragraphs with a brief system overview before I state the problem. I apologize in advance for this question being only tangentially related to Ruby the language. :)

13 messages 2010/07/01
[#365164] Re: [Q] synchronize a "mocked" clock in a distributed system — Tony Arcieri <tony.arcieri@...> 2010/07/01

On Thu, Jul 1, 2010 at 3:10 PM, Chuck Remes <cremes.devlist@mac.com> wrote:

[#365214] RubyGoLightly Progress Report — Eleanor McHugh <eleanor@...>

I seem to have been missing in action for the best part of six months so =

14 messages 2010/07/02

[#365320] Why am I not getting the expected output? — Abder-rahman Ali <abder.rahman.ali@...>

I have the following code: http://pastie.org/1032525, but always getting

11 messages 2010/07/06

[#365351] best way to make .rb into an executable for linux? — David Ainley <wrinkliez@...>

I have a pretty basic .rb script that I would like to turn into an

11 messages 2010/07/06

[#365374] Hashes don't allow preceding commas by design? — Iain Barnett <iainspeed@...>

This is the output from irb that shows ruby 1.9.1 doesn't like hash =

12 messages 2010/07/07

[#365413] What is meant by those lines of code in this script? — Abder-rahman Ali <abder.rahman.ali@...>

I came across the following script from "Why's poignant guide to Ruby".

9 messages 2010/07/07

[#365504] FIRST PROGRAMMING PROBLEM Array — Francisco Martinez <calabazag@...>

Hi...I'm trying to solve a very simple exercise but this is one of my

12 messages 2010/07/09

[#365513] what about allowing to specify, which end belongs to which start? — Jan Lelis <prog@...>

Hi Ruby mailing list,

24 messages 2010/07/09
[#365541] Re: what about allowing to specify, which end belongs to which start? — Caleb Clausen <vikkous@...> 2010/07/10

On 7/9/10, Jan Lelis <prog@janlelis.de> wrote:

[#365548] Re: what about allowing to specify, which end belongs to which start? — Robert Klemme <shortcutter@...> 2010/07/11

On 10.07.2010 17:54, Caleb Clausen wrote:

[#365551] Re: what about allowing to specify, which end belongs to which start? — Caleb Clausen <vikkous@...> 2010/07/11

On 7/11/10, Robert Klemme <shortcutter@googlemail.com> wrote:

[#365555] Re: what about allowing to specify, which end belongs to which start? — Robert Klemme <shortcutter@...> 2010/07/11

On 11.07.2010 13:32, Caleb Clausen wrote:

[#365574] Re: what about allowing to specify, which end belongs to which start? — Caleb Clausen <vikkous@...> 2010/07/11

On 7/11/10, Robert Klemme <shortcutter@googlemail.com> wrote:

[#365570] How to pass a hash as a param to a method called through eval? — Alex Stahl <astahl@...5.com>

Hi Folks - I've got a data-driven app I'm building, and I'd like to be

14 messages 2010/07/11

[#365615] Try Ruby is back online. — andrew mcelroy <sophrinix@...>

Greetings,

10 messages 2010/07/12

[#365721] Ruby garabage collector — Abder-Rahman Ali <abder.rahman.ali@...>

In the "Why's poignant guide to Ruby" book, it states the following:

22 messages 2010/07/13

[#365752] What does this do? — Abder-Rahman Ali <abder.rahman.ali@...>

I have this portion of code from "Why's poignant guide to Ruby" book.

12 messages 2010/07/13

[#365828] click a javascript dialog window in Firefox — Mario Ruiz <tcblues@...>

Hi,

9 messages 2010/07/14

[#365844] Return nothing when looking outside the bounds of 2D array? — Shawn W_ <shawnw@...>

I have a 2D Array. I have written a method

22 messages 2010/07/14
[#365850] Re: Return nothing when looking outside the bounds of 2D array? — w_a_x_man <w_a_x_man@...> 2010/07/14

On Jul 14, 3:56=A0pm, Shawn W_ <sha...@internode.on.net> wrote:

[#365853] Re: Return nothing when looking outside the bounds of 2D array? — Shawn W_ <shawnw@...> 2010/07/15

Thx. Don't quite understand that code. I tried plugging in some nils but

[#365869] Re: Return nothing when looking outside the bounds of 2D array? — Shawn W_ <shawnw@...> 2010/07/15

A better way to describe it.

[#365871] Re: Return nothing when looking outside the bounds of 2D array? — Dave Howell <groups.2009a@...> 2010/07/15

I was going to suggest using the 'case' statement instead of all those =

[#365938] Re: Return nothing when looking outside the bounds of 2D array? — Shawn W_ <shawnw@...> 2010/07/16

Okay, just found out that...

[#365944] Re: Return nothing when looking outside the bounds of 2D array? — Martin DeMello <martindemello@...> 2010/07/16

On Fri, Jul 16, 2010 at 11:11 AM, Shawn W_ <shawnw@internode.on.net> wrote:

[#365847] Ruby best practice for "always on" app/service? — yermej <yermej@...>

I'm building an app that will essentially be a web service client. It

10 messages 2010/07/14

[#365988] client-side Ruby on iPad/iPhone? — Jeff Pritchard <jp@...>

I've seen jRuby and IronRuby, and really want to use them since i really

12 messages 2010/07/17

[#366015] ruby abstraction — "James O'Brien" <jeob32@...>

Hi,

17 messages 2010/07/18

[#366053] LoadError: no such file to load -- tk — Rich Leblanc <rl001@...>

I'm trying to install Ruby on a 64 bit Windows 7 machine following this

46 messages 2010/07/19
[#366063] Re: LoadError: no such file to load -- tk — Roger Pack <rogerpack2005@...> 2010/07/19

[#366082] Re: LoadError: no such file to load -- tk — Rich Leblanc <rl001@...> 2010/07/19

Roger Pack wrote:

[#366085] Re: LoadError: no such file to load -- tk — Eric Christopherson <echristopherson@...> 2010/07/19

On Mon, Jul 19, 2010 at 3:26 PM, Rich Leblanc <rl001@pacbell.net> wrote:

[#366086] Re: LoadError: no such file to load -- tk — Rich Leblanc <rl001@...> 2010/07/20

Eric Christopherson wrote:

[#366135] Re: LoadError: no such file to load -- tk — Roger Pack <rogerpack2005@...> 2010/07/20

[#366140] Re: LoadError: no such file to load -- tk — Rich Leblanc <rl001@...> 2010/07/20

Roger Pack wrote:

[#366147] Re: LoadError: no such file to load -- tk — Roger Pack <rogerpack2005@...> 2010/07/20

Rich Leblanc wrote:

[#366153] Re: LoadError: no such file to load -- tk — Rich Leblanc <rl001@...> 2010/07/20

Roger Pack wrote:

[#366179] Re: LoadError: no such file to load -- tk — Rich Leblanc <rl001@...> 2010/07/21

Rich Leblanc wrote:

[#366115] Count occurences of vars in array — Vitaliy Yanchuk <fuksito@...>

Hello, everyone.

18 messages 2010/07/20
[#366116] Re: Count occurences of vars in array — Jean-Julien Fleck <jeanjulien.fleck@...> 2010/07/20

Hello,

[#366120] Re: Count occurences of vars in array — Vitaliy Yanchuk <fuksito@...> 2010/07/20

Jean-Julien Fleck, thanks.

[#366152] Can't get ruby 1.9 to work after install on OSX — Musdev Musdev <devrubygem@...>

Hello

12 messages 2010/07/20

[#366196] how to make "gem install rmagick" work? — Jian Lin <blueskybreeze@...>

I wanted to install rmagick on Win7 but it can't install:

10 messages 2010/07/21

[#366226] Text to Binary — Umm Whyshouldisay <kipthemudkip@...>

Hi! I'm new to the forums. I'm also a bit new to Ruby. I already know

13 messages 2010/07/21

[#366254] finding last line in a file — Ted Flethuseo <flethuseo@...>

Hi everyone,

15 messages 2010/07/22
[#366256] Re: finding last line in a file — Urabe Shyouhei <shyouhei@...> 2010/07/22

Take a look at the doc for File.readline.

[#366257] Re: finding last line in a file — Urabe Shyouhei <shyouhei@...> 2010/07/22

(2010/07/22 14:08), Urabe Shyouhei wrote:

[#366319] Typical Ruby (non-rails) project structure. — Carl Jenkins <carljenkins@...>

What is/are the best-practice(s) for a Ruby project structure?

18 messages 2010/07/22

[#366418] Ruby books designed especially for beginngers — Kaye Ng <sbstn26@...>

Hey experts, i need your advice.

12 messages 2010/07/24

[#366611] Which Ruby is in use? — Hassan Schroeder <hassan.schroeder@...>

Is there a way to tell from within a program which executable is being

23 messages 2010/07/27
[#366614] Re: Which Ruby is in use? — "Joseph E. Savard" <joseph.savard@...> 2010/07/27

[#366617] Re: Which Ruby is in use? — Hassan Schroeder <hassan.schroeder@...> 2010/07/27

On Tue, Jul 27, 2010 at 2:20 PM, Joseph E. Savard

[#366620] Re: Which Ruby is in use? — Joel VanderWerf <joelvanderwerf@...> 2010/07/27

Hassan Schroeder wrote:

[#366622] Re: Which Ruby is in use? — Hassan Schroeder <hassan.schroeder@...> 2010/07/27

On Tue, Jul 27, 2010 at 3:10 PM, Joel VanderWerf

[#366624] Re: Which Ruby is in use? — Joel VanderWerf <joelvanderwerf@...> 2010/07/27

Hassan Schroeder wrote:

[#366625] Re: Which Ruby is in use? — Hassan Schroeder <hassan.schroeder@...> 2010/07/27

On Tue, Jul 27, 2010 at 3:52 PM, Joel VanderWerf

[#366626] Re: Which Ruby is in use? — Joel VanderWerf <joelvanderwerf@...> 2010/07/27

Hassan Schroeder wrote:

[#366629] tool to compare DB schema against DDL file — Fabian Marin <fmg134s@...>

First of all any feedback from you guys will be of tremendous help.

14 messages 2010/07/28

[#366727] my script just read one line? — Junhui Liao <junhui.liao@...>

Dear all,

19 messages 2010/07/29
[#366729] Re: my script just read one line? — Jes俍 Gabriel y Gal疣 <jgabrielygalan@...> 2010/07/29

On Thu, Jul 29, 2010 at 1:43 PM, Junhui Liao <junhui.liao@uclouvain.be> wro=

[#366766] Re: my script just read one line? — Junhui Liao <junhui.liao@...> 2010/07/29

Dear Jes炭s Gabriel y Gal叩n and all,

[#366774] Re: my script just read one line? — Jes俍 Gabriel y Gal疣 <jgabrielygalan@...> 2010/07/30

On Fri, Jul 30, 2010 at 1:58 AM, Junhui Liao <junhui.liao@uclouvain.be> wro=

[#366784] Re: my script just read one line? — Junhui Liao <junhui.liao@...> 2010/07/30

[#366786] Re: my script just read one line? — Jes俍 Gabriel y Gal疣 <jgabrielygalan@...> 2010/07/30

On Fri, Jul 30, 2010 at 2:18 PM, Junhui Liao <junhui.liao@uclouvain.be> wro=

[#366792] Re: my script just read one line? — Junhui Liao <junhui.liao@...> 2010/07/30

Dear Jes炭s Gabriel y Gal叩n,

[#366755] .any?{} Behavior — John Sikora <john.sikora@...>

I find the following behavior interesting (so interesting that I

28 messages 2010/07/29
[#366797] Re: [].all?{} and [].any?{} Behavior — Rick DeNatale <rick.denatale@...> 2010/07/30

On Thu, Jul 29, 2010 at 5:27 PM, John Sikora <john.sikora@xtera.com> wrote:

[#366809] Re: [].all?{} and [].any?{} Behavior — Josh Cheek <josh.cheek@...> 2010/07/30

On Fri, Jul 30, 2010 at 10:49 AM, Rick DeNatale <rick.denatale@gmail.com>wrote:

[#366837] Mocking a method with a block — Fernando Guillen <fguillen.mail@...>

Hi people,

12 messages 2010/07/31

[OT] RubyGoLightly Progress Report

From: Eleanor McHugh <eleanor@...>
Date: 2010-07-02 22:57:13 UTC
List: ruby-talk #365214
I seem to have been missing in action for the best part of six months so =
I thought it was about time I put together a progress report and pimped =
the vapourware in hopes of finding some likeminded =
miscreants/dilettantes to turn it into something more substantial.

There're probably only a handful of people on here who'll be interested =
in what follows so I've marked it OT for those of you interested =
exclusively in Ruby. Feel free to press delete, I won't be offended :)


=3D=3D BACKGROUND =3D=3D

For those of you without long memories, a quick recap. At the tail-end =
of last year Google released their Go language (http://www.golang.org) =
onto an unsuspecting world. The brainchild of Rob Pike and Ken Thompson, =
Go's sort of a reworking of Limbo from Plan 9/Inferno with baked-in =
concurrency and an inside-out approach to object orientation.

As those of you who've had the dubious pleasure of either sharing bar =
space with me or sitting through one of my conference sessions on Ruby & =
Unix, for all that Ruby's my language of choice I still spend a fair =
amount of time grubbing around in the C world. Love them or loathe them, =
there are times when we all need systems-level languages to efficiently =
solve certain kinds of problems.

The longterm goal of RubyGoLightly is to make Ruby a first-class citizen =
in that sense, moving systems coding firmly and permanently into our =
high-level world. I know it can be done as Ruby's pretty much as =
flexible as Lisp and Symbolics proved that an OS could be written in =
Lisp with minimal dependence on assembly language. So the aspiration =
isn't so lousy even if I'm far from certain that I'm personally capable =
of achieving it.

There is however one major roadblock to turning Ruby into a systems =
language: existing runtimes just aren't written that way. The closest we =
have at present is JRuby, and even there if you want complete control =
you still have to step outside of the Ruby mindset and hack Java, JVM =
bytecode or probably even write JNI extensions in C.

Then there's the question of an optimal Ruby runtime. There's a lot of =
implicit concurrency in the average Ruby program which to the best of my =
knowledge isn't being addressed by any of the existing implementations. =
We live in a multicore world where it's only natural that collection =
enumerators etc. should be exploiting those cores for cheap scalability. =
Admittedly writing concurrent systems in C can be a right pain in the =
arse, and even in Java there are subtleties arising from the =
architecture of the JVM so I'm not levelling criticism at anyone. It's =
just a fair observation that if I have four processor cores and a list =
with 10K entries that map/reduce algorithms should use all four cores if =
at all possible and return their results in approximately 1/3rd the time =
of a naive sequential implementation.

Given that Intel are playing with 80+ core processors in the lab - and =
that modern graphics cores have even more available horsepower via =
OpenCL - there's clearly an opportunity worth investigating.

Go does concurrency pretty well, especially considering that the runtime =
is still in its infancy and will probably undergo considerable =
optimisation in the future. It's basically an implementation of Hoare's =
CSP so all the tricks that can be used in Occam etc. for clean =
concurrency can be used in Go, and whilst it doesn't yet support OpenCL =
that's just a matter of time and a sufficiently nasty itch being worth =
scratching.

Another desirable trait for a Ruby runtime is decent browser =
integration. I get really annoyed having to write heavyweight =
client-side web code in JavaScript as to me it's an ugly language. I've =
probably never recovered from my painful experiences with NewtonScript =
as I find the entire Self language family unbearable, and the same goes =
for the slot-based GTK GUI stuff (sorry webGTK). Go has support for =
Google's Native Client so is ideal for injecting native code into web =
content, including a Ruby runtime were it to exist. I love that idea. =
Write your whole web app in Ruby, with identical abstractions.

The same thing could be achieved using a Ruby runtime written in =
JavaScript (such as HotRuby) but to date that approach has stalled. =
Basically writing any significant runtime platform is a significant cost =
and taking anything beyond the complexity of a simple bytecode =
interpreter means months of full-time hacking and serious cogitation.

The final thing in Go's favour is that it can compile to native code for =
bare metal - i.e. no OS at all, just a bootloader and an executable. =
I've yet to play with that side of the language, but having written =
assembler for embedded systems with no OS I would love to see a Ruby =
runtime deployed in the same manner. =46rom there it's a short step to =
an OS written in Ruby, and that means an OS any half-competent =
programmer could understand in detail.

My colleague Romek and I have been boring people with that idea for =
about five years now, and mad though it probably seems I still believe =
it's a goal worth pursuing.

Anyway, to recap: the world might be a better place with a Ruby runtime =
that embraced pervasive concurrency in the runtime implementation, that =
was platform agnostic, and that allowed systems-level coding to be =
performed with the same ease we associate with Rails or even Sinatra. I =
won't pretend RubyGoLightly will tick all these boxes - right now it's =
an idea and ideas are by their nature transient. However it is certainly =
a framework in which to explore whether such a Ruby is possible.


=3D=3D GoLightly =3D=3D

There are two aspects to this project. One is the Ruby runtime, which =
right now I have only the vaguest of ideas about how to implement. I'm =
following a hunch that a Forth-like Threaded Interpreter might allow =
optimisations that we're not going to see with mainstream bytecode =
interpreters and a lot of current effort is devoted to writing such a =
Forth implementation. Although I hesitate to call it Forth given the =
usual expectations of F79, F83, figForth or ANS94 compliance - none of =
them particular of particular importance.

Threaded interpretation isn't a million miles removed from the naive =
view of Ruby's object model so I'm hoping my current work will generate =
insights relevant to that, however its main purpose is to drive design =
of the GoLightly virtual machine which is an abstraction of the kind of =
hardware I'm interested in seeing Ruby run on.

There's an early branch of GoLightly on github =
(http://github.com/feyeleanor/GoLightly) which exposes some basic =
despatch loops (inlined bytecode and indirect function call) and a =
preliminary model for SIMD-style opcodes for basic vector processing and =
a supporting register model.

There are a few examples of hand-coded assembler in the tests to give a =
feel for the machine language along with some micro-benchmarks for =
anyone who fancies playing. GoLightly already copes with multiple =
virtual processors, all working on their discrete problems but there's a =
lot of work yet to be done in inter-core communication, the memory =
allocation model, and parallelising SIMD instructions.

One of the few things I dislike about Go as it currently stands - and =
which alas is considered a strength by the core team so is unlikely to =
change - is that the language doesn't support a representation-agnostic =
datatype suitable for holding bit-strings: basically numeric types =
always convert their contents to suit the type to which they're being =
coerced, or else a panic occurs. Getting around this involves playing =
games with pointers that make a fair amount of (void *) usage in C look =
clear and reasonable. The justification is that this sort of thing =
shouldn't be encouraged (with which I happen to disagree anyway) and =
that the extra pain is a bit of nudge to prevent it. I'll keep raising =
the issue with the core team every few weeks as I personally believe =
maintainability is much more important than type safety: after all, we =
can always write tests...

Anyway GoLightly is stalled whilst I evolve a reasonable API for =
handling bitstring manipulations, which is proving a subtly intractable =
problem. I'm hoping that hacking together a few languages will help me =
figure out most of the implementation details which are currently =
eluding me and then I'll roll a bitstring library back into the Go core =
library if the team will have it.

The unnamed Forth I'm currently working on is running into the same =
problems, but I'm still hoping to get a reasonable build ready for =
release on github over the summer. So far I have a good first cut of a =
compile/execute/decompile model which supports dynamic coding and I hope =
to reduce much of the Go code for implementing a core vocabulary to =
GoLightly-style bytecode. These bytecodes (which are effectively unique =
to the currently running system, so more a dynamic object code than a =
formal bytecode) would themselves be a first-class element of the =
language so that's an interesting model for both a native code interface =
and for allowing inline use of multiple languages.


=3D=3D The Roadmap =3D=3D

=46rom Forth to Ruby is one hell of a leap, and whilst I don't doubt it =
can be done in one step there are other problems I want to solve along =
the way.

I definitely see a simple Lisp being in the mix as I've always felt =
there is an equivalence between Forth and Lisp which goes unremarked: I =
guess there aren't that many people who've hacked with both, let alone =
who've written runtimes for both. Lisp will be the testbed for doing =
standard function call stack allocations and a few other aspects of =
implementing a high-level language which Forth skirts. Common Lisp it =
most definitely won't be though (or Arc for that matter).

=46rom there I want to get a Scheme working, mostly to figure out how to =
handle tail-call recursion efficiently. It could be that this will be a =
specific compiler optimisation required separately for each supported =
language, but I'd really prefer it to work at the object code level so =
that it's applied across all compiled code automatically. Go uses =
relatively small stacks to improve concurrent performance compared to =
pThreads and whilst GoLightly threads are currently specced to use their =
own user-space threads I'd like to move beyond that in the future so =
tail call culling will be essential to not swamping the runtime stack.

After Scheme I'm hoping to implement a simple Logo system to get a =
handle on the interfaces offered by Google's Native Client etc. - it's a =
bit of a gratuitous diversion as Logo is hardly a mainstream language, =
but the underlying structure is similar enough to Lisp that I think it =
will be an easy build and there's been some interesting work in =
Logo-land to do with multi-threaded graphics which might have =
interesting tie-ins with OpenCL.

Much of the impetus to start hacking on RubyGoLightly is thanks to =
TinyRb, a really sweet subset of Ruby running on a Lua-style VM. Once =
I've solved the main runtime problems addressed by the Lisp arc of =
languages I plan to write a runtime interpreter for the TinyRb bytecode =
so its compiled form can run natively in GoLightly. My gut instinct is =
that this will be a great starting point for runtime optimisations that =
apply to a richer subset of Ruby.

At LSRC last year I showed off some of the code from a port of SQLite to =
Ruby that I was working on at the time. That project got put on hold =
when I started RubyGoLightly but given that SQLite is a really sweet =
engine and internally uses a register based VM it'd be easy to port to =
GoLightly and provide something like CoreData out of the box.

There could be a few steps after this: for one thing I've this gut =
feeling that doing a dirty implementation of Io could be instructive, =
though I can't really explain way. Something to do with the method =
passing semantics. A roadmap's no good if it doesn't allow for =
interesting detours :)

However the ultimate destination is RubyGoLightly, the Ruby runtime that =
scratches the itch of using Ruby as a systems language. No promises =
about where or when, and very few about how... but I promise to check in =
with another status report in a few months that will hopefully be more =
insightful.

In the meantime, happy hacking,


Ellie

Eleanor McHugh
Games With Brains
http://feyeleanor.tel
----
raise ArgumentError unless @reality.responds_to? :reason



In This Thread

Prev Next