Question

I want to go backwards and learn more about how compilers, processors and memory operate on my programs. I am also interested in the physics on which all of this depends. Any good references or books would be appreciated...

Was it helpful?

Solution

My first suggestion was going to be Code which has been suggested already. A better, but harder, book on the subject of processors is Computer Organization & Design by Hennessey & Patterson. You might look for an older edition on Amazon or Half.com. They'll be a lot cheaper and have basically the same information.

These will both teach you the basics of how a processor works, assembly language, etc. This will help you understand how your program will be interpreted and thus, what sort of performance bottlenecks might exist based on your design.

OTHER TIPS

For compilers, the ultimate book is the Dragon Book, aka Principles of Compiler Design. It is a bit heavy going at first, but it becomes easier with each pass you make at it. It's a classic and should be read by all serious students of programming/computer science.

It sounds to me like you want to get a Computer Science degree. :-)

I don't normally think of physics and compilers at the same time.

This link might get you thinking.

Write a simple emulator for something like C64. By thinking of how to emulate the CPU, Memory and other Chips you will learn how these simple machines worked. Today's computers pretty much operate in the same manner with a lot more complexity but the basic idea is the same.

Your emulator doesnt have to be super fast - try and get the C64 welcome message up and if you did your code right - you should be able to POKE and write basic programs and have them work :)

10 PRINT "DONT LISTEN TO ME - APPLE //E's RULE"

20 GOTO 10

I would suggest learning enough assembler to be able to write a simple Hello World program in assembler.

This will teach you exactly how the CPU works at the register and memory level.

It will also give you a good introduction into how source code is converted to object files and how the linker brings together all these object files together to create a working program.

Feynman has a nice bit on the Physics of Computation:

which addresses the second part of your question.

Pick up a book on "Computer Organization" or "Computer Architecture" on Amazon. This is what we used when I was in college. It's not too thick, and will give you the basics, from the gate level all of the way up to how memory is organized and programs are written. If, after this, you want to look deeper into the physics, then you'll want to pick up a book on semiconductor physics. (But if I were you I'd just start by looking up "logic gate", "diode", and "transistor" on wikipedia!)

If you really want to get into the physics of processors/ IC's, you need to have a solid electromagnetics/circuit analysis background. It's certainly not easy stuff, and won't really make you a better programmer. If you're really interested, borrow some books from an EE friend!

An abstraction up from that is the gate level, which programmers can usually grok since it's all about logic.

I made a similar resolution after reading Steve Yegge's recommendation to learn about compilers. I've been really enjoying Nisan and Schocken's The Elements of Computing Systems: Building a Modern Computer from First Principles which is first a textbook, second, a one-semester course for freshmen or seniors, and third, a website providing the lectures and cross-platform emulation-simulation software: http://www1.idc.ac.il/tecs/ (TECS)

The topics go from NAND (programming digital logic circuits in HDL), up through flip-flops, ALUs and registers, assemblers, parsing and compilers, operating systems, and GUIs. You, the student, implements every one of these topics on the hardware simulator or software emulator provided on the website. To me, it is a celebration of human ingenuity that this range of ideas can be so deeply covered in 3--4 months by undergrads. One of the authors/professors gave a Google Tech Talk on the subject that's worth checking out if you have an hour to spare away from their course.

I can't recommend an equally-compelling resource for the physics of computation, but I can perfunctorily say that my electrical engineering department's first two core EE courses students could take (simultaneously if they chose) were Circuits 1 and Semiconductors 1. The former dealt with voltage, current, inductors, capacitors, op amps, etc.---while the latter dealt with quantum mechanics, crystals, doping, charge carriers, etc., and most directly spoke to the physics of digital processing and storage devices. It's difficult for me to imagine a hands-on simulation environment like TECS for such a topic, though, making it more appropriate for academic than hobbyist/professional study?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top