Book contents
- Frontmatter
- Contents
- Preface
- Part I Numerical Software
- Part II Developing Software
- 6 Basics of computer organization
- 7 Software design
- 8 Data structures
- 9 Design for testing and debugging
- 10 Exercises
- Part III Efficiency in Time, Efficiency in Memory
- Part IV Tools
- Part V Design Examples
- Appendix A Review of vectors and matrices
- Appendix B Trademarks
- References
- Index
6 - Basics of computer organization
Published online by Cambridge University Press: 28 January 2010
- Frontmatter
- Contents
- Preface
- Part I Numerical Software
- Part II Developing Software
- 6 Basics of computer organization
- 7 Software design
- 8 Data structures
- 9 Design for testing and debugging
- 10 Exercises
- Part III Efficiency in Time, Efficiency in Memory
- Part IV Tools
- Part V Design Examples
- Appendix A Review of vectors and matrices
- Appendix B Trademarks
- References
- Index
Summary
In this section we remind our readers of a number of things that are important to understand when developing scientific software. The first is how a Central Processing Unit (CPU) works. This is particularly important for getting the maximum performance out of your computer. The second is how variables are stored in memory. This is important not only for the performance of your code, but also whether it runs correctly or not. The third is what compilers, linkers, loaders and interpreters do to the code you write when they turn it into a program that actually runs on your computer. This is particularly important for people who write libraries of routines; these days that includes most programmers.
In this section we will not deal with the most advanced aspects of programming for performance. That will come in the next chapter.
Under the hood: what a CPU does
A CPU is the hardware that does the actual processing. The other hardware that makes up a computer – memory, input and output devices (keyboard, mouse, network connector, display, disk drives), support hardware – are there mainly to support the operations of the CPU.
So what does a CPU actually do? At the bottom level it is an electrical circuit containing many transistors, which we can consider to be electrically controlled switches carrying out logical operations (“and”, “or”, and “not”). The circuits form sub-systems of the CPU, as illustrated in Figure 6.1. Inside the CPU are a number of fast registers to store temporary data which are going to be operated on. The part of the CPU that does the actual computation is called the Arithmetic-Logic Unit (ALU).
- Type
- Chapter
- Information
- Writing Scientific SoftwareA Guide to Good Style, pp. 45 - 56Publisher: Cambridge University PressPrint publication year: 2006