WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] Mini-os with Lua

To: Ewan Mellor <ewan@xxxxxxxxxxxxx>
Subject: [Xen-devel] Mini-os with Lua
From: ramsdell@xxxxxxxxx (John D. Ramsdell)
Date: 06 Apr 2006 16:28:45 -0400
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Thu, 06 Apr 2006 13:29:06 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <20060406141215.GC32612@xxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <ogt8xqk2fzc.fsf@xxxxxxxxxxxxxxx> <20060406141215.GC32612@xxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3
Ewan Mellor <ewan@xxxxxxxxxxxxx> writes:

> Thanks for that patch to mini-os.  The file in question was actually
> removed from xen-unstable a couple of weeks ago, so there's no
> problem any longer!

The reason I was running the mini-os, is that I was thinking about
using it to implement programs that run in lightweight virtual
machines.  It appears from your note that mini-os is changing, and I
hope it is not changing in a way that is incompatible with the way I
in which I had hoped to use it.  Let me describe my plan.

I would like to run reactive programs in the style used by old
distributed memory parallel processors.  In this style, a program
registers handlers for events, and then exits.  Actual computation
occurs in a thread created by the operating system to handle an event.
Each thread is required to be short lived, so the cooperative
scheduler that is in the mini-os is appropriate for this programming
model.

To ease the programming task, I would like to implement the handlers
in Lua <http://www.lua.org>, a scripting language popular with the
small device community.  Lua is appropriate because it can be built so
that it performs no floating point operations, and its garbage
collector is incremental, so that pause times are small.  This allows
it to be used with a reactive programming model inside the kernel.

The C library that is part of mini-os in inadequate for use with Lua,
however, one can build a cross-compiler that can do the job.  To do
so, one downloads the sources for binutils, gcc, and newlib
<http://sources.redhat.com/newlib/>, and builds a cross-compiler for
the target i386-elf.  In addition to linking ones program with libc,
and libm, one also uses libnosys, which stubs all system calls.  I
built mini-os with the cross-compiler, and verified it runs in Xen.  I
have also built Lua with it so as to ensure that all of its globals
are resolved by newlib.

Lua can be useful with stub routines for system calls, however, there
is one more support item it requires.  It needs an allocator that
functions like realloc, or a good implementation of the sbrk system
call.  Since mini-os contains an implementation of malloc and free,
hacking in support for realloc seems to be the best option to me.

The remaining step is to write C functions that expose hypercall
functionality inside of Lua.  Since Lua is designed to be embedded
into C programs, this task should be easy.  I was just about to start
writing these functions when you raised my concerns about mini-os's
direction.  Where is it headed, and will it continue to provide the
kind of platform that supports reactive programming?

John

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel