README revision 12027
14120Sgblack@eecs.umich.eduThis is a source code distribution for QuickThreads. QuickThreads is a 24120Sgblack@eecs.umich.edutoolkit for building threads packages; it is described in detail in the 37087Snate@binkert.orgUniversity of Washington CS&E Technical report #93-05-06, available via 47087Snate@binkert.organonymous ftp from `ftp.cs.washington.edu' (128.95.1.4, as of Oct. '94) 57087Snate@binkert.orgin `tr/1993/05/UW-CSE-93-05-06.PS.Z'. 67087Snate@binkert.org 77087Snate@binkert.orgThis distribution shows basic ideas in QuickThreads and elaborates with 87087Snate@binkert.orgexample implementations for a gaggle of machines. As of October those 97087Snate@binkert.orgmachines included: 107087Snate@binkert.org 117087Snate@binkert.org 80386 faimly 127087Snate@binkert.org 88000 faimily 137087Snate@binkert.org DEC AXP (Alpha) family 147087Snate@binkert.org HP-PA family 154120Sgblack@eecs.umich.edu KSR 164120Sgblack@eecs.umich.edu MIPS family 174120Sgblack@eecs.umich.edu SPARC V8 family 184120Sgblack@eecs.umich.edu VAX family 194120Sgblack@eecs.umich.edu 204120Sgblack@eecs.umich.eduConfiguration, build, and installation are described in INSTALL. 214120Sgblack@eecs.umich.edu 224120Sgblack@eecs.umich.eduBe aware: that there is no varargs code for the KSR. 234120Sgblack@eecs.umich.edu 244120Sgblack@eecs.umich.eduThe HP-PA port was designed to work with both HP workstations 254120Sgblack@eecs.umich.eduand Convex SPP computers. It was generously provided by Uwe Reder 264120Sgblack@eecs.umich.edu<uereder@cip.informatik.uni-erlangen.de>. It is part of the ELiTE 274120Sgblack@eecs.umich.edu(Erlangen Lightweight Thread Environment) project directed by 284120Sgblack@eecs.umich.eduFrank Bellosa <bellosa@informatik.uni-erlangen.de> at the Operating 294120Sgblack@eecs.umich.eduSystems Department of the University of Erlangen (Germany). 304120Sgblack@eecs.umich.edu 314120Sgblack@eecs.umich.eduOther contributors include: Weihaw Chuang, Richard O'Keefe, 324120Sgblack@eecs.umich.eduLaurent Perron, John Polstra, Shinji Suzuki, Assar Westerlund, 334120Sgblack@eecs.umich.eduthanks also to Peter Buhr and Dirk Grunwald. 344120Sgblack@eecs.umich.edu 354120Sgblack@eecs.umich.edu 364120Sgblack@eecs.umich.eduHere is a brief summary: 374120Sgblack@eecs.umich.edu 384120Sgblack@eecs.umich.eduQuickThreads is a toolkit for building threads packages. It is my hope 394120Sgblack@eecs.umich.eduthat you'll find it easier to use QuickThreads normally than to take it 404120Sgblack@eecs.umich.eduand modify the raw cswap code to fit your application. The idea behind 414120Sgblack@eecs.umich.eduQuickThreads is that it should make it easy for you to write & retarget 424120Sgblack@eecs.umich.eduthreads packages. If you want the routine `t_create' to create threads 434202Sbinkertn@umich.eduand `t_block' to suspend threads, you write them using the QuickThreads 445069Sgblack@eecs.umich.edu`primitive' operations `QT_SP', `QT_INIT', and `QT_BLOCK', that perform 454202Sbinkertn@umich.edumachine-dependent initialization and blocking, plus code you supply for 465659Sgblack@eecs.umich.eduperforming the portable operatons. For example, you might write: 479022Sgblack@eecs.umich.edu 489023Sgblack@eecs.umich.edu t_create (func, arg) 494601Sgblack@eecs.umich.edu { 505124Sgblack@eecs.umich.edu stk = malloc (STKSIZE); 517966Sgblack@eecs.umich.edu stackbase = QT_SP (stk, STKSIZE); 525083Sgblack@eecs.umich.edu sp = QT_INIT (stakcbase, func, arg); 534679Sgblack@eecs.umich.edu qput (runq, sp); 546515Sgblack@eecs.umich.edu } 555083Sgblack@eecs.umich.edu 564679Sgblack@eecs.umich.eduThreads block by doing something like: 574679Sgblack@eecs.umich.edu 588745Sgblack@eecs.umich.edu t_block() 596313Sgblack@eecs.umich.edu { 608771Sgblack@eecs.umich.edu sp_next = qget (runq); 618771Sgblack@eecs.umich.edu QT_BLOCK (helper, runq, sp_next); 628771Sgblack@eecs.umich.edu // wake up again here 636365Sgblack@eecs.umich.edu } 645124Sgblack@eecs.umich.edu 658752Sgblack@eecs.umich.edu // called by QT_BLOCK after the old thread has blocked, 668771Sgblack@eecs.umich.edu // puts the old thread on the queue `onq'. 6710553Salexandru.dutu@amd.com helper (sp_old, onq) 684202Sbinkertn@umich.edu { 698771Sgblack@eecs.umich.edu qput (onq, sp_old); 708771Sgblack@eecs.umich.edu } 714997Sgblack@eecs.umich.edu 727624Sgblack@eecs.umich.edu(Of course) it's actually a bit more complex than that, but the general 735135Sgblack@eecs.umich.eduidea is that you write portable code to allocate stacks and enqueue and 748753Sgblack@eecs.umich.edudequeue threads. Than, to get your threads package up and running on a 754997Sgblack@eecs.umich.edudifferent machine, you just reconfigure QuickThreads and recompile, and 769384SAndreas.Sandberg@arm.comthat's it. 778745Sgblack@eecs.umich.edu 786365Sgblack@eecs.umich.eduThe QuickThreads `distribution' includes a sample threads package (look 798771Sgblack@eecs.umich.eduat stp.{c,h}) that is written in terms of QuickThreads operations. The 808740Sgblack@eecs.umich.eduTR mentioned above explains the simple threads package in detail. 816365Sgblack@eecs.umich.edu 828740Sgblack@eecs.umich.edu 838745Sgblack@eecs.umich.edu 848752Sgblack@eecs.umich.eduIf you do use QuickThreads, I'd like to hear both about what worked for 858752Sgblack@eecs.umich.eduyou and what didn't work, problems you had, insights gleaned, etc. 869023Sgblack@eecs.umich.edu 878335Snate@binkert.orgLet me know what you think. 884120Sgblack@eecs.umich.edu 895069Sgblack@eecs.umich.eduDavid Keppel <pardo@cs.washington.edu> 905081Sgblack@eecs.umich.edu