• Embed Doc
  • Readcast
  • Collections
  • CommentGo Back
Download
 
ThedevelopmentofErlang 
JoeArmstrong ComputerScienceLaboratorEricssonTelecomA joe@cslab.ericsson.se 
Abstract 
Thispaperdescribesthedevelopmentoftheprogramming languageErlangduringtheperiod1985-1997.Erlangisaconcurrentprogramminglanguagedesigneforprogramminglarge-scaledistributedsoftreal-timecon- trolapplications.ThedesignofErlangwasheavilyinuencedbyideasfrom thelogicandfunctionalprogrammingcommunities.Other sourcesofinspirationcamefromlanguagessuchasChillanAdawhichareusedinindustryforprogrammingcontrol systems.
1Introduction 
ThispaperdescribesthedevelopmentoftheErlangpro- gramminglanguage.Erlangisalanguagewhichdrawsheav- ilyfromvarioustraditionsinthelogic,functionalandrealtimecontrolprogrammingcommunities.Ourgoalwastomakealanguagewhichcouldbeuseforbuildinglargesoftreal-timecontrolsystems.Bylargemeansystemswithpossiblymillionsoflinesofcode.Bysoftreal-timesystemImeanasystemwhichdoesnotfaicatastrophicallyifareal-timedeadlineismissed.ErlangwasdevelopedbytheauthorandhiscolleagueattheEricssonComputerScienceLaboratory.Ericssonicurrentlytheworld'slargestsupplieroftelecomssystemandtheworld'sleadingmanufacturerofmobilephones.Ericsson'sagshipproductisatelephoneexchangecalled theAXE10whichisprogrammedinaproprietarylanguagcalledPLEX.AtypicalAXE10systemhasover5million linesofPLEX.TheAXE10isspeciedtohaveadowtime"oflessthan3minutesperyear-suchrequirementarecommoninthetelecomsindustry.Theprogramminglanguageswhichareusedforbuilding suchsystemshavetodealwitharangeofproblemsnotusu- allyencounteredintraditionalbatchorinteractivecomputer systems.Forexample,onerequirementisthatthesysteshouldbeincontinuous"operation-thismeanswemusdosoftwareupgradeswithoutstoppingthesystem.Italsimpliestheuseoffault-tolerantprocessorsandasoftwararchitecturewhichprotectstheintegrityofthesystemfrom variousclassesofprogrammererror.Erlanggrewoutofaseriesofexperimentswhichweperformedtoseeifwecouldndbetterwaysofprogramming telecomssystems.Ourcriterionforsuccesswasthatwcouldprogramtelecomssystemswithlesseortandfeweerrorsthancouldbedoneusingconventionaltechnology.Thispaperstartswithabriefdiscussionofthevarious milestoneswhichthelanguagewentthrough.Thisisfollowedbysectionsdescribingthelanguage,nallyfuturedirectionsofresearcharementioned.
2Milestone
 
Earlyexperiment
Beingatelecomslaboratorywewereinthefortunatpositionofalwayshavinghardwaretoplaywith.The labhadaEricssonMD110whichisasmalltelephone exchangewhichhadbeenmodiedsoitcouldbe controlledbyaconventionalUnixmachine.Wepro- grammedPOTS 
inasmanyprogramminglanguageaswecouldlayourhandson.Themainconclusion5wasthatdeclarativelanguage programsforPOTSwerealotshorterandeasiertunderstandthanimperativelanguageprograms.Un- fortunatelythedeclarativelanguageslackedfeatures forconcurrencycontrolandhadpoorerrorhandling facilities.WeconcludedthatwewouldlikesomethinglikePro- logwithaddedfacilitiesforconcurrencyandimproved errorhandling.Nosuchlanguageexistedatthetime.
 
1986-1989TheProloginterprete
HavingdecidedthatwelikedPrologforprogramming POTSwestartedaseriesofexperimentscallLOTLotsofPOTStoprogramnotonlyPOTSbutalsanextremelylargenumberofdierenttelephonyfea- turesinProlog.BeforelongIhadprogrammedalarge subsetofPABXfeaturesinProlog.TodosoIwrotaPrologmeta-interpretorwhichaddedthenotionof aprocesstoPrologandwhichaddedfacilitiesforad- vancederrordetectionandrecovery.Thisworkisde- scribedin1.
 
TheBollmoragroup 
UsingtheresultsoftheworkwiththeProloginterpre- torwewereabletoattractthecuriosityandinterestof agroupofengineer
whowereresponsibleforafutursoftwarearchitectureoftheEricssonMD110.
POTSstandsforPlainOldTelephonyService,thatis,subscriber AcallssubscriberBandtheychatforawhile.
WhoworkedinBollmora,Stockholm.
 
Thisgroupthoughtthattheycoulduseourresultsas avehicleforinvestigatingtheirownsoftwarearchitectures.Thisbeganaperiodofcollaborationwhichled tothedevelopmentofErlangasafullyedgedlanguageandtoanewrangeofEricssonproducts.Duringtheperiod1986-1988membersofthecomputesciencelabworkedcloselywiththeBollmoragroup,meetingonceortwiceaweek.Duringthistimethe Prologinterpretorandthelanguagewhichitdened changedrapidly.Thelanguagegrewandevolvedand somewherealongthelineacquiredaname,Erlang,namedinhonoroftheDanishmathematicianAgneKrarupErlang18781929whosenameisassociated withthetelecomsindustry.
 
