cits2002 systems programming, lecture 1, p1 · operating system services creating and terminating...

16
CITS2002 Systems Programming 1 next CITS2002 CITS2002 schedule Welcome to CITS2002 Systems Programming This unit, first presented in 2012 as CITS1002, is one of the core units in each of UWA's Computer Science, and Engineering Science (SE) majors. The unit explores the role of contemporary operating systems and their support for high-level programming languages, how they manage efficient access to computer hardware, and how a computer's resources may be accessed and controlled by the C programming language. The unit will be presented by Chris McDonald - which is pronounced 'Chris', not 'Dr', not 'Professor'. Our UWA Handbook entry Understanding the relationship between a programming language and the contemporary operating systems on which it executes is central to developing many skills in Computer Science. This unit introduces the standard C programming language, on which many other programming languages and systems are based, through a study of core operating system services including processes, input and output, memory management, and file systems. The C language is introduced through discussions on basic topics like data types, variables, expressions, control structures, scoping rules, functions and parameter passing. More advanced topics like C's run-time environment, system calls, dynamic memory allocation, and pointers are presented in the context of operating system services related to process execution, memory management and file systems. The importance of process scheduling, memory management and interprocess communication in modern operating systems is discussed in the context of operating system support for multiprogramming. Laboratory and tutorial work place a strong focus on the practical application of fundamental programming concepts, with examples designed to compare and contrast many key features of contemporary operating systems. The UWA Handbook entry for this unit strongly recommends that you take one of three units of Advisable Prior Study before taking this unit - CITS1001, CITS1401, or CITS2401. Students who took this unit in recent years, and had chosen to not take one of the units of Advisable Prior Study, found the material in this unit difficult. This unit is not suitable for first-time programmers. CITS2002 Systems Programming, Lecture 1, p1, 27th July 2020.

Upload: others

Post on 03-Aug-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: CITS2002 Systems Programming, Lecture 1, p1 · Operating system services Creating and terminating processes, a program's runtime environment, command-line arguments, accessing operating

CITS2002SystemsProgramming

1 next→ CITS2002 CITS2002schedule

WelcometoCITS2002SystemsProgrammingThisunit,firstpresentedin2012asCITS1002,isoneofthecoreunitsineachofUWA'sComputerScience,andEngineeringScience(SE)majors.

Theunitexplorestheroleofcontemporaryoperatingsystemsandtheirsupportforhigh-levelprogramminglanguages,howtheymanageefficientaccesstocomputerhardware,andhowacomputer'sresourcesmaybeaccessedandcontrolledbytheCprogramminglanguage.

TheunitwillbepresentedbyChrisMcDonald-whichispronounced'Chris',not'Dr',not'Professor'.

OurUWAHandbookentry

UnderstandingtherelationshipbetweenaprogramminglanguageandthecontemporaryoperatingsystemsonwhichitexecutesiscentraltodevelopingmanyskillsinComputerScience.ThisunitintroducesthestandardCprogramminglanguage,onwhichmanyotherprogramminglanguagesandsystemsarebased,throughastudyofcoreoperatingsystemservicesincludingprocesses,inputandoutput,memorymanagement,andfilesystems.

TheClanguageisintroducedthroughdiscussionsonbasictopicslikedatatypes,variables,expressions,controlstructures,scopingrules,functionsandparameterpassing.MoreadvancedtopicslikeC'srun-timeenvironment,systemcalls,dynamicmemoryallocation,andpointersarepresentedinthecontextofoperatingsystemservicesrelatedtoprocessexecution,memorymanagementandfilesystems.Theimportanceofprocessscheduling,memorymanagementandinterprocesscommunicationinmodernoperatingsystemsisdiscussedinthecontextofoperatingsystemsupportformultiprogramming.Laboratoryandtutorialworkplaceastrongfocusonthepracticalapplicationoffundamentalprogrammingconcepts,withexamplesdesignedtocompareandcontrastmanykeyfeaturesofcontemporaryoperatingsystems.

