UnderstandingTheMachine_RandallHyde Flashcards
What are the table of contents?
What does “Write Great Code Volume I : Understand The Machine” fill in?
Low-level details of machine organization that computer science and engineering courses often leave out.
Who is this written for?
C/C++, Java and other high-level language programmers
What is great code?
Efficient code
What must we know before we can truly write efficient (great) code?
How computer systems excute programs
How abstractions in programming languages map to the machine’s low-level hardware
What don’t compilers write?
The best machine code - programmers do.
Learn:
- How machine represents numbers, strings, high-level data structures
- How to organize data so the machine can access it efficiently
- How CPU operates so your code is written in the way a machine works
- How input/output devices operate so you can maximize performance when accessing these devices
- How to use the memory hierachy to produce fastest possible programs
What is the Randall Hyde’s goal for Understanding the Machine?
Get us thinking at the level of the machine
One way to force yourself to write code at the machine level is to write your applications in assembly language!
Assembly isn’t for everyone!
Think in low-level terms while writing high-level code!
What have we learned by understanding how the computer represents data?
How high-level language data types translate to machine level
Why?
Know inherent costs of using them
How to organize data, so machine can access it quickly
What have we learned by understanding how the CPU executes machine instructions?
the costs of various operations in your high-level language applications
Why?
so your code is written in the way a machine works
What have we learned by understanding memory performance?
How to organize high-level language variables and other data types to maximize cache and memory access.
Why?
use the memory hierachy to produce fastest possible programs
What is the only one piece missing from this puzzle?
Exactly how does a particular compiler map high-level language statments to the machine level?
Topic deserves a book of it’s own:
Thinking Low-Level**, **Writing High-Level (Second Book)
- How each statement in a typical high-level langauge maps to machine code
- How to choose between two or more high-level sequences to produces the best possible machine code
- How to analyze that machine code to determine it’s quality
- Greater appreciation for how compilers do their job and how you can assist them to do their job better