Debian Codegraph @

src/doc/old-manual/mp.xmlf

raw
1 <?xml version="1.0" encoding="utf-8"?>
2 <!DOCTYPE book [
3 <!ENTITY % eclent SYSTEM "ecl.ent">
4 %eclent;
5 ]>
6 <book xmlns="http://docbook.org/ns/docbook" version="5.0" xml:lang="en">
7 <chapter xml:id="ext.mp">
8 <title>Multithreading</title>
9
10 <section xml:id="ext.mp.threads">
11 <title>Tasks, threads or processes</title>
12
13 <para>On most platforms, &ECL; supports native multithreading. That means
14 there can be several tasks executing lisp code on parallel and sharing
15 memory, variables and files. The interface for multitasking in &ECL;, like
16 those of most other implementations, is based on a set of functions and
17 types that resemble the multiprocessing capabilities of old Lisp Machines.
18 </para>
19
20 <para>This backward compatibility is why tasks or threads are called
21 "processes". However, they should not be confused with operating system
22 processes, which are made of programs running in separate contexts and
23 without access to each other's memory.</para>
24
25 <para>The implementation of threads in &ECL; is purely native and based on
26 Posix Threads wherever avaiable. The use of native threads has
27 advantanges. For instance, they allow for non-blocking file operations,
28 so that while one task is reading a file, a different one is performing
29 a computation.</para>
30
31 <para>As mentioned above, tasks share the same memory, as well as the set of
32 open files and sockets. This manifests on two features. First of all,
33 different tasks can operate on the same lisp objects, reading and writing
34 their slots, or manipulating the same arrays. Second, while threads share
35 global variables, constants and function definitions they can also have
36 thread-local bindings to special variables that are not seen by other
37 tasks.</para>
38
39 <para>The fact that different tasks have access to the same set of data
40 allows both for flexibility and a greater risk. In order to control access
41 to different resources, &ECL; provides the user with locks, as explained in
42 the next section.</para>
43
44 </section>
45
46 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="ref_mp.xmlf" xpointer="ext.mp.dict"/>
47
48 </chapter>
49 </book>
50 <!-- Keep this comment at the end of the file
51 Local variables:
52 mode: nxml
53 sgml-parent-document: "ecl.xml"
54 sgml-indent-step: 1
55 nxml-child-indent: 1
56 nxml-outline-child-indent: 1
57 fill-column: 79
58 End:
59 -->