Thejammachine 
Byabout1988iswasclearthatErlangasitwasnocalledwasagoodlanguageforprototypingtelephone exchanges10.Itwasastrangemixture,withdeclarativefeaturesinheritedfromProlog,multi-tasking andconcurrencyinheritedfromEriPascalandAda andanoriginalcombinationoferrorhandlingmecha- nisms.Erlangwas,however,fartooslowtobeusedforprod- uctdevelopment.TheBollmoragroupdidsomemea- surementsanddecidedthatforproductdevelopment theyneededasystemthatwas40timesfasterthatheProloginterpretor.Thisrequirementleadtothedevelopmentofanumber ofdierentabstractmachinesandcompilationtech- niquesusedforimplementingErlang.Acrosscompiler fromErlangtoStrand7wasdeveloped.AfteranumberofexperimentstheJAM4machinewasinvented.ThiswasbasedontheWarrenAbstractMachinewitaddedprimitivesforconcurrencyandexceptionhan- dling.BythistimetheErlangeorthadgrowntothreepeople.MikeWilliamswroteabytecodeemulatorfor JAMcode,IwrotethecompilerandRobertVirding wrotethesupportlibraries.Whileweonlyeverdistributedoneversionofthesystemtoexternalusers,internallytherewereseveral competingErlangengines"whereweexperimentewithdierentimplementationtechniques.TheresultingJAMimplementationwasdeliveredttheBollmoragroupin1989.Fortunatelyitwas70 timesfasterthantheoriginalProloginterpretor-unfortunatelytheyhadnowrevisedtheiroriginalestimatesandwantedamachinethatwas280timesfastethantheoriginal.
 
Addingdistribution 
Duringtheperiod1989-1994theErlanggroup"ex- pandedtherehasneverbeenaformalgroup.ClaeVikstr omjoinedthegroupin1990andaddeddistribu- tiontothelanguage.Theoriginallanguagehadbeedesignedwithhooks"foraddingdistribution-but thiswasneveractuallydoneuntilClaesimplemented it.TheBollmoragrouphadnowdecidedtogoaheaandbuildanewPABXinErlang.Erlangwasn'tfasenoughbutitwasgenerallythoughtthattheperformanceproblemscouldbesolved.In1992theystarted developmentofaproductcalledtheMobilityServer".In1995thiswaslaunchedandbecamepartofthe Consono"productrange.Atthetimeofwritingthe MobilityServerismarketedin12countries.Among otherthingsitisusedtocontroltheDECTmobilphoneintheEuropeanParliamentinStrasbourg.
 
Fightforacceptance 
Duringtheperiod1992-1996itwasbynomeansclear thatErlangwassuitableforprogramminglarge-scalindustrialproducts.Whilewewereverysuccessfulianumberofsmallprojects,Erlangprogrammingand programmersstillrepresentedaverysmallpercentage oftheprogrammingeortatEricsson.TheMobilityserverprojectcontinuedandweattracted severalnewsmallprojects.Duringthistimewewerinvolvedinmassiveguerillamarketing"activities.don'tthinktherewasasinglepersoninEricssonwho evercameoutofBjarne'
ocewithoutacopyofthe Erlangmanualundertheirarm!
 
Thebea
Performancehasalwaysbeenamajorproblem.I1992BogumilHausmanstartedworkontheBEAM.
TheBEAMcompilesErlangtoCwhichcanthenbe compiledwithaconventionalCcompiler.TheBEAcanalsocompiletothreadedcodewhichcanbefreelintermixedwithcompiledcode.Compiledcodeisfasterbuttakesupmorespacethan threadedcode.Inalargeembeddedsystemwithmillionsoflinesofcode,thevolumeofobjectcodecanbe amajorproblem.Infrequentlyusedandnon-performancecriticalpartofthesystemcanbecompiledtothreadedcodewhilperformancecriticalpartsofthesystemcanbecompiledtonativecode.Thereareperformancetoolwhichwecanusetoanalysethesystemandndout whichpartsofthesystemneedtobenativecodecompiled.TheBEAMisdescribedin6.Inmanyapplications theBEAMiscomparablewithCinperformanceterms.TheBEAMreplacedtheJAMastheprinciplesystefornewproductdevelopmentin1997.
 
ErlangSystem
Upto1995mostuserswereenthusiasts"andErlang spreadinternallywithinEricssonbywordofmouth".Wedidn'tndnewusers,theyfoundus.Asthelanguagespreadweneededtoproducetraining materialandholdcoursestotrainnewusers.Initially,allcourseswereheldattheComputerScienceLabby membersoftheErlanggroup".Whileholdingsuccourseswasgreatfun,demandsoonfaroutstripped supply.InApril1993anewcompanyErlangSystems"waformedtohandlesales,marketing,educationandcon- sultingofErlang.WehadbeeninthefortunatepositionofhavingsupervisedanumberofMasterdegre
Bossofthecomputersciencelab.
Bogdans'sErlangAbstractmachine.
 
