Hi everyone,

Thought I'd post an update on how my thread-safe vm work is coming 
along. The idea is to make factor fully thread safe so that multiple vms 
can run in the same process on separate OS threads.

 From an implementation perspective that effectively means removing all 
the global variables thus eliminating need for thread local storage 
(which sucks on every platform apart from Linux AFAICS).

The refactoring approach I'm taking is:

1) Move all global variables into a singleton vm struct and fix C code 
to refer to variables via a global pointer to this struct

2) Refactor c code into a tree of objects and move variables from the 
root vm struct into the leaf objects
     (so that the c code doesn't need the singleton global pointer)

3) Modify image ptr fixup to implicitly point factor references to the 
vm object tree
     (so that factor references don't need the singleton global pointer)

4) Modify primitive code to take an implicit pointer to the vm object tree
     (so that primitives don't need the global pointer)

5) Modify signal handlers to locate the vm responsible for the signal

6) Remove the vm singleton pointer. Factor is now thread safe and global 
state free!

I've finished (1) and am currently part way through (2).

I'm pushing updates to a github branch if you're interested in looking 
at the code:
http://github.com/phildawes/factor/tree/vm_reduce_globals

N.B. this branch gets rebased pretty frequently so don't try and merge 
it with trunk.

Cheers,

Phil


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to