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

[Xen-devel] Mini-os with Lua



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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.