1.3 It Pays to Understand How compilation System Work
1)Reasons for why programmers need to understand how compilation systems work
Optimizing program performance.
Don’t need to know the inner workings of the compiler in order to write effective codes. However, in order to make good coding decisions in our C programs, we do need a basic understanding of machine-level code and how the compiler translates different C statements into machine code.
Understanding link-time errors.
Realize running errors
Avoiding security holes.
Buffer overflow vulnerabilities.(The majority )
1.4 Processors Read the Interpret Instructions Stored in Memory
1)Hardware Organization of a System
2)Hardware Element Details
Buses
word(several bytes(8 bits))
I/O
controller, chip sets int the device itself or on the system’s main printed circuit board(often called the motherboard)
adapter, a card that plugs into a slot on the motherboard.
Samilarly, transfer information back and forth between th I/O bus and an I/O device.
Main Memory
Temporary storage device that holds both a program and the data.
DRAM(Dynamic Random Access Memmory)
Processor
Register, such as PC(Program Counter)
ISA(Instruction Set Architecture)
Load,Store,Operate,Jump
3)How hello.c runs
disk——>memory——>register file——>memory——> display device
4)DMA
direct memory access
Data to memory directly,do not need processor