README 2.41 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
SINGLE-THREADED-CCL
===================

A simple patch to allow Clozure CL (CCL) to run in single-threaded mode.

This is free software, available under the same license as CCL, LLGPL 2.1.


Using It
--------

To create a single-threaded ccl, you may::

14
	${CCL_DEFAULT_DIRECTORY}/lx86cl64 --no-init --load make-single-threaded-ccl
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37


To test that indeed you can run code single-threaded mode, you may::

	./single-threaded-ccl --eval '(progn (format t "~S" ccl::*application*) (ccl::show-processes) (ccl:quit))'

It your CCL is successfully single-threaded, only one process will show.


Note that to be able to use many of the dynamically loaded features of CCL,
you will need to either put your single-threaded-ccl in the same directory
as the rest of CCL and use it from there, or you will need to::

	export CCL_DEFAULT_DIRECTORY=/path/to/original-ccl


If you build with ASDF, you may also depend on the system single-threaded-ccl,
and when you next save an image, it will start single-threaded.


Last Tested
-----------

38
It was last tested to run with this checkout of CCL, revision 15791.
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
        http://svn.clozure.com/publicsvn/openmcl/trunk/linuxx86/ccl


Won't Make It Upstream
----------------------

This was submitted for inclusion in the upstream CCL distribution.
However, Gary Byers has expressed his disinterest in offering and maintaining
an option for single-threaded startup in the upstream CCL,
even when I proposed that I could do the porting and maintaining myself.



Why We Need It
--------------
Francois-Rene Rideau's avatar
Francois-Rene Rideau committed
54
55

CCL by default starts ancillary threads early during initialization,
56
57
58
59
which makes any subsequent attempt to use fork
almost guaranteed to lead to massive instability
(unless maybe it's promptly followed by exec, as in run-program,
without a GC interrupt in between).
60
61
See my blog post:
	http://fare.livejournal.com/148185.html
Francois-Rene Rideau's avatar
Francois-Rene Rideau committed
62

63
64
65
66
67
68
69
70
71
72
73
74
However, I have been maintaining this "single-threaded CCL" modification
that can create an image of CCL that doesn't start these ancillary threads
(at the cost of having to manually flush output streams and
of not being able to interrupt computations interactively with Ctrl-C).

I use this single-threaded CCL for parallel build with POIU and XCVB,
and have had to update it once in a while
as upstream upgrades sometimes break it.
I also intend to use it in other situations
where fork-based concurrency is called for:
pre-forking servers, robust erlang-style concurrency,
isolating semi-trusted C libraries, etc.