TheUWAHandbookentryforthisunitstronglyrecommendsthatyoutakeoneofthreeunitsofAdvisablePriorStudybeforetakingthisunit-CITS1001,CITS1401,orCITS2401.Studentswhotookthisunitinrecentyears,andhadchosentonottakeoneoftheunitsofAdvisablePriorStudy,foundthematerialinthisunitdifficult.Thisunitisnotsuitableforfirst-timeprogrammers.

CITS2002SystemsProgramming,Lecture1,p1,27thJuly2020.

Page 2: CITS2002 Systems Programming, Lecture 1, p1 · Operating system services Creating and terminating processes, a program's runtime environment, command-line arguments, accessing operating

CITS2002SystemsProgramming

←prev 2 next→ CITS2002 CITS2002schedule

TopicstobecoveredinCITS2002SystemsProgrammingIt'simportanttoknowwherewe'reheading,sohere'salistoftopicsthatwe'llbecovering:

AnintroductiontotheISO-C99programminglanguageThestructureofaCprogram,basicdatatypesandvariables,compilingandlinking.

AnintroductiontoOperatingSystemsAbriefhistoryofoperatingsystems,theroleofcontemporaryoperatingsystems,therelationshipbetweenprogramminglanguages,programs,andoperatingsystems.

AnoverviewofcomputerhardwarecomponentsTheprocessoranditsregisters,thememoryhierarchy,inputandoutput(I/O)andstoragecomponents.

CprogramsingreaterdetailArraysandcharacterstrings,user-definedtypesandstructures,howthecomputerhardwarerepresentsdata,functions,parameterpassingandreturnvalues.

OperatingsystemservicesCreatingandterminatingprocesses,aprogram'sruntimeenvironment,command-linearguments,accessingoperatingsystemservicesfromC.

ManagingmemoryAllocatingphysicalmemorytoprocesses,sharingmemorybetweenmultipleprocesses,allocatingandmanagingmemoryinCprograms.

FilesandtheiruseinprogramsThefilemanagementsystem,fileallocationmethods,fileanddirectoryoperationsandattributes,fileinputandoutput(I/O),rawandformattedI/O,unbufferedandbufferedI/Ofunctions.

Bytheendofthisunityou'llhavethisknowledge-itjustwon'tallbepresentedstrictlyinthisorder.

Hereisourunit'sschedule.

CITS2002SystemsProgramming,Lecture1,p2,27thJuly2020.

Page 3: CITS2002 Systems Programming, Lecture 1, p1 · Operating system services Creating and terminating processes, a program's runtime environment, command-line arguments, accessing operating

CITS2002SystemsProgramming

←prev 3 next→ CITS2002 CITS2002schedule

WhyteachC?Sinceitsbeginningsinearly1973,theCprogramminglanguagehasevolvedtobecomeoneoftheworld'smostpopular,andwidelydeployedprogramminglanguages.ThelanguagehasundergoneextensiveformalstandardizationtoproducetheANSI-Cstandardin1989,theISO-C99standardin1999,ISO-C11(revision)inDec2011,andISO-C18inJune2018(whichintroducesnonewlanguagefeatures,onlytechnicalcorrectionsandclarificationstodefectsinC11).

Cistheprogramminglanguageofchoiceformostsystems-level,engineering,andscientificprogramming:

mostoftheworld'spopularoperatingsystems,Linux,WindowsandmacOS,theirinterfacesandfile-systems,arewritteninC,theinfrastructureoftheInternet,includingmostofitsnetworkingprotocols,webservers,andemailsystems,arewritteninC,softwarelibrariesprovidinggraphicalinterfacesandtools,andefficientnumerical,statistical,encryption,andcompressionalgorithms,arewritteninC,thesoftwareformostembeddeddevices,includingthoseincars,aircraft,robots,smartappliances,sensors,mobilephones,andgameconsoles,iswritteninC,thesoftwareontheMarsPhoenixLanderiswritteninC,muchofthesafety-criticalsoftwareontheF-35jointstrikefighter,iswritteninC,butCwasnotusedontheApollo-11mission!

