Initial revision
[sbcl.git] / doc / intro.sgml
1 <chapter id="intro"><title>Introduction</>
2
3 <para>&SBCL; is a mostly-conforming implementation of the &ANSI;
4 &CommonLisp; standard. This manual focuses on behavior which is
5 specific to &SBCL;, not on behavior which is common to all
6 implementations of &ANSI; &CommonLisp;.</para>
7
8 <sect1><title>More Information on &CommonLisp; in General</>
9
10 <para>If you are an experienced programmer in general but need
11 information on using &CommonLisp; in particular, <emphasis>ANSI Common
12 Lisp</>, by Paul Graham, is a good place to start. <emphasis>Paradigms
13 Of Artificial Intelligence Programming</>, by Peter Norvig, also has
14 some good information on general &CommonLisp; programming, and many
15 nontrivial examples. For CLOS in particular, <emphasis>Object-Oriented
16 Programming In Common Lisp</> by Sonya Keene is useful.</para>
17
18 <para>Two very useful resources for working with any implementation of
19 &CommonLisp; are the
20 <ulink url="http://ilisp.cons.org"><application>ILISP</></ulink>
21 package for <application>Emacs</> and
22 <ulink url="http://www.harlequin.com/books/HyperSpec">the &CommonLisp;
23 HyperSpec</>.</para>
24
25 </sect1>
26
27 <sect1><title>More Information on SBCL</title>
28
29 <para>Besides this manual, some other &SBCL;-specific information is
30 available:
31 <itemizedlist>
32   <listitem><para>There is a Unix <quote>man page</> file
33     <filename>sbcl.1</> in the &SBCL; distribution,
34      describing command options and other usage information
35      for the Unix <function>sbcl</> command which invokes
36      the &SBCL; system.</para></listitem>
37   <listitem><para>Documentation for non-&ANSI; extensions for
38     various commands is available online from the &SBCL; executable
39     itself. The extensions for functions which have their own 
40     command prompts (e.g. the debugger, and <function>inspect</>)
41     are documented in text available by typing <userinput>help</>
42     at their command prompts. The extensions for functions which
43     don't have their own command prompt (e.g. <function>trace</>)
44     are described in their documentation strings,
45     unless your &SBCL was compiled with an option not
46     to include documentation strings, in which case the doc strings
47     are only readable in the source code.</para></listitem>
48   <listitem><para>The <ulink url="http://sbcl.sourceforge.net/">
49     &SBCL; home page</ulink> has some general
50     information, plus links to mailing lists devoted to &SBCL;,
51     and to archives of these mailing lists.</para></listitem>
52   <listitem><para>Some low-level information describing the 
53     programming details of the conversion from &CMUCL; to &SBCL;
54     is available in the <filename>doc/FOR-CMUCL-DEVELOPERS</>
55     file in the &SBCL; distribution.</para></listitem>
56 </itemizedlist>
57 </para>
58
59 </sect1>
60
61 <sect1 id="implementation"><title>System Implementation and History</>
62
63 <para>You can work productively with SBCL without understanding
64 anything about how it was and is implemented, but a little knowledge
65 can be helpful in order to better understand error messages,
66 troubleshoot problems, to understand why some parts of the system are
67 better debugged than others, and to anticipate which known bugs, known
68 performance problems, and missing extensions are likely to be fixed,
69 tuned, or added.</para>
70
71 <para>&SBCL; is descended from &CMUCL;, which is itself descended from
72 Spice Lisp. Early implementations for the Mach operating system on the
73 IBM RT, back in the 1980s. Design decisions from that time are still
74 reflected in the current implementation:
75 <itemizedlist>
76   <listitem><para>The system expects to be loaded into a 
77     fixed-at-compile-time location in virtual memory, and also expects
78     the location of all of its heap storage to be specified
79     at compile time.</para></listitem>
80   <listitem><para>The system overcommits memory, allocating large
81     amounts of address space from the system (often more than 
82     the amount of virtual memory available) and then failing 
83     if ends up using too much of the allocated storage.</para></listitem>
84   <listitem><para>A word is a 32-bit quantity. The system has been 
85     ported to many processor architectures without altering this
86     basic principle. Some hacks allow the system to run on the Alpha
87     chip (a 64-bit architecture) but the assumption that a word is
88     32 bits wide is implicit in hundreds of places in the
89     system.</para></listitem>
90   <listitem><para>The system is implemented as a C program which is 
91     responsible for supplying low-level services and loading a 
92     Lisp <quote>.core</quote> file.
93   </para></listitem>    
94 </itemizedlist>
95 </para>
96
97 <para>&SBCL; also inherited some newer architectural features from
98 &CMUCL;. The most important is that it has a generational garbage
99 collector (<quote>GC</>), which has various implications (mostly good)
100 for performance. These are discussed in <link linkend="efficiency">
101 another chapter</link>.</para>
102
103 <para>The direct ancestor of &SBCL; is the X86 port of &CMUCL;.
104 This port is in some ways the least mature of any in the &CMUCL;
105 system, and some things (like profiling and backtracing) 
106 do not work particularly well there. &SBCL; should be able
107 to improve in these areas, but it may take a while.</para>
108
109 <para>The &SBCL; GC, like the GC on the X86 port of &CMUCL;, is
110 <emphasis>conservative</>. This means that it doesn't maintain a
111 strict separation between tagged and untagged data, instead treating
112 some untagged data (e.g. raw floating point numbers) as
113 possibly-tagged data and so not collecting any Lisp objects that they
114 point to. This has some negative consequences for average time
115 efficiency (though possibly no worse than the negative consequences of
116 trying to implement an exact GC on a processor architecture as
117 register-poor as the X86) and also has potentially unlimited
118 consequences for worst-case memory efficiency. In practice,
119 conservative garbage collectors work reasonably well, not getting
120 anywhere near the worst case. But they can occasionally cause
121 odd patterns of memory usage.</para>
122
123 <para>The fork from &CMUCL; was based on a major rewrite of the system
124 bootstrap process. &CMUCL; has for many years tolerated a very unusual
125 <quote>build</> procedure which doesn't actually build the complete
126 system from scratch, but instead progressively overwrites parts of a
127 running system with new versions. This quasi-build procedure can cause
128 various bizarre bootstrapping hangups, especially when a major change
129 is made to the system. It also makes the connection between the
130 current source code and the current executable more tenuous than in
131 any other software system I'm aware of -- it's easy to accidentally
132 <quote>build</> a &CMUCL; system containing characteristics not
133 reflected in the current version of the source code.</para>
134
135 <para>Other major changes since the fork from &CMUCL; include
136 <itemizedlist>
137   <listitem><para>&SBCL; has dropped support for many &CMUCL; extensions,
138     (e.g. remote procedure call, Unix system interface, and X11
139     interface).</para></listitem>
140   <listitem><para>&SBCL; has deleted or deprecated
141     some nonstandard features and code complexity which helped
142     efficiency at the price of maintainability. For example, the 
143     &SBCL; compiler no longer implements memory pooling internally
144     (and so is simpler and more maintainable, but generates more
145     garbage and runs more slowly), and various block-compilation
146     efficiency-increasing extensions to the language have been
147     deleted or are no longer used in the implementation of &SBCL;
148     itself.</para></listitem>
149 </itemizedlist>
150 </para>
151
152 </sect1>
153
154 </chapter>