January 2000
- JavaWorld: Build an object database J C Lawrence
- Muq update Cynbe ru Taren
- New link support J C Lawrence
- OS Inspiration Phillip Lenhardt
- OS Inspiration Greg Miller
- Chomsky's recursive theory of grammar J C Lawrence
- concerning tokenization, compilation, performance, and other fun stuff. Nate Cain
- concerning tokenization, compilation, performance, and other fun stuff. cg@ami-cg.GraySage.Edmonton.AB.CA
- concerning tokenization, compilation, performance, and other fun stuff. Joel Dillon
- concerning tokenization, compilation, performance, and other fun stuff. Ola Fosheim Grøstad
- Library submission notification and updates J C Lawrence
- EQ packet sniffer J C Lawrence
- Catalog of Compiler Construction Tools J C Lawrence
- Microthreads for Python J C Lawrence
While Python already supports threads, its not really a fully
scalable model. The following addresses some of that:
http://world.std.com/%7ewware/uthread.html
--<cut>--
It would be nice to use Python for programs involving huge numbers
of very light-weight threads. This would make it easy to simulate
large swarms of interacting agents, which sounds like fun.
Python functions are compiled to a bytecode, which runs on a virtual
machine, defined in Python/ceval.c in the eval_code2
function. Python uses frame objects to administer information
involved in nested function calls. In ceval.c, the frame stack is
implicitly embedded in the C stack, because eval_code2 calls itself
recursively when one Python function calls another.
Microthreads are implemented with a modified version of the code in
Python/ceval.c, which is Python's bytecode interpreter. Each thread
maintains an explicit frame stack, whereas normally frames are kept
on the C stack via recursive calls to eval_code2. My version of
eval_code2 can be stepped for a number of steps, unlike the normal
version which runs in an infinite loop until the outermost function
returns.
I've defined several objects in C: a "working" object (which is a
placeholder like the normal "None" object), a "uthread" object, a
"semaphore" object (also known as a mutex), and a "queue"
object. The semaphore and queue are microthread-safe. There is also
a microthread-safe version of the whrandom random number generator.
uthread.thread() creates a microthread. As arguments, it takes a
function, and any arguments that the function expects. For instance
to create a thread that computes f(x,y,z), you would write something
like 'mythread = uthread.thread(f,x,y,z)'.
Every thread has a step method (mythread.step()) which will step the
microthread for a finite number of opcodes. It returns the thread's
return value, if the thread has finished, or if the thread has not
yet finished, it returns uthread.working (the "working" placeholder
object). If you attempt to step a thread which has already finished,
an error will result.
uthread.semaphore() creates a semaphore object. It takes an optional
integer argument (default value is 1) telling how many instances of
the semaphore may be outstanding at any moment. A semaphore has the
following methods: claim() will claim one instance of a semaphore,
or block until an instance becomes available. qclaim() is a
non-blocking version of claim, which returns a boolean telling
whether the claim was successful. release() will release an instance
of the semaphore.
uthread.queue() creates a queue object, and takes an integer
argument, specifying a number of stages. Each stage in the queue is
a normal list. A queue has the following methods: put(x) will append
x to the list at the rear of the queue, get() will remove and return
the first object from the list at the front of the queue (None if
the front queue is empty), and step() will advance the lists one
step toward the front of the queue, concatenating the front two
lists to become the new front list.
There is much similarity between this project and Stackless Python
by Christian Tismer, as several people on the Python newsgroup have
pointed out. Eventually it will probably make sense to merge
microthreads into Stackless Python, but it's not my most immediate
priority.
Some of the applications that interest me for microthreads are
amorphous computing and computational economics. Microthreads could
also be used to write agents in a game, such as robot tanks or
PacMan monsters
--<cut>--
The Stackless Python referenced above can be found at:
http://www.pns.cc/stackless/stackless.htm
but currently that site is note accepting connections.
--
J C Lawrence Home: claw@kanga.nu
----------(*) Other: coder@kanga.nu
--=| A man is as sane as he is dangerous to his environment |=-- - For those interested in parsers and compilers J C Lawrence
- EQ packet analyzer is gone? Sellers, Michael
- EQ packet analyzer is gone? J C Lawrence
- EQ packet analyzer is gone? J C Lawrence
- RFC: Worldforge project Scott Clitheroe
- ScryMUD 2.0.9 released (compiles on Windows (cygwin)) Ben Greear
- Clay Shirky's "Playfulness in 3-D Spaces" J C Lawrence
- Clay Shirky's "Playfulness in 3-D Spaces" Raph & Kristen Koster
- Clay Shirky's "Playfulness in 3-D Spaces" Sellers, Michael
- Clay Shirky's "Playfulness in 3-D Spaces" Nick Shaffner
- Clay Shirky's "Playfulness in 3-D Spaces" Sellers, Michael
- Clay Shirky's "Playfulness in 3-D Spaces" Jeremy Music "Sterling"
- Clay Shirky's "Playfulness in 3-D Spaces" msew
- ShowEQ Ashran
- Hello! F. Randall Farmer
- Hello! Cynbe ru Taren
- Y2K archives J C Lawrence
- An introduction... Geoffrey A. MacDougall
- An introduction... Lovecraft
- Laws website moves Raph & Kristen Koster
- Ok, got some brand new core dumps. J C Lawrence
- player politics (was An introduction...) Sellers, Michael
- player politics (was An introduction...) Ola Fosheim Grøstad
- player politics (was An introduction...) Sellers, Michael
- player politics (was An introduction...) Ola Fosheim Grøstad
- player politics (was An introduction...) J C Lawrence
- player politics (was An introduction...) Sellers, Michael
- A quick business question... Geoffrey A. MacDougall
- A quick business question... Matthew Mihaly
- A quick business question... Darrin Hyrup
- Question about multithreaded servers Fabian Lemke
- Question about multithreaded servers AR Schleicher
- Question about multithreaded servers Nick Shaffner
- Question about multithreaded servers Ola Fosheim Grøstad
- Question about multithreaded servers Fabian
- Question about multithreaded servers Jon A. Lambert
- Question about multithreaded servers J C Lawrence
- Question about multithreaded servers Greg Underwood
- Question about multithreaded servers cg@ami-cg.GraySage.Edmonton.AB.CA
- Question about multithreaded servers J C Lawrence
- Question about multithreaded servers Greg Underwood
- Question about multithreaded servers J C Lawrence
- Question about multithreaded servers Emil Eifrém
- Question about multithreaded servers J C Lawrence
- Community Relations Dundee
- Community Relations Christopher Allen
- Community Relations Matthew Mihaly
- Community Relations Greg Miller
- Community Relations Darrin Hyrup
- Community Relations Dundee
- Community Relations Ola Fosheim Grøstad
- Community Relations Dundee
- Community Relations Ola Fosheim Grøstad
- Community Relations Dundee
- Community Relations Marian Griffith
- Community Relations Koster, Raph
- Community Relations Jon A. Lambert
- Community Relations Matthew Mihaly
- Community Relations Ola Fosheim Grøstad
- Community Relations Matthew Mihaly
- Community Relations Ola Fosheim Grøstad
- Community Relations Matthew Mihaly
- Community Relations Marc Bowden
- Community Relations Eli Stevens {Grey}
- Community Relations Matthew Mihaly
- Community Relations Raph & Kristen Koster
- Community Relations Matthew Mihaly
- Community Relations Koster, Raph
- Community Relations Travis Casey
- Community Relations Ola Fosheim Grøstad
- Community Relations Travis Casey
- Community Relations Ola Fosheim Grøstad
- Community Relations Matthew Mihaly
- Community Relations Rahul Sinha
- Community Relations Matthew Mihaly
- Community Relations Matthew Mihaly
- Community Relations Ola Fosheim Grøstad
- Community Relations Koster, Raph
- Community Relations Matthew Mihaly
- Community Relations Geoffrey A. MacDougall
- Community Relations Jon A. Lambert
- Community Relations Matthew Mihaly
- Community Relations Ola Fosheim Grøstad
- Community Relations Travis S. Casey
- Community Relations Douglas Couch
- Community Relations Dundee
- Community Relations Marian Griffith
- Community Relations Jon A. Lambert
- Community Relations Matthew Mihaly
- Community Relations Jon A. Lambert
- Community Relations Matthew Mihaly
- Community Relations Geoffrey A. MacDougall
- Community Relations Matthew Mihaly
- Community Relations Lovecraft
- Community Relations Geoffrey A. MacDougall
- Community Relations Lovecraft
- Community Relations Marian Griffith
- Community Relations Matthew Mihaly
- Community Relations Sellers, Michael
- Community Relations Lovecraft
- Community Relations J C Lawrence
- Community Relations Lovecraft
- Community Relations J C Lawrence
- Community Relations Koster, Raph
- Community Relations Jon A. Lambert
- Community Relations Ola Fosheim Grøstad
- Community Relations Lovecraft
- Community Relations Jon A. Lambert
- Community Relations Lovecraft
- Community Relations Jon A. Lambert
- Community Relations Jon A. Lambert
- Community Relations J C Lawrence
- Community Relations Wes Connell
- Community Relations Marc Bowden
- Community Relations Dundee
- Community Relations J C Lawrence
- Community Relations J C Lawrence
- Community Relations F. Randall Farmer
- Community Relations Dr. Cat
- Community Relations J C Lawrence
- Community Relations Koster, Raph
- Community Relations Geoffrey A. MacDougall
- Community Relations Matthew Mihaly
- Commercial-use Restrictions on Code Bases (was: help me find 100% fre (fwd) J C Lawrence
- Commercial-use Restrictions on Code Bases (was: help me find 100% fre (fwd) J C Lawrence
- Databases (was Commercial-use Restrictions on Code Bases) Charles Hughes
- Databases (was Commercial-use Restrictions on Code Bases) cg@ami-cg.GraySage.Edmonton.AB.CA
- Databases (was Commercial-use Restrictions on Code Bases) Jon A. Lambert
- Databases (was Commercial-use Restrictions on Code Bases) Jon A. Lambert
- Databases (was Commercial-use Restrictions on Code Bases) J C Lawrence
- Mud-Dev FAQ part I Marian Griffith
- Mud-Dev FAQ part II Marian Griffith
- META: List goals (was OS Inspiration) J C Lawrence
- Valhalla license? CFrancy@aol.com
- Valhalla license? Matthew Mihaly
- Valhalla license? Richard Woolcock
- Planet/Solar System Generation Wes Connell
- Planet/Solar System Generation icecube@ihug.co.nz
- Planet/Solar System Generation Christopher Allen
- Planet/Solar System Generation J C Lawrence
- Planet/Solar System Generation Nolan Darilek
- Planet/Solar System Generation Wes Connell
- Planet/Solar System Generation Richard Woolcock
- How to handle/display partial language skill Joe Kingry
- How to handle/display partial language skill Greg Underwood
- How to handle/display partial language skill Wes Connell
- How to handle/display partial language skill Matt Chatterley
- Signing off... IronWolf
- Simulated Populations phlUID
- Simulated Populations Charles Hughes
- Simulated Populations Vladimir Prelovac
- Simulated Populations phlUID
- Simulated Populations Dundee
- Simulated Populations Wes Connell
- Simulated Populations Nicolai Hansen
- Simulated Populations J C Lawrence
- Simulated Populations J C Lawrence
- Business Licenses CFrancy@aol.com
- Business Licenses Bruce
- Business Licenses J C Lawrence
- [adv-mud] What good is a hero when nobody knows? (fwd) J C Lawrence
- [adv-mud] What good is a hero when nobody knows? (fwd) Matthew Mihaly
- [adv-mud] What good is a hero when nobody knows? (fwd) Wes Connell
- [adv-mud] What good is a hero when nobody knows? (fwd) Matthew Mihaly
- [adv-mud] What good is a hero when nobody knows? (fwd) Erik Jarvi
- Multiply oriented interactive worlds... Justin Rogers
- [adv-mud] What good is a hero when nobody knows? J C Lawrence
- [adv-mud] Topic list repost (fwd) J C Lawrence
- [adv-mud] Spellbound Hierarchy and Keys (fwd) J C Lawrence
- [adv-mud] Spellbound Hierarchy and Keys (fwd) J C Lawrence
- [adv-mud] Better Grammer Detection J C Lawrence
- [adv-mud] MUD-Dev vs. adv-mud J C Lawrence
- MUD-Dev vs. adv-mud phlUID
- [adv-mud] What good is a hero when nobody knows? phlUID
- (fwd) Avatarism and Role-Playing Game Design claw@kanga.nu
- Starlane test Joel Kelso
- hoho Matthew Mihaly
- Current Status of Middle Earth Online Geoffrey A. MacDougall
- ScryMUD 2.0.10 released. Ben Greear
- [adv-mud] What good is a hero when nobody knows? J C Lawrence
- [adv-mud] What good is a hero when nobody knows? Ben Greear
- [adv-mud] What good is a hero when nobody knows? J C Lawrence
- [adv-mud] What good is a hero when nobody knows? Wes Connell
- [adv-mud] What good is a hero when nobody knows? J C Lawrence
- Some new Library references J C Lawrence