Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] exene and ocaml ?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Richard Jones <rich@a...>
Subject: Re: [Caml-list] exene and ocaml ?
On Sun, Apr 11, 2004 at 06:41:53PM +1000, skaller wrote:
> Also, small address space processors cannot cope
> with the linear addressing problem: unlike processes,
> threads share address space. If you have a lot of threads
> you need a lot of stacks, and they all have to grow
> 'arbitrarily' large,[...]

I did some experiments with early versions of pthrlib (see .sig) where
I tried swapping stacks in and out during context switches using
mmap(2).  All thread stacks were located at the same address in
memory, thus sidestepping the address space problem.  It sort of can
be made to work: It was about 3 years ago, so I forget the exact
problems, but they were probably related to the fact that you need to
back each stack with a disk file, and it doesn't work well with the
normal GROWSDOWN behaviour of stacks.  Plus it's probably a lot slower
because you're trashing the disk cache / data cache and TLB on each
switch.

If you do this you have to be careful not to share data on the stack
between threads (not normally a problem).

BTW, very interesting your comments on Control Inversion.  I think
you're absolutely spot-on with that, and you should write up a node on
the Portland Wiki about it.  I don't think the term "Control
Inversion" is well-known, although it should be.

Rich.

-- 
Richard Jones. http://www.annexia.org/ http://www.j-london.com/
Merjis Ltd. http://www.merjis.com/ - improving website return on investment
PTHRLIB is a library for writing small, efficient and fast servers in C.
HTTP, CGI, DBI, lightweight threads: http://www.annexia.org/freeware/pthrlib/

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners