Example: dental hygienist

10 Things Every Linux Programmer Should Know

ResearchLabsLinuxKernelWorkshop, March2004 aboutUserspacevs. kernelspaceMemory allocationProcessesvs. threadsNPTL- Native POSIXT hreadsLibraryOptimizationUsetherightabst ractionlayerforthejobWhy codingstyleis importantWhy youshouldalwayscheck forerrorsTherealcostof softwaredevelopmentPortabilityLinuxKerne lWorkshop, March2004 aboutThistalkis aboutcommonmisconceptions, andthingsIthinkevery aboutlearningfromotherpeople abouthow to s aboutknowinghow thingswork; Knowinghowthingswork opinions, andmineonly. Feelfreeto .LinuxKernelWorkshop, March2004 processis executingeitherin userspace, orin kernelspace.

10 Things Every Linux Programmer Should Know Linux Misconceptions in 30 Minutes Muli Ben-Yehuda [email protected] IBM Haifa Research Labs Linux Kernel Workshop, March 2004 – p.1/14

Tags:

  Linux, Should, Programmer, Know, Every, Things, Kernel, Things every linux programmer should know

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Transcription of 10 Things Every Linux Programmer Should Know

1 ResearchLabsLinuxKernelWorkshop, March2004 aboutUserspacevs. kernelspaceMemory allocationProcessesvs. threadsNPTL- Native POSIXT hreadsLibraryOptimizationUsetherightabst ractionlayerforthejobWhy codingstyleis importantWhy youshouldalwayscheck forerrorsTherealcostof softwaredevelopmentPortabilityLinuxKerne lWorkshop, March2004 aboutThistalkis aboutcommonmisconceptions, andthingsIthinkevery aboutlearningfromotherpeople abouthow to s aboutknowinghow thingswork; Knowinghowthingswork opinions, andmineonly. Feelfreeto .LinuxKernelWorkshop, March2004 processis executingeitherin userspace, orin kernelspace.

2 Dependingonwhichpriviledges, addressspaceandaddress(EIP)a processis executingin,we saythatit is eitherin userspace, userspace, a processhasnormalpriviledgesandcanandcan tdocertainthings. Whenexecutingin kernelspace, a processhaseverypriviledge, , suchasprocessesusingiopl().Thebiggestdif ferencebetweenuserspaceandkernelspaceis conceptual-theprogrammer s stateof , March2004 a library function,implementedin thestandardC library. It isnota implementedby two meansin thebrk()systemcall,whichgrowsa process s mapping/dev/zeroto getanonymousmemory. In bothcases, virtualmemory areafortheapplication,but doesnotallocatephysicalmemory accessedphysicalmemory knownas memory overcommit ,andtherearewaysto disable ()reallytooslow foryou?

3 LinuxKernelWorkshop, March2004 Linux , thatthreadssharethesamevirtualmemory level interfaceto createthreadsis theclone() interfaceispthread_create().Context switchesbetweenprocessesin better, multiprocessormultithreaded? 1-1 ,not 1-N or M-N .Linuxthreadinglibrariesevolution:LinuxT hreads,NGPT, is part of gilbc, programmerinterfaceis , March2004 Native POSIXT hreadsLibraryTheNew POSIXT hreadsLibrary, writtenby UlrichDrepperandIngoMolnarof RedHat, thedesignandimplementationof places, (FastUserspaceMutexes).Standardin , andback portedto , , March2004 :"Prematureoptimizationis therootof allevil".

4 Avoidthedesireto optimize prematurely;concentrateongettingit s timeto optimize, profile, profile, profile. Thedesireto searchforthecoinunderthestreetlight isstrong, algorithmsfirst, s (almost) fastis Therearelibraries, backgroundprocesses, thekernel, , March2004 a highlevel language, low levellanguage, objectoriented,functional,logicprogrammi ngorprocedural language?whichcanexpresstheproblemdomain best?Balancebetweenthedesireto learn new toolsandtechniquesandtheneedto sureyouhave several hammers, but don tdisdaina hammerjustbecauseyou ve ::open(),fopen(),open()orint0x80?

5 LinuxKernelWorkshop, March2004 codingstyleis importantYourcodedoesnotbelongto eyesmake allbugsshallow, but if noonecanunderstandyourcode, noonewilllookat s plentyof roomforpersonalexpressionevenwhenusingso meoneelse s thecompiler s Burn it if youwant,but follow , March2004 youshouldalwayscheckforerrorsAnythingtha tcangowrong, s yourresponsibilityto dothebestjobyoucan,andthatincludeshandli ngerrors. It s thethingyoudon texpectto there s nothingto bedonewhenanerroroccures,yourdesignis probably , leave acommentforthenext programmerto very sanitychecks- youwantto catchtheerrorascloseaspossible to whereit printf()andclose().

6 Bevery wary of any stringfunctionthatdoesn ttake , March2004 oftenhave peoplegoonusingthattenlinerscriptyouwrot eyearago?how oftendidit become production ? missioncritical ?There s away to thepeoplewhowillreadit few yearslaterit mightbeyou,andyou llappreciateevery , , March2004 tcostyou,withinreason,andcansave youtime, money andeffort s platform is tomorrow s garbage. Platformsandoperatingenvironmentschange, youmustdosomethingplatform-specific, abstractitwellin itsowninterchangeable a goodoneis ttry to abstractthatwhichis , March2004 ,Answers,Comments?

7 Whatdoyouthinkevery Linuxprogrammershouldknow?LinuxKernelWor kshop, March2004


Related search queries