1THEINTERLISP-DPROCESSMECHANISMTheInterlisp-DProcessmechanismprovidesanenvironmentinwhichmultipleLispprocessescanruninparallel.Eachexecutesinitsownstackspace,butallshareaglobaladressspace.Thecurrentprocessimplementationiscooperative;i.e.,processswitcheshappenvoluntarily,eitherwhentheprocessincontrolhasnothingtodoorwhenitisinaconvenientplacetopause.Thereisnopreemptionorguaranteedservice,soyoucannotrunsomethingdemanding(e.g.,Chat)atthesametimeassomethingthatrunsforlongperiodswithoutyieldingcontrol.Keyboardinputandnetworkoperationsblockwithgreatfrequency,soprocessescurrentlyworkbestforhighlyinteractivetasks(editing,makingremoteles).InInterlisp-D,theprocessmechanismisalreadyturnedon,andisexpectedtostayonduringnormaloperations,assomesystemfacilities(inparticular,mostnetworkoperations)requireit.However,underexceptionalconditions,thefollowingfunctioncanbeusedtoturntheworldoandon:[Function]Startsuptheprocessworld,orif=,killsallprocessesandturnsito.Normallydoesnotreturn.Theenvironmentstartsoutwithtwoprocesses:atop-level(theinitial``tty''process)andthe``background''process,whichrunsthewindowmousehandlerandothersystembackgroundtasks.Note:isintendedtobecalledatthetoplevelofInterlisp,notfromwithinaprogram.Itdoesnottogglesomesortofswitch;rather,itconstructssomenewprocessesinanewpartofthestack,leavinganycallersofinanowinaccessiblepartofthestack.Callingistheonlywaythecalltoeverreturns.[Function]Resetsthewholeworld,andrebuildsthestackfromscratch.Thisis``harder''thandoingtoeveryprocess,becauseitalsoresetssysteminternalprocesses(suchasthekeyboardhandler).automaticallyturnstheprocessworldon(orresetsitifitwason),unlessthevariableis.1.1CreatingandDestroyingProcesses[NoSpreadFunction]Createsanewprocessevaluating,andreturnsitsprocesshandle.Theprocess'sstackenvironmentisthetoplevel,i.e.,thenewprocessdoesnothaveaccesstotheenvironmentinwhichwascalled;allsuchinformationmustbepassedasargumentsin.Theprocessrunsuntilreturnsortheprocessisexplicitlydeleted.Anuntrappederrorwithintheprocessalsodeletestheprocess(unlessitspropertyis),inwhichcaseamessageisprintedtothateect.Theremainingargumentsarealternatelypropertynamesandvalues.Anyproperty/valuepairsacceptabletomaybegiven,butthefollowingtwoaredirectlyrelevantto:Valueshouldbealitatom;ifnotgiven,theprocessnameistakenfrom1(PROCESSWORLD)OFFEVALQTPROCESSWORLDPROCESSWORLD(PROCESSWORLD'OFF)PROCESSWORLD(HARDRESET)RESETHARDRESETAUTOPROCESSFLGNIL(ADD.PROCESS)ADD.PROCESSRESTARTABLETPROCESSPROPADD.PROCESSNAME(CARFLGFLGFORMPROP1VALUE1PROPNVALUENFORMFORMFORM|\8 i #xW  "%1' /04:'=6C%EH0V- XDX"&)+/>0z48=M@6ET  2#)2. 5/9<>CE/R  qUmBn '+-R157z9 @B Q< /2 '+:/ 026i9;/ADGO   '4*-^2 9&<?C M  } $H *.J38=:J  AY" #(-/2d39;>w@E%IF H 1"` (,W1 8=?EG # u %(*n-/T2V48:=jDC5 Bv#(Q**/3479?BdFGlAO" &)l 1[47-:-< C"D2F?B>#M&,Q/-1 :@DBG> %'+a/ 7\:$&Q+-/o3P47"9<>Z DFy9Y"#&)C-\035h:>? FM7!2"b%U(=),`0147;H06  "F%5&)g-BDZF4hbH*-1bC5 /M!a%(o-0,37YCE u:o7U "$&(').*.48+:?RB' ' ,/0579;w=?BD $& ~V#%&+,/?325s:&=?B)J"}`m$xD B1?:p 7= 6 2X >4h 1b .k)l'"; / 4X ,b ! 2v"A $w E"}`m$VxDzB+-j   "k$T(*,./1^3GW,n-Nf)*<=i} ,`m$TCreatingandDestroyingProcesses.maypackthenamewithanumbertomakeitunique.ThisnameissolelyfortheconvenienceofmanipulatingprocessesatLisptypein;e.g.,thenamecanbegivenastheargumenttomostprocessfunctions,andthenameappearsinmenusofprocesses.However,programsshouldnormallyonlydealinprocesshandles,bothforeciencyandtoavoidtheconfusionthatcanresultiftwoprocesseshavethesamedeningform.Ifthevalueisnon-,thenewprocessiscreatedbutthenimmediatelysuspended;i.e.,theprocessdoesnotactuallyrununtilwokenbya(below).[NoSpreadFunction]Usedtogetorsetthevaluesofcertainpropertiesofprocess,inamanneranalogousto.Ifissupplied(includingifitis),propertyisgiventhatvalue.Inallcases,returnstheoldvalueoftheproperty.Thefollowingpropertieshavespecialmeaningforprocesses;allothersareuninterpreted:Valueisalitatomusedforidentifyingtheprocesstotheuser.Valueisaagindicatingthedispositionoftheprocessfollowingerrorsorhardresets:or(thedefault)Ifanuntrappederror(orcontrol-Eorcontrol-D)causesitsformtobeexited,theprocessisdeleted.Theprocessisalsodeletedifa(orcontrol-Dfrom)occurs,causingtheentireProcessworldtobereinitialized.orTheprocessisautomaticallyrestartedonerrorsor.Thisisthenormalsettingforpersistent``background''processes,suchasthemouseprocess,thatcansafelyrestartthemselvesonerrors.Theprocessisdeletedasusualifanerrorcausesitsformtobeexited,butitrestartedona.Thissettingispreferredforpersistentprocessesforwhichanerrorisanunusualcondition,onethatmightrepeatitselfiftheprocessweresimplyblindlyrestarted.ValueistheLispformusedtostarttheprocess(readonly).ValueindicatesthedispositionoftheprocessfollowingaresumptionofLispaftersomeexit(,,).Possiblevaluesare:Deletetheprocess.2)ADD.PROCESSSUSPENDNILWAKE.PROCESS(PROCESSPROP)WINDOWPROPNILNAMERESTARTABLENILNOHARDRESETRAIDTYESHARDRESETHARDRESETisHARDRESETFORMAFTEREXITLOGOUTSYSOUTMAKESYSDELETEFORMPROCPROCPROPNEWVALUEPROCNEWVALUEPROP|b'0$'b .Ux\A +/$258<:=BDHZ~ #')A--/x1 9; CX~ 2$'*'-0q2c67>DFWO~ b &),/46;)< CU~!&&,/*2138>CACT~O #&h,/2T677:x@CFcR^~ M~!#h$*9+7-057@<'>B L ~ #\&)T.2<5$:=AnFEHJh&Gb<CE7^ 9"n$)(*/ 67@ACDD.'~(34:m A0BD]HBq!#"&).03*7J<@>AEG@k%l +/ 3u8;- ACxG?& < ~r "&),' 35n:=;>G7v~!"A$ +c- 469=DH5~21% "')L+,157G;=E>CE/ "%').T057=m@uEvG- $&\/2 68d?7@GD,4 "c&L+&/02 ).' "'( 1H68<EF% !#(-"/l 5 > DH0$= "c&+.1559G @1B5 "'s(-u/2358=>B CEp "%+-67;6?AjGG  &7,;.2489;@ G4 "&*.I/26:#>C= ~r #9&P),.148 ~b$'M .(/26<= EFK~"G$*t0Z78=B $h&)J!}p`m$x\A" OYM'Jh~ Gb &D F< 9 2~ J-';).~'>i!8~{$Bx/KK%i+O16F~}p`m$`x\A~_X:&<Gb"$E<>D*Q.z0XBqj\}(`m$:Suspendtheprocess;i.e.,donotletitrununtilitisexplicitlywoken.Causetheprocesstobesuspendedwaitingfortheevent(pageX.XX).Valueisafunctionorformusedtoprovideinformationabouttheprocess,inconjunctionwiththeprocessstatuswindow(pageX.XX).Valueisawindowassociatedwiththeprocess,theprocess's``main''window.Usedinconjunctionwithswitchingthettyprocess(pageX.XX).Valueisafunctionthatisappliedtotheprocesswhentheprocessismadethettyprocess(pageX.XX).Valueisafunctionthatisappliedtotheprocesswhentheprocessceasestobethettyprocess(pageX.XX).[Function]Returnsthehandleofthecurrentlyrunningprocess,oriftheProcessworldisturnedo.[Function]Deletesprocess.maybeaprocesshandle(returnedby),oritsname.Notethatifisthecurrentlyrunningprocess,doesnotreturn![Function]Terminatesthecurrentlyrunningprocess,causingitto``return''.Thereisanimplicitaroundtheargumentgivento,sothatnormallyaprocesscannishbysimplyreturning;issuppliedforearliertermination.[Function]Ifhasterminated,returnsthevalue,ifany,thatitreturned.Thisiseitherthevalueofaorthevaluereturnedfromtheformgivento.Iftheprocesswasaborted,thevalueis.Ifistrue,blocksuntilnishes,ifnecessary;otherwise,itreturnsimmediatelyifisstillrunning.Notethatmustbetheactualprocesshandlereturnedfrom,notaprocessname,astheassociationbetweenhandleandnamedisappearswhentheprocessnishes(andtheprocesshandleitselfisthengarbagecollectedifnooneelsehasapointertoit).[Function]Trueifhasterminated.Thevaluereturnedisanindicationofhowitnished:or.3SUSPENDINFOHOOKWINDOWTTYENTRYFNTTYEXITFN(THIS.PROCESS)NIL(DEL.PROCESS)ADD.PROCESSDEL.PROCESS(PROCESS.RETURN)PROCESS.RETURNADD.PROCESSPROCESS.RETURN(PROCESS.RESULT)PROCESS.RETURNADD.PROCESSNILPROCESS.RESULTNILADD.PROCESS(PROCESS.FINISHEDP)NORMALERRORPROC_PROCPROCPROCVALUEVALUEFORMPROCESSWAITFORRESULTPROCESSWAITFORRESULTPROCESSPROCESSPROCESSPROCESSPROCESSxZ %'-/1|3579<=?U E%W~U #&:*,y.I49;=A|EQ<~{ " ')i,016 >hBPDO~+ $'*.27;J~a !& -@0H279?D_IF~ (5+M1[35:>TD~y "'*k+02~49=s?DF!B~$(x>J~n !'l*4+0}2&49L<?TDH0<~m!&*g9C5 7'"$j&,17 ;=E?DHs6T3NC5 1I#(+-.3<7=zH0la"%o+-/5:.].+XC5 ) %*/467 ABFG( ',4 :A>I&g{!u"'*.r058 Hs$S" !C5 !B (v-/_3O47:?;ADEp,.14:>8@DRH0 "$b)&+13k7:;%'+6!;h< Ca  'V/139S<Fx#(Z-:;>?8DH03 %7),r00 6:<AF":%&*/:46O8R:=@ AHF GC5 "%/ ,/39o:= CEfH=!')J}`m$x\8~RLFA ?9 783N @1?J 0@ +X (  ? &g; ! +p $  8e%B 1f   T=.#"}`m$fx3N1!$&0&(+X]* )==> ?( /:0!]O #W* =/>]AH[%/$1(*?Ayx!}l`m$pProcessControlConstructs[Function]Trueifisthehandleofanactiveprocess,i.e.,onethathasnotyetnished.[Function]Trueifisthehandleofadeletedprocess.Thisisanalogousto.Itdiersfrominthatitnevercausesanerror,whilecancauseanerrorifitsargumentisnotaprocessatall.[Function]Unwindstoitstoplevelandreevaluatesitsform.Thisiseectivelyafollowedbytheoriginal.[Function]Mapsoverallprocesses,callingwiththreearguments:theprocesshandle,itsname,anditsform.[Function]Ifisaprocesshandleorthenameofaprocess,returnstheprocesshandleforit,else.Ifis,generatesanerrorifisnot,anddoesnotname,aliveprocess.1.2ProcessControlConstructs[Function]Yieldscontroltothenextwaitingprocess,assuminganyisreadytorun.Ifisspecied,itisanumberofmillisecondstowaitbeforereturning(inwhichcaseisverymuchlike),or,meaningwaitforever(untilexplicitlywoken).Alternatively,canbegivenasamillisecondtimer(asreturnedby)ofanabsolutetimeatwhichtowakeup.Inanyofthosecases,theprocessentersthestateuntilthetimelimitisup.withnoargumentsleavestheprocessinthestate,i.e.,itreturnsassoonaseveryotherrunnableprocessofthesamepriorityhashadachance.[Function]Explicitlywakesprocess,i.e.,makesit,andcausesitscallto(orotherwaitingfunction)toreturn.Thisisonesimplewaytonotifyaprocessofsomehappening;however,notethatifisappliedtoaprocessmorethanoncebeforetheprocessactuallygetsitsturntorun,itseesonlythelatest.[Function]Blocksprocessindenitely,i.e.,willnotrununtilitiswokenbya.Thefollowingthreefunctionsallowaccesstothestackcontextofsomeotherprocess.Theyrequirealittlebitofcare,andarecomputationallynon-trivial,buttheydoprovideamorepowerfulwayofmanipulatinganotherprocessthanallows.[Function]Performsinthestackcontextof.4(PROCESSP)(RELPROCESSP)RELSTKPPROCESS.FINISHEDPPROCESS.FINISHEDP(RESTART.PROCESS)DEL.PROCESSADD.PROCESS(MAP.PROCESSES)(FIND.PROCESS)NILT(BLOCK)BLOCKDISMISSTSETUPTIMERwaitingBLOCKrunnable(WAKE.PROCESS)runnableBLOCKWAKE.PROCESS(SUSPEND.PROCESS)WAKE.PROCESSWAKE.PROCESS(PROCESS.EVALV)(EVALV)PROCPROCPROCHANDLEPROCHANDLEPROCPROCPROCMAPFNMAPFNPROCERRORFLGPROCERRORFLGPROCMSECSWAITTIMERMSECSWAITTIMERPROCSTATUSPROCSTATUSSTATUSPROCPROCPROCPROCVARVARPROC|b'!k&{+ x\AC5 Z!5#()+/47\:<?CACWC5 U&!'*8.027 <@AH0TJof#J57|:d;?D FR)n,(0 2,57]>DtFHP]MC5 LT!t#f%(=+. 68/<@CA HJ O%'*F8GC5 F]}t %/36 =@*ED]fz/!AXC5 ?7s$U(*-11249F>@xEZ>  *-/.4'6"9?ACFB6D;H\0RM &')J*i/13 8:=}AG."u#'*3578>JATF - " 03J5f9E; S,X3 .-6+a {)'x@{(-x#j {!2ZxE&y5 ( 5  k n%,}p `m$x\ASDZF8WUR9h;ZM4&LTGF*9AX!?!> "N%Q)>; <30Rc-+;#j[<!%x'j -/H0)-|(4&!/0 x\ "P#46z!}`m$[Function]Evaluatesinthestackcontextof.Ifistrue,blocksuntiltheevaluationreturnsaresult,elseallowsthecurrentprocesstoruninparallelwiththeevaluation.Anyerrorsthatoccurwillbeinthecontextof,sobecareful.Inparticular,notethatandbehavequitedierentlyifcausesanerror.AnditisquitepermissibletointentionallycauseanerrorinprocbyperformingIferrorsarepossibleandistrue,thecallershouldalmostcertainlymakesurethattrapstheerrors;otherwisethecallercouldendupwaitingforeverifunwindsbackintothepre-existingstackcontextof.[Function]Performsinthestackcontextof.Notesamewarningsaswith.1.3EventsAn``event''isasynchronizingprimitiveusedtocoordinaterelatedprocesses,typicallyproducersandconsumers.Consumerprocessescan``wait''onevents,andproducers``notify''events.[Function]Returnsaninstanceofthedatatype,tobeusedastheeventargumenttofunctionslistedbelow.isarbitrary,andisusedfordebuggingorstatusinformation.[Function]Suspendsthecurrentprocessuntilisnotied,oruntilatimeoutoccurs.Ifis,thereisnotimeout.Otherwise,timeoutiseitheranumberofmillisecondstowait,or,ifis,amillisecondtimersettoexpireatthedesiredtimeusing(seepageX.XX).[Function]Ifthereareprocesseswaitingfortooccur,causesthoseprocessestobeplacedintherunningstate,withreturnedasthevaluefrom.Ifistrue,onlyrunstherstprocesswaitingfortheevent(thisshouldonlybedoneiftheprogrammerknowsthattherecanonlybeoneprocesscapableofrespondingtotheeventatonce).Themeaningofaneventisuptotheprogrammer.Ingeneral,however,thenoticationofaneventismerelyahintthatsomethingofinteresttothewaitingprocesshashappened;theprocessshouldstillverifythattheconceptualeventactuallyoccurred.Thatis,5(PROCESS.EVAL)(PROCESS.EVAL'(NLSETQ(FOO)))(NLSETQ(PROCESS.EVAL'(FOO)))FOO(PROCESS.EVAL'(ERROR!))(PROCESS.APPLY)(APPLY)PROCESS.EVAL(CREATE.EVENT)EVENT(AWAIT.EVENT)NILTSETUPTIMER(NOTIFY.EVENT)AWAIT.EVENTtheprocessshouldbewrittensothatitoperatesPROCFORMWAITFORRESULTFORMPROCWAITFORRESULTPROCPROCPROCPROCWAITFORRESULTFORMFORMPROCPROCFNARGSWAITFORRESULTFNARGSPROCNAMENAMEEVENTTIMEOUTTIMERPEVENTTIMEOUTTIMERPEVENTONCEONLYEVENTEVENTONCEONLYx\AC5 Z!#&y*)/8516LDFX u '+,137:S?CEH0WOw ('+-/$158f:Z< >nCCIUO?P! '*OI|B &+/}16]9;I<@ H0G ~"0$'):,].W A[8$46v:<@E|@?."*-0g4;=|A9E G>P&+x.1z363;->CUI;C5 9*T+.[16AH0' *,j 257;:="DF % "C5 !8#(1Z2809=A>pCH\!"&o'*/ 6<=ABH& r ?#%-0 12P 9=x?AEGGQt+-1AC5 Lz#N'/R048<]B2CE_ :#,2s4E6:G\H\P% $'9*l,/49;>eB2Ee( " */12 581;T=P@DE Z!#e'(  uZ"i +.-2p8r: B@DF+ Z  b/_$E%(g-B24;w=BG?   ^"g(+)J"}@`m$x\A ,%R ').LF -I'D ') ; /9l(8HR * ).'" 'S/5G" A #> { -/4b8:^>@CQD!}@`m$px\A!*${+'Z103"8 9;<C8WOEFR"P$BL) *D"P$BA'(,D2@?%&>!Q"1EF;x #t$'.9"N%!'&8M:?*'%""k!8+'vA"*',P }4`m$MonitorsInparticular,thecompletionofandrelatedoperationsineectwakesuptheprocessinwhichtheywereperformed,sincethereisnosecurewayofknowingwhethertheeventofinterestoccurredwhiletheprocesswasbusyperformingthe.Thereiscurrentlyoneclassofsystem-denedevents,usedwiththenetworkcode.EachPupandNSsockethasassociatedwithitaneventthatisnotiedwhenapacketarrivesonthesocket;theeventcanbeobtainedbycallingor,respectively.1.4MonitorsItisoftenthecasethatcooperatingprocessesperformoperationsonsharedstructures,andsomemechanismisneededtopreventmorethanoneprocessfromalteringthestructureatthesametime.Somelanguageshaveaconstructcalledamonitor,acollectionoffunctionsthataccessacommonstructurewithmutualexclusionprovidedandenforcedbythecompilerviatheuseofmonitorlocks.Interlisp-Dhastakenthisimplementationnotionasthebasisforamutualexclusioncapabilitysuitableforadynamically-scopedenvironment.Amonitorlockisanobjectcreatedbytheuserandassociatedwith(e.g.,storedin)somesharedstructurethatistobeprotectedfromsimultaneousaccess.Toaccessthestructure,aprogramwaitsforthelocktobefree,thentakesownershipofthelock,accessesthestructure,thenreleasesthelock.Thefunctionsandmacrosbelowareused:[Function]Returnsaninstanceofthedatatype,tobeusedasthelockargumenttofunctionslistedbelow.isarbitrary,andisusedfordebuggingorstatusinformation.[Macro]Evaluateswhileowning.Valueisthelastof.Thisconstructisimplementedsothatthelockisreleasedeveniftheformisexitedviaerror(currentlyimplementedwith).Ownershipofalockisdynamicallyscoped:ifthecurrentprocessalreadyownsthelock(e.g.,ifthecallerwasitselfinsideaforthislock),isanoop.[Macro]Like,butimplementedwithoutthe.Userinterrupts(e.g.,control-E)areinhibitedduringtheevaluationof.Programmingrestriction:theevaluationofmustnoterror(thelockwouldnotbereleased).Thisconstructismainlyusefulwhenisasmall,safecomputationthatnevererrorsandneedneverbeinterrupted.[Function]Foruseinblockinginsideamonitor.Performs,butreleasesrst,andreobtainsthelock(possiblywait-ing)onwakeup.Typicalusefor:Afunctionwantstoperformsomeoperationon,butonlyifitisinacertainstate.Ithastoobtainthelockonthestructuretomakesurethatthestateofthe6correctlyevenifwokenupbeforethetimeoutandintheabsenceofthenotiedevent.PROCESS.EVALPROCESS.EVAL(PUPSOCKETEVENT)(NSOCKETEVENT)(CREATE.MONITORLOCK)MONITORLOCK(WITH.MONITOR.)(PROGN.)RESETLSTWITH.MONITORWITH.MONITOR(WITH.FAST.MONITOR.)WITH.MONITORRESETLST(MONITOR.AWAIT.EVENT)(AWAIT.EVENT)MONITOR.AWAIT.EVENTPUPSOCKETNSOCKETNAME_NAMELOCKFORMSFORMSLOCKFORMSLOCKFORMSFORMSFORMSFORMSRELEASELOCKEVENTTIMEOUTTIMERPEVENTTIMEOUTTIMERPRELEASELOCKFoo|b'&x\:>@ GZ  W $ +:,0469=?|CFX 2v3 #%k+&0368=CGWI d (FTD Gf!&+.249>ADGqR ? j(@"%&+/05}:CF+P  &3IOR |J ixF  9 z| $) 0826L <?JBD  K6$',/446m8? P "b#(s. 4:L ;G s oA!7#&)4 /25:<<?D%9  K 3 #(+/!1 78>B%DuF7   R" %[*, 36&;.=A C6V  OX3QC5 1"$n0n6D79<>@C0Se"%+-Q 3h677; =aD.F ._ +ZD)*.Q7-8 ;=k?BJI(F (*Y-/@23^8;<?"BeCG&i Q (2p3:<=@B9 $s$).2586;=L?CF#&M(+'9:< Dr$ %"' 0b5>@ C  k"(-/^ 5< * &$( /.6x9<`?BE"4X "9%+-;16E?ABG| !K%)+/24 wC5  Q ":#c& ' ,+ .0358b;=@Fnbg %#H$5%+.059G?\CDWF  h `)n 5$[&),.4V69=?BaEG)J!}@`m${\: dj %(*U,13x5:xZ WI1 P15 H*3Q !R1& +Z !)")A&i+# .  %r 8>w ::2o + Q}@0`m$~xP)?AM3Q0&+Z)$B%#3,4 DD  !7801":+; w"',4=[C+% ,| AQBB"} p`m$nstructuredoesnotchangebetweenthetimeitteststhestateandperformstheoperation.Ifthestateturnsouttobebad,itthenwaitsforsomeotherprocesstomakethestategood,meanwhilereleasingthelocksothattheotherprocesscanalterthestructure.Itissometimesconvenientforaprocesstohaveatitstoplevelandthendoallitsinterestingwaitingusing.Notonlyisthisoftencleaner,butinthepresentimplementationincaseswherethelockisfrequentlyaccessed,itsavestheoverheadof.Programmingrestriction:theremustnotbeanbetweentheenclosingandthecalltosuchthatthewouldcatchanandcontinueinsidethemonitor,forthelockwouldnothavebeenreobtained.(Thereasonforthisrestrictionisthat,althoughwon'titselferror,theusercouldhavecausedanerrorwithaninterrupt,orainthecontextofthewaitingprocessthatproducedanerror.)Onrareoccasionsitmaybeusefultomanipulatemonitorlocksdirectly.Thefollowingtwofunctionsareusedintheimplementationof:[Function]Takespossessionof,waitingifnecessaryuntilitisfree,unlessistrue,inwhichcaseitreturnsimmediately.Ifistrue,performsatobeunwoundwhentheenclosingexits.Returnsifwassuccessfullyobtained,ifthecurrentprocessalreadyowned.[Function]Releasesifitisownedbythecurrentprocess,andwakesupthenextprocess,ifany,waitingtoobtainthelock.Whenaprocessisdeleted,anylocksitownsarereleased.1.5GlobalResourcesThebiggestsourceofproblemsinthemulti-processingenvironmentisthematterofglobalresources.Twoprocessescannotbothusethesameglobalresourceiftherecanbeaprocessswitchinthemiddleoftheiruse(currentlythismeanscallsto,butultimatelywithapreemptiveschedulermeansanytime).Thus,usercodeshouldbewaryofitsownuseofglobalvariables,ifitevermakessenseforthecodetoberuninmorethanoneprocessatatime.``State''variablesprivatetoaprocessshouldgenerallybeboundinthatprocess;structuresthataresharedamongprocesses(orresourcesusedprivatelybutexpensivetoduplicateperprocess)shouldbeprotectedwithmonitorlocksorsomeotherformofsynchronization.Asidefromusercode,however,therearemanyglobalvariablesandresources.Mostofthesearisehistoricallyfromthesingle-processInterlisp-10environment,andwilleventuallybechangedinInterlisp-Dtobehaveappropriatelyinamulti-processingenvironment.Somehavealreadybeenchanged,andaredescribedbelow.Twootherresourcesnotgenerallythoughtofasglobalvariablesthekeyboardandthemouseareparticularlyidosyncratic,andarediscussedinthenextsection.7(WITH.MONITOR(untildo(MONITOR.AWAIT.EVENT)))WITH.MONITORMONITOR.AWAIT.EVENTRESETLSTWITH.MONITORERRORSETWITH.MONITORMONITOR.AWAIT.EVENTERRORSETERROR!MONITOR.AWAIT.EVENTPROCESS.EVALWITH.MONITOR(OBTAIN.MONITORLOCK)NILRESETSAVERESETLSTT(RELEASE.MONITORLOCK)BLOCKsystemFooLockcondition-of-FooFooLockEventFooChangedtimeoutoperate-on-FooLOCKDONTWAITUNWINDSAVELOCKDONTWAITUNWINDSAVELOCKLOCKLOCKLOCKLOCKx\: !T$h%(*.068 ?x@C8FWZ  _  `: $g)6*.04"7>DFX  zsC!L M    |#%357:)=@sCEHLM )*-{02L58>@BE J  #%} ,\2{47AH&IE  7 #1%2.36jG(DW  k!$'159AeD<B |x"%), 48 <>A HsA  #\',*._037:?`AWDG?e 6!&c(*x/G46<><`  A YS;I ( -?06#8>AG:  %/ &7C5 6l &'`,-f3`679'<:Hs4jy"u#+ 3?\@D2!]#C)T,/R<@.1q &~-/<16^;-?Hi.C5 ,s |!#$k(*,169s=k?lAD*!_%'' )c) !%}'|#d ix  "a% , 46|8=t?MC Y  $u#k'-.2 467<ABE:  F i7"(), 3M67 ?IE R7=!$}&C(++;-/3 9;@<?CGh  i^+!&()-28=_?,@vEe hW %}(3*n.3&9;-AD2  8"'))1/Y27;q=L@DH&w q  b #$+$/847 >A~C*F Y6 $V&" .m1 3 :;A=B H; &  z  &b /93$6;i>DG ?!/#)r.0715 <>DG o  #M%+-O/2)J"}`m$xU TD qR H7PM) LMJ:xI E'2<~ DW*B;A ?e : 7 14j(~25L1,. ${q&}`m$dxU|5TDS YzR!r"?"'y)*i+,x3BPd7%(0 6"#x@EE4j5j<2EXF91DhEH.q,s!} `m$vTypeinandtheTTYProcessThefollowingresources,whichareglobalinInterlisp-10,areallocatedperprocessinInterlisp-D:primaryinputandoutput(thestreamsaectedbyand),terminalinputandoutput(thestreamsdesignatedbythename),theprimaryreadtableandprimaryterminaltable,anddribbleles.Thus,eachprocesscanprinttoitsownprimaryoutput,printtotheterminal,readfromadierentprimaryinput,allwithoutinterferingwithanotherprocess'sreadingandprinting.Eachprocessbeginslifewithitsprimaryandterminalinput/outputstreamssettoadummystream.Iftheprocessattemptsinputoroutputusinganyofthosedummystreams,e.g.,bycalling,or,attywindowisautomaticallycreatedfortheprocess,andthatwindowbecomestheprimaryinput/outputandterminalinput/outputfortheprocess.Thedefaultttywindowiscreatedatorneartheregionspeciedinthevariable.Aprocesscan,ofcourse,callexplicitlytogiveitselfattywindowofitsownchoosing,inwhichcasetheautomaticmechanismnevercomesintoplay.Callingwhenaprocesshasnottywindownotonlysetstheterminalstreams,butalsosetstheprimaryinputandoutputstreamstobethatwindow,assumingtheywerestillsettothedummystreams.[Function]Returnsiftheprocesshasattywindow;otherwise.Ifis,itdefaultstothecurrentprocess.Othersystemresourcesthataretypicallychangedby,,areallglobalentities.Inthemultiprocessingenvironment,theseconstructsaresuspect,asthereisnoprovisionfor``undoing''themwhenaprocessswitchoccurs.Forexample,inthecurrentreleaseofInterlisp-D,itisnotpossibletosettheprintradixto8insideonlyoneprocess,astheprintradixisaglobalentity.Notethatandsimilarexpressionsareperfectlyvalidintheprocessworld,andevenquiteuseful,whentheymanipulatethingsstrictlywithinoneprocess.Theprocessworldisarrangedsothatdeletingaprocessalsounwindsanyexpressionsthatwereperformedintheprocessandarestillwaitingtobeunwound,exactlyasifacontrol-Dhadresettheprocesstothetop.Additionally,thereisanimplicitatthetopofeachprocess,sothatcanbeusedasawayofproviding``cleanup''functionsforwhenaprocessisdeleted.Forthese,thevalueof(pageX.XX)isiftheprocessnishednormally,ifitwasabortedbyanerror,iftheprocesswasexplicitlydeleted,andiftheprocessisbeingrestarted(afteraora).1.6TypeinandtheTTYProcessThereisoneglobalresource,thekeyboard,thatisparticularlyproblematictoshareamongprocesses.Consider,forexample,havingtwoprocessesbothperforming.Sincethekeyboardinputroutinesblockwhilethereisnoinput,bothprocesseswouldspendmostoftheirtimeblocking,anditwouldsimplybeamatterofchancewhichprocessreceivedeachcharacteroftypein.Toresolvesuchdilemmas,thesystemdesignatesadistinguishedprocess,termedthe,thatisassumedtobetheprocessthatisinvolvedinterminalinteraction.Anytypeinfromthekeyboardgoestothatprocess.Ifaprocessotherthanthettyprocessrequestskeyboardinput,itblocksuntilitbecomesthettyprocess.Whenthettyprocessisswitched(inanyofthewaysdescribedfurtherbelow),anytypeaheadthatoccurredbeforetheswitchissavedandassociatedwiththecurrentttyprocess.Thus,itisalwaysthecasethatkeystrokesaresenttotheprocessthatisthettyprocessatthetimeofthekeystrokes,regardlessofwhenthatprocessactuallygetsaroundtoreadingthem.8INPUTOUTPUTT(READT)(PRINT&T)DEFAULTTTYREGIONTTYDISPLAYSTREAMTTYDISPLAYSTREAM(HASTTYWINDOWP)TNILNILRESETFORMRESETLSTRESETVARSRESETFORMRESETxxxRESETLSTRESETSAVERESETSTATENILERRORRESETHARDRESETHARDRESETRESTART.PROCESS(READT)ttyprocessPROCPROCPROC|b' %x(*r-x\:   4#E$ *L,|.4r6;=6 BDZ  X!(0R17-:=BDX ;F"&),U17:=BF WI  6!G#$q)Z,.17 :@=?DU   #)g.W1 R  kIA)#j&.+ 49;+<>C?H\P  uo&!%R()-38;=IOR 6i (W-)/q179<AGM  \ '),Y149";2@WAFHL  `AK/I +h 1z3W6r9;T=BDFG\ !u(,v037E  !$'+).4169m<>\CG(D ZI0%'(4+. 0;14E9WA C5 ?et * ,-/8l ?EI= !%:  3"'1R8ACE9 { &n* 038X:&=?YA~G7o a&bD"'*H0,14\94=? DG Hs5  ^Hc% W!%(+H0o24y7;c<=B2  t|F '&)/L246;@5BFW1 v@e  %\),v249=?iE7G/x 4hC' .15;=?DG-  ~8 "$T%*H,.2Z49;>1A ,-  )b!$q&H).0;>@CEG*   !$&+,2)48;a?!(  X*$U/70149;=FG'< x d'u(+E015d;>H% |!1 iMx m.%(*8 1 9T;&>C ' Wt O&x) 79=t@F6 J"4%+/37V9#<}?EH q 6$@).x179A  $*! (O) 172;DEHs0 pW K#%* 2C5=9m<?"EH0  d}<"'$'(.)489S=@AG  >F]%P'i)+-1C7\;@CU?  Qu"3$ +;.J05Z7a<@{AC(G   8^\$&&(P*,1{3 5c8:1< C  U!#%3*#)J"} `m$,xZ#+GXPBHGSOR JL"}ICG\;A ?e5dF|:)292T/x M,-O3*@ (*|Ab'<W?% '1>6I{>e@ } `m$nxA x?e%'@B} `m$Itislessimmediatelyobvioushowtohandlekeyboardinterruptcharacters,astheiractionisasynchronousandnotalwaystiedtotypein.InterrupthandlingisdescribedonpageX.XX.1.6.1SwitchingtheTTYProcessAnyprocesscanmakeitselfbethettyprocessbycalling.[Function]Returnsthehandleofthecurrentttyprocess.Inaddition,ifisnon-,makesitbethettyprocess.Thespecialcaseof=isinterpretedtomeantheexecutiveprocess;thisissometimesusefulwhenaprocesswantstoexplicitlygiveupbeingthettyprocess.[Function]Trueifisthettyprocess;defaultstotherunningprocess.Thus,istrueifthecalleristhettyprocess.[Function]Ecientlywaitsuntilistrue.iscalledinternallybythesystemfunctionsthatreadfromtheterminal;usercodethusneedonlycallitinspecialcases.Insomecases,suchasinfunctionsinvokedasaresultofmouseactionorauser'styped-incall,itisreasonableforthefunctiontoinvokeitselfsothatitcantakesubsequentusertypein.Inothercases,however,thisistooundisciplined;itisdesirabletolettheuserdesignatewhichprocesstypeinshouldbedirectedto.Thisismostconvenientlydonebymouseaction.Thesystemsupportsthemodelthat``totypetoaprocess,youclickinitswindow.''Tocooperatewiththismodel,anyprocessdesiringkeyboardinputshouldputitsprocesshandleasthepropertyofitswindow(s).Tohandlethecommoncase,thefunctiondoesthisautomaticallywhenthettydisplaystreamisswitchedtoanewwindow.Aprocesscanownanynumberofwindows;clickinginanyofthosewindowsgivestheprocessthetty.Thismechanismsucesformostcasualprocesswriters.Forexample,ifaprocesswantsallitsinput/outputinteractiontooccurinaparticularwindowthatithascreated,itshouldjustmakethatwindowbeitsttywindowbycalling.Thereafter,itcanorto/fromthestream;iftheprocessisnotthettyprocessatthetimethatitcalls,itwillblockuntiltheuserclicksinthewindow.Forthoseneedingtightercontroloverthetty,thedefaultbehaviorcanbeoverriddenorsupplemented.Theremainderofthissectiondescribesthemechanismsinvolved.Thereisawindowpropertythatcontrolswhetherandhowtoswitchthettytotheprocessowningawindow.Themousehandler,beforeinvokinganynormal,specicallynoticesthecaseofabuttongoingdowninawindowthatbelongstoaprocess(i.e.,hasawindowproperty)thatisnotthettyprocess.Inthiscase,itinvokesthewindow'sofoneargument().defaultsto:[Function]Ifhasaproperty,performsandtheninvokes'sfunction9TTY.PROCESS(TTY.PROCESS)NILT(TTY.PROCESSP)(TTY.PROCESSP)(WAIT.FOR.TTY)(TTY.PROCESSP)WAIT.FOR.TTYTTY.PROCESSPROCESSTTYDISPLAYSTREAMTTYDISPLAYSTREAMPRINTREADTREADWINDOWENTRYFNBUTTONEVENTFNPROCESSWINDOWENTRYFNWINDOWENTRYFNGIVE.TTY.PROCESS(GIVE.TTY.PROCESS)PROCESS(TTY.PROCESS(WINDOWPROP'PROCESS))BUTTONEVENTFNPROCPROCPROCPROCPROCPROCWINDOWWINDOWWINDOWWINDOWWINDOWx\:  N %  r$*0 7/8;?AQ Z  t4"}(3)/15 |V0 ipxQ  EO>!&{(u6NC5 M a#$'],D.v4.6< B0CIKz% "(*/\2O8;=Z DmF!I6$'w)/4796>)B*C H/xP!#E*C5 C Z!$&16]8::@)F A"$?' (*./2V4f>C5 =3 ?/0>?C ;%(b+.1c7d:h=@D0GT96  v[ r%'(,.37H9*:r>cB+CFHs5= +:.03`47i:t ADG3  vR=g (*L+13a5k7:@E1 ! # +/S1M5.  SW r"%'(. 04(57>K@}F-F  $#',.0j5?9;yDG+   _ yS"&'(v;>Ar )  -i!#l$'-/L4569<AC(U HF!$(+?%P  w!&Y+Q-345:h> ?A # ~G %()s,1B27G:=@EH"  $% ,-5*:?CH} ^  V2( /"%(*0w1_25w9@<>AEG   C~!$'&)-3c57 >@   S B"$$ ,1 '\*E/47:<A CEGc cs!&Z*02B/B  *9b#%&,1/!4K67i<\?B+ 7j %'*}-//446H&q  }&m+: lC5 !)?/E !&)E,c7Dh)J }`m$xQ, N M F|Kz:E* A > =3#a 4( 5=!c -F=+-"`0z6BJ ^- c7C Cw< q -B l V "5/ @ ! 8 !}4`m$nxNM =?|Kz46E*C,Q.Cq2 l  ! !x1X6C!} 8`m$HHandlingofInterrupts(oriftherightbuttonisdown).Therearesomecaseswhereclickinginawindowdoesnotalwaysimplythattheuserwantstotalktothatwindow.Forexample,clickinginatexteditorwindowwithashiftkeyhelddownmeansto``shift-select''somepieceoftextintotheinputbuerofthettyprocess.Theeditorsupportsthisbysupplyingathatperformsifnoshiftkeyisdown,butgoesintoitsshift-selectmode,withoutchangingthettyprocess,ifashiftkeyisdown.Theshift-selectmodeperformsaoftheselectedtextwhentheshiftkeyisletup,thefeedinginputtothecurrentttyprocess.Sometimesaprocesswantstobenotiedwhenitbecomesthettyprocess,orstopsbeingthettyprocess.Forexample,Chat(pageX.XX)turnsoallkeyboardinterruptcharacterswhileitisthettyprocess,sothattheycanbepassedtransparentlytotheremotehost.Tosupportthis,therearetwoprocessproperties,and.Theactionstakenbywhenitswitchesthettytoanewprocessareasfollows:theformerttyprocess'siscalledwithtwoarguments();thenewprocessismadethettyprocess;nally,thenewttyprocess'siscalledwithtwoarguments().Normallytheandneedonlytheirrstargument,buttheotherprocessinvolvedintheswitchissuppliedforcompleteness.Inthepresentsystem,mostprocesseswanttointerpretthekeyboardinthesameway,soitisconsideredtheresponsibilityofanyprocessthatchangesthekeyboardinterpretationtorestoreittothenormalstatebyits.Awindowis``owned''bythelastprocessthatanyonegaveasthewindow'sproperty.Ordinarilythereisnoconicthere,asprocessestendtoowndisjointsetsofwindows(though,ofcourse,cooperatingprocessescancertainlytrytoconfuseeachother).Theonlylikelyproblemariseswiththatmostglobalofwindows,.Programsshouldnotbetemptedtoreadfrom.Thisisnotusuallynecessaryanyway,astherstattempttoreadfrominaprocessthathasnotsetitstoitsownwindowcausesattywindowtobecreatedfortheprocess(seepageX.XX).1.6.2HandlingofInterruptsAtthetimethatakeyboardinterruptcharacter(pageX.XX)isstruck,anyprocesscouldberunning,andsomedecisionmustbemadeastowhichprocesstoactuallyinterrupt.Totheextentthatkeyboardinterruptsarerelatedtotypein,mostinterruptsaretakeninthettyprocess;however,thefollowingarehandledspecially:,(normallycontrol-Dandcontrol-E)Theseinterruptsaretakeninthemouseprocess,ifthemouseisnotinitsidlestate;otherwisetheyaretakeninthettyprocess.Thus,control-Ecanbeusedtoabortsomemouse-invokedwindowaction,suchastheShapecommand.Asaconsequence,notethatifthemouseinvokessomelengthycomputationthattheuserthinksofas``background'',control-Estillabortsit,eventhoughthatmaynothavebeenwhattheuserintended.Suchlengthycomputations,forvariousreasons,shouldgenerallybeperformedbyspawningaseparateprocesstoperformthem.Theinterruptinaprocessotherthantheexecutiveisinterpretedexactlyasifanerrorunwoundtheprocesstoitstoplevel:iftheprocesswasdesignated=,itisrestarted;otherwiseitiskilled.10RIGHTBUTTONFNcurrentWINDOWENTRYFNGIVE.TTY.PROCESSBKSYSBUFBKSYSBUFTTYEXITFNTTYENTRYFNTTY.PROCESSTTYEXITFNTTYENTRYFNTTYENTRYFNTTYEXITFNTTYEXITFNPROCESSPROMPTWINDOWPROMPTWINDOWTTTYDISPLAYSTREAMRESETERRORRESETRESTARTABLETOLDTTYPROCESSNEWTTYPROCESSNEWTTYPROCESSOLDTTYPROCESS|b'"(* x\:$8%'+D/1Y5 U4!s#N$)-T/48;>ABENG)W  "$%(,2&5c69<?CH0U  = "&*,`3l5~:=AG>TD  6!568<>@DBFR  x$&).@/0368<^?:BGF P 9Y!$B'*\-z0135?DH0OR  ILM O;#=&(<-0'247X9<@QBDJ  , "D$&,2 9(<>t@BDI   #%(]-01;38;?B4EG\  $G%A(5,0<@BGE   i, #')79:=E@tC5D $2%(R+[0I158):X?DvFBk  6?!$b'E.'H@ V&'v+.n14;>A.E? :O " ,.05:>iDH0=y p"$_%' -0[ 8:|=AD;  IL !"g$&q+).W0Q98 ]jmN"%]*-.0=&C6 7)  cx{ e#z%( ,/s16<.=Bo 5 ,`!/$l).,/638CF. |* i_ x&#  *"(+0269f>WBBDS$}  A  |"1&D+,1 8J:x<AC" @; 'Q)-{/6139?AqG!1 5 ,e:"n'(, 35C8:<AF2Ge :!%g+.046E8:?CHs;eC $I(-37:<>C+ei !$%(M,159 ADFeK$E(*[-1(26*:=@C8FJe "C%* 3_5:X?CeT $%B*/d16de "y#(},/H179& @8DFG e[$0%'*9./f169L SeP %'N((!} `m$x\: {U.xTDe 'P8VG\ 2 E/Bk @ ;2*863( ; 2730 , @ @ SH"} `m$XxD eIlBk.6<$D } d4`m$ (Initiallycontrol-H)Amenuofprocessesispresentedtotheuser,whoisaskedtoselectwhichonetheinterruptshouldoccurin.Thecurrentttyprocessappearswitha*nexttoitsnameatthetopofthemenu.Themenualsoincludesanentry``[SpawnMouse]'',forthecommoncaseofneedingamousebecausethemouseprocessiscurrentlytieduprunningsomeone's;selectingthisentryspawnsanewmouseprocess,andnobreakoccurs.(Initiallycontrol-B)Performstheinterruptalwaysinthettyprocess.(Initially)Thisinterruptclearstypeaheadinprocesses.,,Theseinterruptsalwaysoccurinwhateverprocesswasrunningatthetimetheinterruptstruck.Inthecasesofand,thismeansthattheinterruptismorelikelytostrikeintheoendingprocess(especiallyifitisa``runaway''processthatisnotblocking).Note,however,thatthisprocessisstillnotnecessarilytheguiltyparty;itcouldbeaninnocentbystanderthatjusthappenedtouseupthelastofaresourceprodigiouslyconsumedbysomeotherprocess.1.7KeepingtheMouseAliveSincethewindowmousehandlerrunsinitsownprocess,itisnotavailablewhileawindow'sfunction(oranyoftheotherwindowfunctionsinvokedbymouseaction)isrunning.Thisleadstotwosortsofproblems:(1)alongcomputationunderneathadeprivestheuserofthemouseforotherpurposes,and(2)codethatrunsasacannotrelyonothersrunning,whichmeansthattheresomepiecesofcodethatrundierentlyfromnormalwhenrununderthemouseprocess.Theseproblemsareaddressedbythefollowingfunctions:[Function]Spawnsanothermouseprocess,allowingthemousetorunevenifitiscurrently``tiedup''underthecurrentmouseprocess.ThisfunctionisintendedmainlytobetypedinattheLispexecutivewhentheusernoticesthemouseisbusy.[Function]Performsaonlywhencalledunderneaththemouseprocess.Thisshouldbecalled(once,onentry)byanyfunctionthatreliesonsforcompletion,ifthereisanypossibilitythatthefunctionwillitselfbeinvokedbyamousefunction.Itneverhurts,atleastlogically,tocallorneedlessly,asthemouseprocessarrangestoquietlykillitselfifitreturnsfromtheuser'sandndsthatanothermouseprocesshassprungupinthemeantime.(Thereis,ofcourse,somecomputationalexpense.)1.8DebuggingProcesses[Function]Putsupawindowthatprovidesseveraldebuggingcommandsformanipulatingrunningprocesses.Ifthewindowisalreadyup,refreshesit.Ifisaposition,thewindowisplacedinthatposition;otherwise,11HELPBUTTONEVENTFNBREAKHELPRUBOUTallRAIDSTACKOVERFLOWSTORAGEFULLSTACKOVERFLOWSTORAGEFULLBUTTONEVENTFNBUTTONEVENTFNBUTTONEVENTFNBUTTONEVENTFN(SPAWN.MOUSE)(ALLOW.BUTTON.EVENTS)(SPAWN.MOUSE)BUTTONEVENTFNSPAWN.MOUSEALLOW.BUTTON.EVENTSBUTTONEVENTFN(PROCESS.STATUS.WINDOW)PROCESS.STATUS.WINDOW_WHEREWHEREx\:e !W%<&,.j46_8<?"@DmF Ze>"' *-E0-57(< A$DNEFXe\!;"%_),03j8:>_CWIe "['(-2548=?/E GUe*:+I037G<=O@MDSePe %a+1`57m9;Me # :%)0W3 J HIHeq "2%'-2y50:p<>ADGe( //<-=<@DGEe4H"#')M+16 =x>@GAB DWeB %)/2n59;q>@ GBeCM k"[$J)0125;=@B D~FHA e '0)*,0V|< ix8B  e& $&4(x+13T5*8>)BFC6b!#',279>PBDT4  o "/#Q&a .L 5BG3Q  1e! #%)+.0=ADDFA1LF#v&1)-&1+268;D AE%0  10 5$3*6,247/=; -C5 +Z %a*0d27j9@;?j@BrD) #;( ,h14:q;AF9G(`  #),/*2!69=m>% C5 #dg(,/3 :='AvF! !% '-+>-A/5e89;H  R!%G&)_ /25:=G@BGr m  zYU? ,]> EG C6!7$%'I+/]1ACG" ) "*$o+E/1R27: C| i;xXC5 =# &5, 07?A  #%(V-/4 g-$&I'P,/4 5V9;=Ca ("}p`m$x\: UM P 'M {2xJ $.!{G"'286 46 3Q1 1 - 7% #d != m" .75 X " 7!}p `m$fx-X? gY } `m$Non-ProcessCompatibilitytheuserispromptedforaposition.Thewindowconsistsoftwomenus.Therstisamenuofalltheprocessesatthemoment.Commandsinthesecondmenuoperateontheprocessselectedintherstmenu.Thecommandsare:,,,Performsabacktraceoftheselectedprocess.Thersttime,itpromptsforawindowinwhichtodisplaythebacktrace.Changestheselectiontothettyprocess,i.e.,theonecurrentlyincontrolofthekeyboard.Associatesthekeyboardwiththeselectedprocess;i.e.,makestheselectedprocessbethettyprocess.Iftheselectedprocesshasan,callsit.Thehookmaybeafunction,whichisthenappliedtotwoarguments,theprocessandthebutton(or)usedtoinvoke,oraform,whichissimply'ed.Theorhappensinthecontextoftheselectedprocess,usingor.Theinfohookcanbesetusing.Deletestheselectedprocess.Restartstheselectedprocess.Wakestheselectedprocess.Promptsforavaluetowakeitwith(see).Suspendstheselectedprocess;i.e.,causesittoblockindenitely(untilexplicitlywoken).Enterabreakundertheselectedprocess.Thishasthesideeectofwakingtheprocesswiththevaluereturnedfromthebreak.Currently,theprocessstatuswindowrunsunderthemouseprocess,likeothermenus,soifthemouseisunavailable(e.g.,amousefunctionisperforminganextensivecomputation),youmaybeunabletousetheprocessstatuswindow(youcantry,ofcourse).1.9Non-ProcessCompatibilityThissectiondescribessomeconsiderationsforauthorsofprogramsthatranintheoldsingle-processInterlisp-Denvironment,andnowwanttomakesuretheyrunproperlyintheMulti-processingworld.Thebiggestproblemtowatchoutforiscodethatrunsunderneaththemousehandler.Writersofmousehandlerfunctionsshouldrememberthatintheprocessworldthemousehandlerrunsinitsownprocess,andhence(a)youcannotdependonndinginformationonthestack(stashitinthewindowinstead),and(b)whileyourfunctionisrunning,themouseisnotavailable(ifyouhaveanynon-trivialcomputationtodo,spawnaprocesstodoit,notifyoneofyourexistingprocessestodoit,oruseto12BTBTVBTV*BTV!WHO?KBD_INFOINFOHOOKLEFTMIDDLEINFOEVALAPPLYEVALPROCESS.APPLYPROCESS.EVALPROCESSPROPKILLRESTARTWAKEWAKE.PROCESSSUSPENDBREAKSPAWN.MOUSEPROCESS.EVAL|b'!$) x\:L#%'Y5r#%{(5-I0.24y59;f=d?EGWw#%V',204699>C"DGU$R;Q>~!k"(*,2#7:x=D@B-GO~!#z')1-0= L~! #h) *-/)4R69D;ACvH&J~G~ "#$*-0r5;.=B9DFC~ N"=$&C=~7%,*3,56:<?CTFHA~!&'+.0a2\5S <?`D}G?~$9++/*089s;/L"v*06k8];@BD<~ /;{:B CG.%)~!$})/278:> F (U~ !a%P~D j$;(8*/5 8 :<?CoE%#~"%( +1\47 ~ #'*.s36E9>@^ADHs <D!A ({*y0t 9K<?AEGjY  I@+-,-| i_o x  3 $'W,m.T47:0< >A1E U Tk"$(f+s.1A68;> ED  Zzi! "r%(v+ 259n>CE \"$_&+/m16; >6?AD  in n? -$ ,3."0j378:b<AG( S  8BB"N&(/*0x2a5%8y;(=A   (Pz!w$%) .4 579e;&H0(!}(`m$^xRx LGC=/? _%5A>L~%,<$@ 1f ;!@ 740K.~ +%PY! = !}(`m$Xrunitundersomeotherprocess).Thefollowingfunctionsaremeaningfuleveniftheprocessworldisnoton:(invokesthesystembackgroundroutine,whichincludeshandlingthemouse);,(bothreturn);and(returns,i.e.,anyoneisallowedtotakettyinput).Inaddition,thefollowingtwofunctionsexistinbothworlds:[Function]Sameas,whenprocessesarerunning,whennot.Thisishighlyrecommendedformousefunctionsthatperformanynon-trivialactivity.[Function]Sameas,whenprocessesarerunning,whennot.Mostoftheprocessfunctionsthatdonottakeaprocessargumentcanbecalledevenifprocessesaren'trunning.creates,butdoesnotrun,anewprocess(itrunswheniscalled).13BLOCKTTY.PROCESSTHIS.PROCESSNILTTY.PROCESSPT(EVAL.AS.PROCESS)(ADD.PROCESS'RESTARTABLE'NO)EVAL(EVAL.IN.TTY.PROCESS)(PROCESS.EVAL(TTY.PROCESS))EVALADD.PROCESSPROCESSWORLDFORMFORMFORMWAITFORRESULTFORMWAITFORRESULTx\:   dY5  5 "s%'%).`2P36<=CEfW p%(6BEU q  !$"(*"/035:%;ACTD  hQ>C5 O;M<A GM Z$7'*,0 :%1IHC5 G2EbF+E(A+B  v2he6!?#&',25j7^;W>@FAQ #9!%E'+,h/469Hs? (!}T`m$xY58W-N 7h U u Q> pO - 7MNIH ,G ' DE$`AQ1 = }T`m$DxQ>4O'(IHq "%T,G3N4/8a9<C!},`m$4 TIMESROMANGACHACMS  TIMESROMAN  TIMESROMAN CMSY z  # + T5 @ M PW c mduyj/|z proc.PRESSSANNELLAAPRIL 20, 1984 09:49:06