Stories
Slash Boxes
Comments

SoylentNews is people

posted by martyb on Saturday October 31 2015, @03:33AM   Printer-friendly
from the A|Journey|Through|the|CPU|Pipeline dept.

It is good for programmers to understand what goes on inside a processor. The CPU is at the heart of our career.

What goes on inside the CPU? How long does it take for one instruction to run? What does it mean when a new CPU has a 12-stage pipeline, or 18-stage pipeline, or even a "deep" 31-stage pipeline?

Programs generally treat the CPU as a black box. Instructions go into the box in order, instructions come out of the box in order, and some processing magic happens inside.

As a programmer, it is useful to learn what happens inside the box. This is especially true if you will be working on tasks like program optimization. If you don't know what is going on inside the CPU, how can you optimize for it?

A primer for those with a less formal background.


Original Submission

 
This discussion has been archived. No new comments can be posted.
Display Options Threshold/Breakthrough Mark All as Read Mark All as Unread
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
  • (Score: 2, Funny) by Francis on Saturday October 31 2015, @04:28AM

    by Francis (5544) on Saturday October 31 2015, @04:28AM (#256794)

    That's crazy talk. Next you're going to be telling us that it's possible to write optimized Java.

    Starting Score:    1  point
    Moderation   +1  
       Funny=1, Total=1
    Extra 'Funny' Modifier   0  

    Total Score:   2  
  • (Score: 1) by tftp on Saturday October 31 2015, @04:40AM

    by tftp (806) on Saturday October 31 2015, @04:40AM (#256795) Homepage

    If you are using Java voluntarily, then optimization is not very prominent on your radar. If you are using Java because you are coding for Android, even Dalvik is pretty fast for most things that people do in applications; for everything else there is NDK. Most applications are not doing anything real-time. One of my applications uses OpenGL, for example - compare to doing the same with a software renderer... that would not be so great even on the fastest Intel CPU.

    In any case, the first thing you optimize is your own algorithms. Their implementation down to hardware is probably done well enough by the compiler.

    • (Score: 1) by Francis on Saturday October 31 2015, @05:12AM

      by Francis (5544) on Saturday October 31 2015, @05:12AM (#256798)

      Sigh, repeating things over and over again doesn't make them true.

      Poorly written Java is poorly performing Java just like any other language. Java doesn't have performance problems, hence why it's so popular with High-Frequency trading.