Commit | Line | Data |
---|---|---|
44986d67 MD |
1 | This is a source code distribution for QuickThreads. QuickThreads is a |
2 | toolkit for building threads packages; it is described in detail in the | |
3 | University of Washington CS&E Technical report #93-05-06, available via | |
4 | anonymous ftp from `ftp.cs.washington.edu' (128.95.1.4, as of Oct. '94) | |
5 | in `tr/1993/05/UW-CSE-93-05-06.PS.Z'. | |
6 | ||
7 | This distribution shows basic ideas in QuickThreads and elaborates with | |
8 | example implementations for a gaggle of machines. As of October those | |
9 | machines included: | |
10 | ||
11 | 80386 faimly | |
12 | 88000 faimily | |
13 | DEC AXP (Alpha) family | |
14 | HP-PA family | |
15 | KSR | |
16 | MIPS family | |
17 | SPARC V8 family | |
18 | VAX family | |
19 | ||
20 | Configuration, build, and installation are described in INSTALL. | |
21 | ||
22 | Be aware: that there is no varargs code for the KSR. | |
23 | ||
24 | The HP-PA port was designed to work with both HP workstations | |
25 | and Convex SPP computers. It was generously provided by Uwe Reder | |
26 | <uereder@cip.informatik.uni-erlangen.de>. It is part of the ELiTE | |
27 | (Erlangen Lightweight Thread Environment) project directed by | |
28 | Frank Bellosa <bellosa@informatik.uni-erlangen.de> at the Operating | |
29 | Systems Department of the University of Erlangen (Germany). | |
30 | ||
31 | Other contributors include: Weihaw Chuang, Richard O'Keefe, | |
32 | Laurent Perron, John Polstra, Shinji Suzuki, Assar Westerlund, | |
33 | thanks also to Peter Buhr and Dirk Grunwald. | |
34 | ||
35 | ||
36 | Here is a brief summary: | |
37 | ||
38 | QuickThreads is a toolkit for building threads packages. It is my hope | |
39 | that you'll find it easier to use QuickThreads normally than to take it | |
40 | and modify the raw cswap code to fit your application. The idea behind | |
41 | QuickThreads is that it should make it easy for you to write & retarget | |
42 | threads packages. If you want the routine `t_create' to create threads | |
43 | and `t_block' to suspend threads, you write them using the QuickThreads | |
44 | `primitive' operations `QT_SP', `QT_INIT', and `QT_BLOCK', that perform | |
45 | machine-dependent initialization and blocking, plus code you supply for | |
46 | performing the portable operatons. For example, you might write: | |
47 | ||
48 | t_create (func, arg) | |
49 | { | |
50 | stk = malloc (STKSIZE); | |
51 | stackbase = QT_SP (stk, STKSIZE); | |
52 | sp = QT_INIT (stakcbase, func, arg); | |
53 | qput (runq, sp); | |
54 | } | |
55 | ||
56 | Threads block by doing something like: | |
57 | ||
58 | t_block() | |
59 | { | |
60 | sp_next = qget (runq); | |
61 | QT_BLOCK (helper, runq, sp_next); | |
62 | // wake up again here | |
63 | } | |
64 | ||
65 | // called by QT_BLOCK after the old thread has blocked, | |
66 | // puts the old thread on the queue `onq'. | |
67 | helper (sp_old, onq) | |
68 | { | |
69 | qput (onq, sp_old); | |
70 | } | |
71 | ||
72 | (Of course) it's actually a bit more complex than that, but the general | |
73 | idea is that you write portable code to allocate stacks and enqueue and | |
74 | dequeue threads. Than, to get your threads package up and running on a | |
75 | different machine, you just reconfigure QuickThreads and recompile, and | |
76 | that's it. | |
77 | ||
78 | The QuickThreads `distribution' includes a sample threads package (look | |
79 | at stp.{c,h}) that is written in terms of QuickThreads operations. The | |
80 | TR mentioned above explains the simple threads package in detail. | |
81 | ||
82 | ||
83 | ||
84 | If you do use QuickThreads, I'd like to hear both about what worked for | |
85 | you and what didn't work, problems you had, insights gleaned, etc. | |
86 | ||
87 | Let me know what you think. | |
88 | ||
89 | David Keppel <pardo@cs.washington.edu> |