studentsincomputerscienceattheUniversityofUp- psala.HavingcompletedaMastersdegreemanyof thesestudentswereemployedbyErlangSystems.MikeWilliamsmovedfromtheComputerScienceLab- oratorytomanageErlangSystemsandhadsoonbuilupastrongteamofconsultantsandimpressivetrain- ingfacilities.In1996over500EricssonprogrammerattendedcoursesatErlangSystems.ErlangconsultingisoneofthemostimportantfactorthathaveledtothespreadofErlangwithinEricsson.IntherstErlangprojectstherewasveryclosecontact betweenthedevelopersandtheusers.Wekneweveruserandcouldprovideindividualhelpandtuitionthisdoesn'tscale.Now,whenwestartanewproject,wealwaystrytgetatleasttwoErlangSystemsconsultantsworking ontheproject.Theyprovideavitallinkbetweenthe usersanddevelopersofErlang.Thisisasignicant factorinthesuccessofnewprojects.Itisalsointerestingtonotethattheskilllevelrequired foranentry-levelindustrialprogrammerhasincreased inrecentyears.Agooddegreeincomputerscienceinowapre-conditionforworkingwithstateofthearsoftwaretechnology.Thedaysoftheamateurhackearefastdisappearing.
 
Thetool
ThecurrentErlangsystemcomeswithanextensive toolkit.Aswellastheobvioussoftwaretoolsyacc,lexlook-a-likesetc.thereisawiderangeoftoolwhichareusefulforbuildingtelecomsapplications.Theseincludethingslikecross-compilersforinterfac- ingErlangtoforeignlanguageapplications,anASN.interfacecompiler,anSNMPtool-kit,aHTTP-serveetc.ManyofthenewusersofErlangarenotinitiallyattractedbythelanguagebutratherbythesetoftoolwhichcomeswiththelanguage.Forexample,itiextremelyeasytobuildanSNMPapplicationusing theErlangSNMPtoolkit.TheSNMPtoolkit,forex- ample,containsaMIBcompiler,andsetofdefaulmethodswhichallowsanon-expertusertobuildan SNMPagentinamatterofhours.Doingthisinconventionallanguageismuchmoredicult.Manyoftherstversionsofthetoolswerewrittenby studentsaspartoftheirMasterthesiswork.
 
Mnesi
Manyreal-timeapplicationsneedaccesstodataovelongperiodsoftime.Forexample,inatelephone exchangesubscriberdatamustbestoredformany yearsandmustbeaccessiblewithinafewmilliseconds.Chargingdatatelephonebillsmustbekept andneverlost.Mnesia9isareal-timedistributeddatabasedesigned forprogrammingtelecomsapplicationsinErlang.AmnesiaiswrittenentirelyinErlang.
 
OT
On1January1996anewEricssondivisionwascreatetosupportapplicationswritteninErlang.Ouruserwantalotmorethanjustaprogramminglanguage.Forexample,someuserswantnotonlythelanguage butalsotheoperatingsystemsandthehardwareplatformtobedeliveredinonepackage.TheOTPOpenTelecomPlatformdivisioncanpro- videEricssonuserswithanythingfromasimpleErlang systemwhichrunsonaPCtoanembeddedsystecompletewithhardware.Thedivisionhasthegoal ofprovidingprospectiveuserswithaturn-keysystem whichtheycanturnonandstartprogrammingfrom dayoneofaproject.StandardOTPsoftwarecomewithextensivelibrarieswhichsolvecommonapplicationproblems.AnothergoaloftheOTPdivisionwastotransferresponsibilityforthemaintenanceandsupportofthe ErlangsystemfromtheComputerScienceLaboratortoamainstreamEricssondivision.
3Erlangin14Example
TheprevioussectionsdescribedthedevelopmentofErlang.ThefollowingsectionsdescribeErlangthroughanumberof smallexamples.
3.1SequentialErlang Example1-Factoria
Allfunctionsaredenedinmodules,forexample,factorial canbewritten:
-modulemath. -exportfac1. facNwhenN0-N*facN-1fac0-1
Theannotation 
-exportfac1 
meansthefunction 
fa
withoneargumentisfromthemodule.Onlyexportefunctionscanbecalledfromoutsidethemodule.Onceamodulehasbeenloadedintothesystemthequerevaluatorcanbeusedforfunctionevaluation:
math:fac25. 15511210043330985984000000 
Example2-BinaryTre
lookupKey,Key,Val,_,_- ok,VallookupKey,Key1,Val,S,BwhenKeyKey1- lookupKey,S; lookupKey,Key1,Val,S,B- lookupKey,B; lookupKey,nil- not_found. 
Herethe 
tupl
Key,Val,S,B 
representsanodeofbinarytree.Tuplesstorexednumbersofarguments.
Example3-Append 
appendH|T,L-H|appendT,L; append,L-L
of 00

Leave a Comment

You must be to leave a comment.
Submit
Characters: ...
You must be to leave a comment.
Submit
Characters: ...