A vision for Parrot

Benjamin Goldberg goldbb2 at earthlink.net
Wed Nov 6 02:15:03 EST 2002


Frodo Morris wrote:
> 
> Benjamin Goldberg wrote:
> > Frodo Morris wrote:
> >
> >>Daniel Pfeiffer wrote:
> >>
> >>>Hi,
> >>>Apache would essentially have a mod_parrot.  Maybe, if this can be
> >>>tested very hard, we'd even have a Parrot kernel module for all
> >>>Unices supporting that.  Then exec() could perform compiled scripts
> >>>right away, like machine code :-)
> >>
> >>I would have thought that a more platform-independent version of
> >>this would be, say, a parrotd, which sits on top of the kernel,
> >>intercepts calls to exec() bytecode and spawns the relevant
> >>processes.
> >
> >
> > What advantage would this have over putting a #! line in the
> > bytecode?
> >
> Faster, better, cheaper.
> Imagine if parrot could understand all interpreted code.

It can't.  Parrot can only understand parrot bytecode.

> Why not leave it running, so that any Perl/Python/Tcl/Ruby/Java/sh/
> BASIC/whatever code can get to it immediately?

Ignoring the problem of compiling those languages down to parrot
bytecode...

How should the kernel detect that a parrot-bytecode file is, in fact,
parrot bytecode?

For normal exe files, there's the execute bit and some standard headers.
For normal scripts, there's the execute bit and the #! line.

> A parrotd exec would consist of: "Run this." "OK".
> A #! consists of "Does this file exist?"  "Yes."  "Does it
> work?"  "Yes."  "OK, run this."  "OK".
> I contend that a properly set up parrotd *should* be faster than the
> equivalent "each language set up separately" environment.

The speed hit of exec() is *not* the time it takes to check if the file
named on the #! line exists and has the executable bit set.... the speed
it is due to the time it takes to load that program into memory.

With that in mind, if you can special-case the kernel to pass scripts on
to special daemons, rather than loading up an interpreter for each
script, it will almost surely be faster, and not just for perl/parrot.

-- 
my $n = 2; print +(split //, 'e,4c3H r ktulrnsJ2tPaeh'
."\n1oa! er")[map $n = ($n * 24 + 30) % 31, (42) x 26]



More information about the Python-list mailing list