IsCstillrelevant?[ref:Tiobesurvey](TheTiobesurveyisbasedonsearch-enginequeries-isnotaboutthebestprogramminglanguageorthelanguageinwhichmostlinesofcode havebeenwritten.)

Though,ofcourse,popularityisapoormeasureofquality-otherwise,McDonald'sRestaurantswouldreceiveMichelinstars.

Otherinterestingsurveys:

Stackoverflow'sDeveloperSurveyResults2020Jetbrains'TheStateofDeveloperEcosystemin2020HackerRank's2020DeveloperSkillsReport

Page 4: CITS2002 Systems Programming, Lecture 1, p1 · Operating system services Creating and terminating processes, a program's runtime environment, command-line arguments, accessing operating

CITS2002SystemsProgramming,Lecture1,p3,27thJuly2020.

Page 5: CITS2002 Systems Programming, Lecture 1, p1 · Operating system services Creating and terminating processes, a program's runtime environment, command-line arguments, accessing operating

CITS2002SystemsProgramming

←prev 4 next→ CITS2002 CITS2002schedule

SowhatisC?

Inonebreath,Cisoftendescribedasagoodgeneralpurposelanguage,anexcellentsystemsprogramminglanguage,andjustaglorifiedassemblylanguage.Sohowcanitbeallthree?

Ccanbecorrectlydescribedasageneralpurposeprogramminglanguage-adescriptionalsogiventoJava,Python,Visual-Basic,C++,andC#.

Cisaproceduralprogramminglanguage,notanobject-orientedlanguagelikeJava,(partsof)Python,Objective-C,orC#.

Cprogramscanbe"good"programs,iftheyare:

welldesigned,clearlywritten,writtenforportability,welldocumented,usehighlevelprogrammingpractices,andwelltested.

Ofcourse,theabovepropertiesareindependentofC,andareofferedbymanyhighlevellanguages.

Chasprogrammingfeaturesprovidedbymostproceduralprogramminglanguages-stronglytypedvariables,constants,standard(orbase)datatypes,enumeratedtypes,user-definedtypes,aggregatestructures,standardcontrolflow,recursion,andprogrammodularization.Cdoesnotoffertuplesorsets,Java'sconceptofclassesorobjects,nestedfunctions,subrangetypes,andhasonlyrecentlyaddedaBooleandatatype.Cdoeshave,however,separatecompilation,conditionalcompilation,bitwiseoperators,pointerarithmetic,andlanguageindependentinputandoutput.

CITS2002SystemsProgramming,Lecture1,p4,27thJuly2020.

Aprogramminglanguagethatdoesn'taffectthewayyouthinkaboutprogrammingisn'tworthknowing.— AlanPerlis,1stTuringAwardwinner

Page 6: CITS2002 Systems Programming, Lecture 1, p1 · Operating system services Creating and terminating processes, a program's runtime environment, command-line arguments, accessing operating

CITS2002SystemsProgramming

←prev 5 next→ CITS2002 CITS2002schedule

ASystemsProgrammingLanguageCisfrequently,andcorrectly,describedasanexcellentsystemsprogramminglanguage.

Calsoprovidesanexcellentoperatingsysteminterfacethroughitswelldefined,hardwareandoperatingsystemindependent,standardlibrary.

TheClanguagebeganitsdevelopmentin1972,asaprogramminglanguageinwhichtore-writesignificantportionsontheUnixoperatingsystem:

UnixwasfirstwritteninassemblylanguagesforPDP-7andPDP-11computers.

