As a programmer.


Hello

As a programmer, What should you know about the hardware?

Could anyone give me a title of a good book that describe the computer architecture and how the hardware works.

Thanks
Unless you're planning on programming in ASM you don't need to know anything =]
ultifinitus

Thanks for you reply, But What is the ASM?
It does sometimes help to have a rough understanding of how hardware works if you're writing performance critical applications, and of course it's vital if you are going to write low level stuff like drivers.

PS: You don't need to actually know anything about hardware to program in assembly language - assembly languages does abstract from the concrete machine and gives you a set of instructions you can use. Of course again, if you're using assembly to write drivers or something - which you probably are, cause there's really barely another reason to use assembly nowadays - knowledge about the hardware would, again, become a requirement.

But generally speaking, in-depth knowledge about hardware is seldom necessary, and I can't imagine a (normal) situation in which, as a programmer, you'd ever have to care about how hardware works beyond the digital level.
closed account (1yR4jE8b)
It can be an advantage to know how the hardware you are working on works 'in general' because it can allow you to speed up your code by devising ways of taking advantage of things like Cache Locality. Then again, this only works with fairly low level languages.
Agreed, learning about hardware has also made me more concerned about using correct variable types, before I would always just use "int" when dealing with numbers... but now I use "short"'s quite a bit more...
Once you read this, you'll know more than most Software Engineers: http://en.tldp.org/HOWTO/Unix-and-Internet-Fundamentals-HOWTO/index.html
strongdrink wrote:
I would always just use "int" when dealing with numbers... but now I use "short"'s quite a bit more...

Quite a bit more you say? I'd think that'd be using more than a bit less :P
Could anyone give me a title of a good book that describe the computer architecture and how the hardware works.
Structured Computer Organization by Andrew S. Tanenbaum.
Agreed, learning about hardware has also made me more concerned about using correct variable types, before I would always just use "int" when dealing with numbers... but now I use "short"'s quite a bit more...


Ironically, that might be doing more to hinder your performance than enhance it.
@xander... hehe

@Disch, why is it that that would hinder performance?
@xander337... >_> heh
32-bit processors will read in memory 32-bits at a time. A short is 16 bits so the processor will read in 32-bits and then perform another operation to filter only the 16 required bits. That is why shorts slightly hinder performance when compared with ints (32 bits).
@ xander337: Well played.

@ OP: Wikipedia might not be a bad place to start studying. The articles regarding computer components are pretty adequite. The things that are going to concern you the most as a programmer are the Data Bus Widths, Architecture and Latency of the various components inside of a computer system. ALWAYS remember that Frequency is NOT the only measure of speed, just ask RAMBUS.
Ironically, that might be doing more to hinder your performance than enhance it.


It is hard to say. Using shorts may save up memory and enhance cache locality. Also SSE registers can store 2x more shorts than integers, so you may expect a 2x performance improvement using shorts if only your compiler is able to generate good SSE code.
Last edited on
Alright, that makes sense, but I find the fact that 32bit processors/operating systems still exist is ridiculous. +1 to Computergeek01, I've learned mountains from wikipedia.
Well for me it is not software development related. Instead it is more hardware assembly related. You need to know how to interface the various peripherals in a PC. For example the graphics card, power supply, DVD drive,hard-disk etc are faulty. You do not just throw the whole PC away correct? Instead you will buy a replacement for that faulty peripheral and then fix them to your PC. This saves monies.

Of cuz with PC price dropping so low nowadays, the cost of the replacement peripheral may not justify the effort. You may just want to buy a new PC instead. Also some graphics card come "integrated" with the mother-board so once graphics card spoilt, you are done.

Topic archived. No new replies allowed.