Page 1 of 1

OpenLisp in multi-threaded environment

PostPosted: Sun Nov 13, 2005 5:56 am
by DmitryG
Is OpenLisp, especially its memory management subsystem, thread-safe? I suspect only its garbage collector is thread-safe, but other parts are not.
Please, say I'm mistaken :)

Re: OpenLisp in multi-threaded environment

PostPosted: Mon Nov 14, 2005 7:42 am
by jullien
DmitryG wrote:Is OpenLisp, especially its memory management subsystem, thread-safe? I suspect only its garbage collector is thread-safe, but other parts are not.
Please, say I'm mistaken :)


You're right, GC is the only part using threads.
Otherwise, OpenLisp has a BIG global structure that stores "global" values.
Please note that OpenLisp uses it's own virtual memory manager that
has no chance to conflit with malloc or other allocation routines.
For the internal details, the memory manager uses only mmap or VirtualAlloc on memory it reserves when OpenLisp starts.
Then, it only commits pages on demand in this reserved area.
If malloc occurs, its only from system or C library routines.

Christian

PostPosted: Mon Nov 14, 2005 10:24 am
by DmitryG
so, if two threads of a win app, which loads openlisp module, call eg (setq) simultaneously, then there is a probability that openlisp will go into conflict in its own mem management structures?

PostPosted: Mon Nov 21, 2005 7:22 am
by jullien
DmitryG wrote:so, if two threads of a win app, which loads openlisp module, call eg (setq) simultaneously, then there is a probability that openlisp will go into conflict in its own mem management structures?


Probably yes! as most other Lisp implementation. It should not be very difficult to make exclusive the 4 or 5 places where allocation occurs.
I've no idea of performance penalty.