Abstraction Without Guilt

Download Abstraction Without Guilt

Post on 23-Feb-2016

27 views

Category:

Documents

0 download

Embed Size (px)

DESCRIPTION

Abstraction Without Guilt. Steve Blackburn Australian National University. Abstraction. September 1999 Tibet. A Few Days Later Amherst, MA. A Month Later Amherst, MA. A Few Days Later Amherst, MA. Meanwhile Denver, CO. Part I MMTk (Flexibility & performance: oil & water?). - PowerPoint PPT Presentation

TRANSCRIPT

Slide 1

AbstractionWithout GuiltSteve BlackburnAustralian National University1AbstractionSteve BlackburnAstraction Without Guilt2

2September 1999TibetSteve BlackburnAstraction Without Guilt3

A Month LaterAmherst, MAA Few Days LaterAmherst, MAMeanwhileDenver, CO

A Few Days LaterAmherst, MA3Part I

MMTk(Flexibility & performance: oil & water?)Steve BlackburnAstraction Without Guilt44Steve BlackburnAstraction Without Guilt5

Steve BlackburnAstraction Without Guilt6

The Researchers DreamRapid realization of ideasExpress ideas as abstractly as possibleReuse thoroughly tested building blocksApples to apples comparisonsCompare ideas in common frameworkCredible artifactsPerformance comparable to production

Steve BlackburnAstraction Without Guilt7State of The Art 1999Stefanovi et alDetailed study of mechanismsDetailed cost modelDone in simulation

Credible artifactApples to applesRapid realization

Attanasio et alDetailed perf. studyStudied in real JVMCredible performanceMonolithic collectors

Rapid realizationApples to applesCredible artifactSteve BlackburnAstraction Without Guilt8(Fast, correct)GC is HardSteve BlackburnAstraction Without Guilt91665 gc_checkWriteBuffers();1666 1667 // all GC threads return, having completed Major collection1668 return;1669 } // collect1035 static void1036 collect () {1037 int i,temp,bytes;1038 boolean selectedGCThread = false; // indicates 1 thread to generate output1121 // set Done flag to allow other GC threads to begin processing1122 initGCDone = true;1123 1124 } // END SINGLE GC THREAD SECTION - GC INITIALIZATION1125 1126 else {1127 // Each GC thread must wait here until initialization is completeWatson 2.0 GenCopyOur ApproachPremature optimization is evilVery hard to intuit performanceHave faith!Viveks compiler team is brilliantIdentify and optimize hot pathsMost code is cold, non-criticalBe fearless!Just assume that things will work OK :-)

Steve BlackburnAstraction Without Guilt10Three months laterSteve BlackburnAstraction Without Guilt1111Code ComplexitymethodsNCSSNCSS/mCCNWatson (Jikes RVM 2.2 circa 2003)GenCopy4265915.7220GenMS4053113.3171MMTk (Jikes RVM 2.2 circa 2003)GenCopy191176.249GenMS181045.8158Generational362797.4102Steve BlackburnAstraction Without Guilt12PerformanceSteve BlackburnAstraction Without Guilt13Allocation Rate(MB/sec)Tracing Rate(MB/sec)Watson SemiSpace69058MMTk SemiSpace61055Watson MarkSweep60093MMTk MarkSweep57569PerformanceSteve BlackburnAstraction Without Guilt14No Inlining(MB/sec)Inlining(MB/sec)MMTk SemiSpace396610MMTk MarkSweep315575C malloc()478n/aC calloc()338n/a

Since ThenHeavily usedBasis for many new GC algorithmsBasis for comparative studiesConstantly evolvingConstantly pushing limitsNow 12 or so supported GCsHigh performanceSteve BlackburnAstraction Without Guilt15Steve BlackburnAstraction Without Guilt16The Lessons(Building good infrastructure is hard.)Flexibility & performance Oil & water.Appropriate abstraction is a game changer.Part II

vmmagic(Having your cake and eating it.)Steve BlackburnAstraction Without Guilt1717Why Java?(Why not C?)Type safetyMemory safetyEncapsulation, composition, reuseConcurrency (language supported)etcSteve BlackburnAstraction Without Guilt18

Steve BlackburnAstraction Without Guilt19

