README revision 12027:1eb7dc7aa10b
1955SN/AThis is a source code distribution for QuickThreads.  QuickThreads is a
2955SN/Atoolkit for building threads packages; it is described in detail in the
35871Snate@binkert.orgUniversity of Washington CS&E Technical report #93-05-06, available via
41762SN/Aanonymous ftp from `ftp.cs.washington.edu' (128.95.1.4, as of Oct. '94)
5955SN/Ain `tr/1993/05/UW-CSE-93-05-06.PS.Z'.
6955SN/A
7955SN/AThis distribution shows basic ideas in QuickThreads and elaborates with
8955SN/Aexample implementations for a gaggle of machines.  As of October those
9955SN/Amachines included:
10955SN/A
11955SN/A	80386 faimly
12955SN/A	88000 faimily
13955SN/A	DEC AXP (Alpha) family
14955SN/A	HP-PA family
15955SN/A	KSR
16955SN/A	MIPS family
17955SN/A	SPARC V8 family
18955SN/A	VAX family
19955SN/A
20955SN/AConfiguration, build, and installation are described in INSTALL.
21955SN/A
22955SN/ABe aware: that there is no varargs code for the KSR.
23955SN/A
24955SN/AThe HP-PA port was designed to work with both HP workstations
25955SN/Aand Convex SPP computers. It was generously provided by Uwe Reder
26955SN/A<uereder@cip.informatik.uni-erlangen.de>. It is part of the ELiTE
27955SN/A(Erlangen Lightweight Thread Environment) project directed by 
28955SN/AFrank Bellosa <bellosa@informatik.uni-erlangen.de> at the Operating 
292665Ssaidi@eecs.umich.eduSystems Department of the University of Erlangen (Germany).
302665Ssaidi@eecs.umich.edu
315863Snate@binkert.orgOther contributors include: Weihaw Chuang, Richard O'Keefe,
32955SN/ALaurent Perron, John Polstra, Shinji Suzuki, Assar Westerlund,
33955SN/Athanks also to Peter Buhr and Dirk Grunwald.
34955SN/A
35955SN/A
36955SN/AHere is a brief summary:
372632Sstever@eecs.umich.edu
382632Sstever@eecs.umich.eduQuickThreads is a toolkit for building threads packages.  It is my hope
392632Sstever@eecs.umich.eduthat you'll find it easier to use QuickThreads normally than to take it
402632Sstever@eecs.umich.eduand modify the raw cswap code to fit your application.  The idea behind
41955SN/AQuickThreads is that it should make it easy for you to write & retarget
422632Sstever@eecs.umich.eduthreads packages.  If you want the routine `t_create' to create threads
432632Sstever@eecs.umich.eduand `t_block' to suspend threads, you write them using the QuickThreads
442761Sstever@eecs.umich.edu`primitive' operations `QT_SP', `QT_INIT', and `QT_BLOCK', that perform
452632Sstever@eecs.umich.edumachine-dependent initialization and blocking, plus code you supply for
462632Sstever@eecs.umich.eduperforming the portable operatons.  For example, you might write:
472632Sstever@eecs.umich.edu
482761Sstever@eecs.umich.edu	t_create (func, arg)
492761Sstever@eecs.umich.edu	{
502761Sstever@eecs.umich.edu	  stk = malloc (STKSIZE);
512632Sstever@eecs.umich.edu	  stackbase = QT_SP (stk, STKSIZE);
522632Sstever@eecs.umich.edu	  sp = QT_INIT (stakcbase, func, arg);
532761Sstever@eecs.umich.edu	  qput (runq, sp);
542761Sstever@eecs.umich.edu	}
552761Sstever@eecs.umich.edu
562761Sstever@eecs.umich.eduThreads block by doing something like:
572761Sstever@eecs.umich.edu
582632Sstever@eecs.umich.edu	t_block()
592632Sstever@eecs.umich.edu	{
602632Sstever@eecs.umich.edu	  sp_next = qget (runq);
612632Sstever@eecs.umich.edu	  QT_BLOCK (helper, runq, sp_next);
622632Sstever@eecs.umich.edu	  // wake up again here
632632Sstever@eecs.umich.edu	}
642632Sstever@eecs.umich.edu
65955SN/A	// called by QT_BLOCK after the old thread has blocked,
66955SN/A	// puts the old thread on the queue `onq'.
67955SN/A	helper (sp_old, onq)
685863Snate@binkert.org	{
695863Snate@binkert.org	  qput (onq, sp_old);
705863Snate@binkert.org	}
715863Snate@binkert.org
725863Snate@binkert.org(Of course) it's actually a bit more complex than that, but the general
735863Snate@binkert.orgidea is that you write portable code to allocate stacks and enqueue and
745863Snate@binkert.orgdequeue threads.  Than, to get your threads package up and running on a
755863Snate@binkert.orgdifferent machine, you just reconfigure QuickThreads and recompile, and
765863Snate@binkert.orgthat's it.
775863Snate@binkert.org
785863Snate@binkert.orgThe QuickThreads `distribution' includes a sample threads package (look
795863Snate@binkert.orgat stp.{c,h}) that is written in terms of QuickThreads operations.  The
805863Snate@binkert.orgTR mentioned above explains the simple threads package in detail.
815863Snate@binkert.org
825863Snate@binkert.org
835863Snate@binkert.org
845863Snate@binkert.orgIf you do use QuickThreads, I'd like to hear both about what worked for
855863Snate@binkert.orgyou and what didn't work, problems you had, insights gleaned, etc.
865863Snate@binkert.org
875863Snate@binkert.orgLet me know what you think.
885863Snate@binkert.org
895863Snate@binkert.orgDavid Keppel <pardo@cs.washington.edu>
905863Snate@binkert.org