Hermes: A Tutorial and Reference Manual - Researcher - IBM
Hermes: A Tutorial and Reference Manual - Researcher - IBM
Hermes: A Tutorial and Reference Manual - Researcher - IBM
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
81.2.GettingStarted|ASimple<strong>Hermes</strong>Program senseforJoe'sprintfstatementtodenotethesameconsoleasJane's. 1.2,ratherthangure1.1.Thedierencesare:(1)thedistinctionbetween kernel. intra-user<strong>and</strong>inter-usercommunicationdisappears;(2)accesstoresources iscontrolledatthelevelofindividualmodules,ratherthanaddressspaces; <strong>and</strong>(3)accesscontroldecisionsaremadebyprograms,notbyaxed bindingdoneProgramHelloWorldillustratesthesimplestwayofdoing thebinding|makingthefunctionPutLineaparametertotheprogram. <strong>Hermes</strong>encouragesyoutothinkofsystemsfromtheviewpointofgure<br />
codeforprogramHelloWorldiscalledaprocessmodule.Aprocessmodule canbeinstantiatedtocreateaprocess|anactiveentitywithstate,which executesthestatementsoftheprocessmodule.Parms,Parms.PutLine,<strong>and</strong> Giventhat<strong>Hermes</strong>avoidsstaticbinding<strong>and</strong>globalvariables,howisthe<br />
operationstheyallow.Forexample,Parms.PutLineisoftypefamilyoutputport.Outputportssupporttheoperationcall.Thevalueofanoutput<br />
thestatementcallParms.PutLine.Thecallparameters(inthiscase,the portisaconnectiontoaninputport,whichisamessagequeueinanother process. Everyvariablenamehasastaticallyknowntype.Avariable'stypedeter-<br />
Initarevariablenames. oper<strong>and</strong>smusthave.Typesareorganizedintotypefamiliesbasedonthe mineswhatoperationsonthevariablearelegal<strong>and</strong>whattypestheother Thisisagoodtimetobeginusingthe<strong>Hermes</strong>terminology.Thesource<br />
singleparameter"HelloWorld!")arebundledintoacallmessage,which isthenqueuedontheinputporttowhichtheoutportportisconnected. Thecallingprocesswaitsuntilthecallmessageisreturned. ProgramHelloWorldcommunicateswithitsoutputprocessbyexecuting<br />
initializedvariableistheinputportnamedInit,whichwasdesignatedas timeasatypeerror.. connectto.Thetypeofaninputport,inturn,determinesthetypeof statement'sargumentlistmustcontainasinglecharacterstring.Acall withthewrongnumberortypesofargumentswillberejectedatcompile callmessagewhichcanbesenttoit.Inthisexample,theinputportexpectsacallmessagewithasinglecharacterstringparameter.Thecall<br />
WhenprogramHelloWorldstartsupafterbeinginstantiated,theonly Thetypeofanoutputportdeterminesthetypeofinputportitcan<br />
theinitializationport.Byconvention,thecreatorofaprocess|whichwe calltheparent|sendsthenewlycreatedprocess|thechild|acallmessageoveritsinitializationport.Thecallmessagecontainstheparametermunicatewiththeoutside.Inthisexample,weassumethatHelloWorld's<br />
GetProgramareportstoservicestoobtaininputlines<strong>and</strong>loadprograms, <strong>and</strong>ParmStringisacomm<strong>and</strong>string.Theseotherparametersaren'tused thechildneedstogetstarted,includingwhateverportsitmayneedtocom-<br />
namedPutLine,GetLine,GetProgram,<strong>and</strong>ParmString.GetLine<strong>and</strong> parent|perhapsashellprocess|passesacallmessagewithparameters