(Fast, correct)GC is HardSteve BlackburnAstraction Without Guilt201665 gc_checkWriteBuffers();1666 1667 // all GC threads return, having completed Major collection1668 return;1669 } // collect1035 static void1036 collect () {1037 int i,temp,bytes;1038 boolean selectedGCThread = false; // indicates 1 thread to generate output1121 // set Done flag to allow other GC threads to begin processing1122 initGCDone = true;1123 1124 } // END SINGLE GC THREAD SECTION - GC INITIALIZATION1125 1126 else {1127 // Each GC thread must wait here until initialization is completeWatson 2.0 GenCopyA Dirty Little SecretSteve BlackburnAstraction Without Guilt21+kADDRESS=intand you cant use new()avoid method callsavoid inheritance21Why Java?(Why not C?)Type safetyMemory safetyEncapsulation, composition, reuseConcurrency (language supported)etcSteve BlackburnAstraction Without Guilt22The ProblemSystems programmers:Strive for reliability, security, maintainabilityDepend on performance and transparent access to low-level primitivesAbstraction:Enables the formerTypically obstructs the latterSteve BlackburnAstraction Without Guilt2323Why (1975)Steve BlackburnAstraction Without Guilt24

James J. Horning, Yes! High level languages should be used to write systems software. ACM Annual Conference/Annual MeetingProceedings of the 1975 Annual Conference.but is the problem still relevant today? 24Why (1975)Steve BlackburnAstraction Without Guilt25

James J. Horning, Yes! High level languages should be used to write systems software. ACM Annual Conference/Annual MeetingProceedings of the 1975 Annual Conference.but is the problem still relevant today? 25Why Not (1972)Steve BlackburnAstraction Without Guilt26

J.G. Fletcher et al, On the appropriate language for system programming. ACM SIGPLAN Notices, Volume 7, Number 7, 1972

but is the problem still relevant today? 26Why The 70s Shift to C?Better language designBetter language implementationMore complex softwareMore complex hardwareMore hardware (portability)

Steve BlackburnAstraction Without Guilt27

Charles Landau, On high-level languages for system programmingACM SIGPLAN Notices, Volume 11, Issue 1,1976

Time for a Second Take?Change continuesheterogeneous multi-core?more complex softwareHigher-level languagestype safememory safestrong abstractions over hardware

Steve BlackburnAstraction Without Guilt28Solutions?Fortify low-level languages (C/C++)Memory safety (e.g., cons. GC, talloc)Idioms (e.g., restrictive use of types)Tools (e.g., Valgrinds memcheck)Use a Systems PLBLISS, Modula-3, CycloneUse two languagesFFIs such as JNI & PInvokeExtend a high-level languageJikes RVM extends JavaSteve BlackburnAstraction Without Guilt29Our ApproachKey Principle: ContainmentMinimize exposure to low-level codingExtensibilityRequirements change quicklyLanguages change slowlyEncapsulationContained low-level semanticsFine-grained lowering of semanticsMinimize impedanceSeparation of concernsSteve BlackburnAstraction Without Guilt30Our FrameworkExtend semanticsIntrinsic methodsControl semanticsScoped semantic changesExtend typesbox/unbox, ref/value, arch. sizes, etcPrefer to retain syntax (pragmatism)Existing front-end tools useableSteve BlackburnAstraction Without Guilt31A Concrete Examplevoid prefetchObjects(OOP *buffer, int size) { for(int i=0; i < size; i++) { OOP current = buffer[i];

asm volatile("prefetchnta (%0)" :: "r" (current)); }}Steve BlackburnAstraction Without Guilt32A Concrete Examplevoid prefetchObjects(OOP *buffer, int size) { for(int i=0; i < size; i++) { OOP current = buffer[i];

asm volatile("prefetchnta (%0)" :: "r" (current)); }}Steve BlackburnAstraction Without Guilt33A Concrete Examplevoid prefetchObjects(OOP *buffer, int size) { for(int i=0; i < size; i++) { OOP current = buffer[i];

asm volatile("prefetchnta (%0)" :: "r" (current)); }}Steve BlackburnAstraction Without Guilt34Java Versionvoid prefetchObjects( ?!? buffer) { for(int i=0;i