In1973DennisRitchiewasworkingonaprogramminglanguageforoperatingsystemdevelopment.BasinghisideasuponBCPL,hedevelopedBandfinallycreatedonecalledC.(Yes,thereisalanguagenamed'D',butit'snotadescendantofC)

Bytheendof1973,theUNIXkernelwas85%writteninCwhichenabledittobeportedtoothermachinesforwhichaCcompilercouldbefashioned.

ThiswasagreatstepbecauseitnolongertiedtheoperatingsystemtothePDP-7asitwouldhavebeenifitremainedinassemblylanguage.In1976DennisRitchieandStephenJohnstonportedUnixtoanInterdata8/32machine.Sincethen,UnixandLinuxhavebeenportedtoover260differentprocessorarchitectures.

Today,wellinexcessof95%oftheUnix,Linux,macOS,andWindowsoperatingsystemkernelsandtheirstandardlibraryroutinesareallwrittenintheCprogramminglanguage-it'sextremelydifficulttofindanoperatingsystemnotwrittenineitherCoritsdescendantsC++orObjective-C.

CITS2002SystemsProgramming,Lecture1,p5,27thJuly2020.

Page 7: CITS2002 Systems Programming, Lecture 1, p1 · Operating system services Creating and terminating processes, a program's runtime environment, command-line arguments, accessing operating

CITS2002SystemsProgramming

←prev 6 next→ CITS2002 CITS2002schedule

PortabilityondifferentarchitecturesCcompilershavebeenbothdevelopedandportedtoalargenumberandtypeofcomputerarchitectures:

from4-bitand8-bitmicrocontrollers,throughtraditional16-,32-,and64-bitvirtualmemoryarchitecturesinmostPCsandworkstations,tolarger64-and128-bitsupercomputers.

Compilershavebeendevelopedfor:

traditionallargeinstructionsetarchitectures,suchasIntelx86,AMD,ARM,Motorola680x0,SunSPARCs,andDEC-Alpha,newerreducedinstructionsetarchitectures(RISC),suchasSGIMIPS,IBM/MotorolaPowerPC,mobilephones,hometheatreequipment,routersandaccess-points,andparallelandpipelinedarchitectures.

CITS2002SystemsProgramming,Lecture1,p6,27thJuly2020.

Page 8: CITS2002 Systems Programming, Lecture 1, p1 · Operating system services Creating and terminating processes, a program's runtime environment, command-line arguments, accessing operating

CITS2002SystemsProgramming

←prev 7 next→ CITS2002 CITS2002schedule

AllitrequiresisaportedCcompilerOnceaCcompilerhasbeendevelopedforanewarchitecture,theterabytesofCprogramsandlibrariesavailableonotherC-basedplatformscanalsobeportedtothenewarchitecture.

Whataboutassemblylanguages?ItisoftenquotedthatacompiledCprogramwillrunonly1-2%slowerthanthesameprogramhand-codedinthenativeassemblylanguageforthemachine.

Buttheobviousadvantageofhavingtheprogramcodedinareadable,highlevellanguage,providestheoverwhelmingadvantagesofmaintainabilityandportability.

Verylittleofanoperatingsystem,suchasWindows,macOS,orLinux,iswritteninanassemblylanguage-inmostcasesthemajorityiswritteninC.

Evenanoperatingsystem'sdevicedrivers,oftenconsideredthemosttime-criticalcodeinanoperatingsystemkernel,todaycontainassemblylanguagenumberedinonlythehundredsoflines.

CITS2002SystemsProgramming,Lecture1,p7,27thJuly2020.

Page 9: CITS2002 Systems Programming, Lecture 1, p1 · Operating system services Creating and terminating processes, a program's runtime environment, command-line arguments, accessing operating

CITS2002SystemsProgramming

←prev 8 next→ CITS2002 CITS2002schedule

TheunreadabilityofCprogramsCisdescribedasnothingmorethanaglorifiedassemblylanguage,meaningthatCprogramscanbewritteninsuchanunreadablefashionthattheylooklikeyourmonitorissetatthewrongspeed.

(infactthere'sahumorouscontestheldeachyear,TheInternationalObfuscatedCCodeContesttodesignfullyworkingbutindecipherablecode,andtheUnderhandedCContestwhosegoalistowritecodethatisasreadable,clear,innocentandstraightforwardaspossible,andyetitmustfailtoperformatitsapparentfunction).

PerhapsC'sbiggestproblemisthatthelanguagewasdesignedbyprogrammerswho,folkloresays,werenotveryproficienttypists.

Cmakesextensiveuseofpunctuationcharactersinthesyntaxofitsoperatorsandcontrolflow.Infact,onlythepunctuationcharacters

@`and$

arenotusedinC'ssyntax!(andDEC-Conceusedthe$character,andObjective-Cnowusesthe@).

Itisnotsurprising,then,thatifCprogramsarenotformattedbothconsistentlyandwithsufficientwhitespacebetweenoperators,andifveryshortidentifiernamesareused,aCprogramwillbeverydifficulttoread.

Topartiallyaddresstheseproblems,anumberoftext-editors,integrateddevelopmentenvironments(IDEs),andbeautificationprograms(suchasindent)canautomaticallyreformatourCcodeaccordingtoconsistentspecifications.

CITS2002SystemsProgramming,Lecture1,p8,27thJuly2020.

Page 10: CITS2002 Systems Programming, Lecture 1, p1 · Operating system services Creating and terminating processes, a program's runtime environment, command-line arguments, accessing operating

CITS2002SystemsProgramming

←prev 9 next→ CITS2002 CITS2002schedule

CriticismsofC'sexecutionmodelCiscriticizedforbeingtooforgivinginitstype-checkingatcompiletime.

Itispossibletocastaninstanceofsometypesintoothertypes,evenifthetwoinstanceshaveconsiderablydifferenttypes.

Apointertoaninstanceofonetypemaybecoercedintoapointertoaninstanceofanothertype,therebypermittingtheitem'scontentstobeinterpreteddifferently.

BadlywrittenCprogramsmakeincorrectassumptionsaboutthesizeofitemstheyaremanaging.Integersof8-,16-,and32-bitscanholddifferentrangesofvalues.Poorchoices,orunderspecificationcaneasilyleadtoerrors.

Cprovidesnoruntimeprotectionagainstarithmeticerrors.

Thereisnoexceptionhandlingmechanism,anderrorssuchasdivision-by-zeroandarithmeticoverflowandunderflow,arenotcaughtandreportedatrun-time.

Coffersnoruntimecheckingofpopularandpowerfulconstructslikepointervariablesandarrayindices.

Subjecttoconstraintsimposedbytheoperatingsystem'smemorymanagementroutines,apointermaypointalmostanywhereinaprocess'addressspaceandseeminglyrandomaddressesmaybereadorwrittento.

AlthoughallarrayindicesinCbeginat0,itispossibletoaccessanarray'selementswithnegativeindicesorindicesbeyondthedeclaredendofthearray.

Thereareoccasionswheneachoftheseoperationsmakesense,buttheyarerare.

Cdoesnotholdthehandoflazyprogrammers.

Weavoidallofthesepotentialproblemsbylearningthelanguagewell,andemployingsafeprogrammingpractices.

CITS2002SystemsProgramming,Lecture1,p9,27thJuly2020.

Page 11: CITS2002 Systems Programming, Lecture 1, p1 · Operating system services Creating and terminating processes, a program's runtime environment, command-line arguments, accessing operating

CITS2002SystemsProgramming

←prev 10 next→ CITS2002 CITS2002schedule

Whatisthebestprogramminglanguage?Thequestion,evenarguments,ofwhetherC,Java,Visual-Basic,C++,orC#isthebestgeneralpurposeprogramminglanguageispointless.

Theimportantquestionis:"whichlanguageismostsuitedforthetaskathand?"

Thisunitwillanswerthequestions:

"whenisCthebestlanguagetouse?"and"howdowebestuseC'sfeaturesforsystemsprogramming?"

ThroughasequenceofunitsofferedbyComputerScience&SoftwareEngineeringyoucanbecomeproficientinawidevarietyofprogramminglanguages-procedural,object-oriented,functional,logic,set-based,andformal-andknowthemostappropriateonetoselectforanyproject.

CITS2002SystemsProgramming,Lecture1,p10,27thJuly2020.

CandC++areonlythefoundationbecausetheyhappenedtobecomepopularduetoabunchofmiscellaneousfactors,notbecausetheyareinherentlygreatinventionsinthemselves.Also,they(andtheirstandardlibraries)evolvedovertimetotheircurrentstate.

It'slikesayingEnglishandSpanisharethemostimportantlanguagesbecausetheyarefundamentallythe"best-invented"ones,notbecauseoftheaccidentsoffatethatwerecolonialexpansion,WWII,andtheInternet.— Anon

Page 12: CITS2002 Systems Programming, Lecture 1, p1 · Operating system services Creating and terminating processes, a program's runtime environment, command-line arguments, accessing operating

CITS2002SystemsProgramming

←prev 11 next→ CITS2002 CITS2002schedule

TheStandardizationofC-K&RC

DespiteC'slonghistory,beingfirstdesignedintheearly1970s,itunderwentconsiderablylittlechangeuntilthelate1980s.

Thisisaverylengthyperiodoftimewhentalkingaboutaprogramminglanguage'sevolution.

TheoriginalClanguagewasmostlydesignedbyDennisRitchieandthendescribedbyBrianKernighanandDennisRitchieintheirimaginativelytitledbookTheCProgrammingLanguage.

Thelanguagedescribedinthisseminalbook,describedasthe"K&R"book,isnowdescribedas"K&R"or"old"C.

228pages.

CITS2002SystemsProgramming,Lecture1,p11,27thJuly2020.

Page 13: CITS2002 Systems Programming, Lecture 1, p1 · Operating system services Creating and terminating processes, a program's runtime environment, command-line arguments, accessing operating

CITS2002SystemsProgramming

←prev 12 next→ CITS2002 CITS2002schedule

TheStandardizationofC-ANSI-C(K&R-2)

Inthelate1980s,anumberofstandardsformingbodies,andinparticulartheAmericanNationalStandardsAssociationX3J11Committee,commencedworkonrigorouslydefiningboththeClanguageandthecommonlyprovidedstandardClibraryroutines.TheresultsoftheirlengthymeetingsaretermedtheANSI-X3J11standard,orinformallyasANSI-C,C89,orC90.

TheformaldefinitionofANSI-Cintroducedsurprisinglyfewmodificationstotheold"K&R"languageandonlyafewadditions.

MostoftheadditionsweretheresultofsimilarenhancementsthatweretypicallyprovidedbydifferentvendorsofCcompilers,andthesehadgenerallybeenconsideredasessentialextensionstooldC.TheANSI-ClanguageisextremelysimilartooldC.Thecommitteeonlyintroducedanewbasedatatype,modifiedthesyntaxoffunctionprototypes,addedfunctionalitytothepreprocessor,andformalizedtheadditionofconstructssuchasconstantsandenumeratedtypes.

272pages.

CITS2002SystemsProgramming,Lecture1,p12,27thJuly2020.

Page 14: CITS2002 Systems Programming, Lecture 1, p1 · Operating system services Creating and terminating processes, a program's runtime environment, command-line arguments, accessing operating

CITS2002SystemsProgramming

←prev 13 next→ CITS2002 CITS2002schedule

TheStandardizationofC-ANSI/ISO-C99andISO/IEC9899:2011(C11)

AnewrevisionoftheClanguage,namedANSI/ISO-C99(knownasC99),wascompletedin1999.

Manyfeatureswere"cleanedup",includingtheadditionofBooleanandcomplexdatatypes,singlelinecomments,andvariablelengtharrays,andtheremovalofmanyunsafefeatures,andill-definedconstructs.

753pages.

ArevisionofC99,ISO/IEC9899:2011(knownasC11),wascompletedinDecember2011.

InthisunitwewillfocusexclusivelyonANSI/ISO-C99,andonlymentionotherversionsofCwhenthedifferencesaresignificant.

CITS2002SystemsProgramming,Lecture1,p13,27thJuly2020.

Page 15: CITS2002 Systems Programming, Lecture 1, p1 · Operating system services Creating and terminating processes, a program's runtime environment, command-line arguments, accessing operating

CITS2002SystemsProgramming

←prev 14 next→ CITS2002 CITS2002schedule

WhatStandardizationProvidesThesequiteformalstandardsspecifytheformandestablishestheinterpretationofprogramswrittenintheCprogramminglanguage.Theyspecify:

therepresentationofCprograms;thesyntaxandconstraintsoftheClanguage;thesemanticrulesforinterpretingCprograms;therepresentationofinputdatatobeprocessedbyCprograms;therepresentationofoutputdataproducedbyCprograms;therestrictionsandlimitsimposedbyaconformingimplementationofC.

Theydonotspecify:

themechanismbywhichCprogramsaretransformedforusebyadata-processingsystem;themechanismbywhichCprogramsareinvokedforusebyadata-processingsystem;themechanismbywhichinputdataaretransformedforusebyaCprogram;themechanismbywhichoutputdataaretransformedafterbeingproducedbyaCprogram;thesizeorcomplexityofaprogramanditsdatathatwillexceedthecapacityofanyspecificdata-processingsystemorthecapacityofaparticularprocessor;allminimalrequirementsofadata-processingsystemthatiscapableofsupportingaconformingimplementation.

CITS2002SystemsProgramming,Lecture1,p14,27thJuly2020.

Page 16: CITS2002 Systems Programming, Lecture 1, p1 · Operating system services Creating and terminating processes, a program's runtime environment, command-line arguments, accessing operating

CITS2002SystemsProgramming

←prev 15 CITS2002 CITS2002schedule

What's(deliberately)missingfromtheClanguage?Atfirstglance,theClanguageappearstobemissingsomecommonlyrequiredfeaturesthatotherlanguages,suchasJava,provideintheirstandards.

Forexample,Cdoesnotprovidefeaturesforgraphics,networking,cryptography,ormultimedia.

Instead,Cpermits,enables,andencouragesadditional3rd-partylibraries(bothopen-sourceandcommercial)toprovidethesefacilities.Thereasonforthese"omissions"isthatCrigorouslydefineswhatitdoesprovide,andrigorouslydefineshowCmustinteractwithexternallibraries.

Herearesomewell-respected3rd-partylibraries,frequentlyemployedinlargeCprograms:

Functiondomain 3rd-partylibrariesoperatingsystemservices(files,directories,processes,inter-processcommunication)

OS-specificlibraries,e.g.glibc,Win32,Carbon

web-basedprogramming libcgi,libxml,libcurl

datastructuresandalgorithms thegenericdatastructureslibrary(GDSL)

GUIandgraphicsdevelopment OpenGL,GTK,Qt,UIKit,Win32,Tcl/Tk

imageprocessing(GIFs,JPGs,etc) gd

networking Berkeleysockets,AT&T'sTLI

security,cryptography openssl,libmp

scientificcomputing NAG,Blas3,GNUscientificlibrary(gsl)

concurrency,parallelandGPUprogramming pthreads,OpenMPI,openLinda,CUDA,OpenCL

CITS2002SystemsProgramming,Lecture1,p15,27thJuly2020.