Introduction to Computing Systems
Introduction to Computing Systems:
From Bits and Gates to C and Beyond
Yale N. Patt
Sanjay J. Patel
Slides prepared by
Gregory T. Byrd, North Carolina State U
making a decision about which code to execute,
based on evaluated expression
executing code multiple times,
ending based on evaluated expression
Pointers and Arrays
We've seen examples of both of these
in our LC-3 programs; now we'll see them in C.
Pointers and Arrays
Address of a variable in memory
Allows us to indirectly access variables
in other words, we can talk about its
What is Recursion?
A recursive function is one that solves its task
by calling itself on smaller pieces of data.
Similar to recurrence function in mathematics.
Like iteration - can be used interchangeably;
sometimes recursion results in a simpler soluti
Standard C Library
I/O commands are not included as part of the C language.
Instead, they are part of the Standard C Library.
A collection of functions and macros
that must be implemented by any ANSI standard implementation.
Automatically linked with ev
Debugging with High Level Languages
Same goals as low-level debugging
Examine and set values in memory
Execute portions of program
Stop execution when (and where) desired
Want debugging tools to operate on
high-level language const
Basic C Elements
named, typed data items
predefined actions performed on data items
combined with variables to form expressions, statements
Rules and usage
Implementation using LC-3
Smaller, simpler, subcomponent of program
hide low-level details
give high-level structure to program,
easier to understand overall program flow
enables separable, independent development
C: A High-Level Language
Gives symbolic names to values
dont need to know which register or memory location
Provides abstraction of underlying hardware
Programming in C
operations do not depend on instruction set
I/O: Connecting to Outside World
So far, weve learned how to:
compute with values in registers
load data from memory to registers
store data from registers to memory
But where does data in memory come from?
And how does data get out of th
Transistor: Building Block of Computers
Microprocessors contain millions of transistors
Intel Pentium 4 (2000): 48 million
IBM PowerPC 750FX (2002): 38 million
IBM/Apple PowerPC G5 (2003): 58 million
Logically, each t
Solving Problems using a Computer
Methodologies for creating computer programs
that perform a desired function.
How do we figure out what to tell the computer to do?
Convert problem statement into algorithm,
Instruction Set Architecture
ISA = All of the programmer-visible components
and operations of the computer
address space - how may locations can be addressed?
addressibility - how many bits per location?
how many? what s
Stack: An Abstract Data Type
An important abstraction that you will encounter
in many applications.
We will describe three uses:
The rest of the story
Evaluating arithmetic expressions
Certain operations require specialized knowledge
specific knowledge of I/O device registers
and the sequence of operations needed to use them
I/O resources shared among multiple users/programs;
a mistake could affect lots of
The Stored Program Computer
Presper Eckert and John Mauchly - first general electronic computer.
(or was it John V. Atanasoff in 1939?)
Hard-wired program - settings of dials and switches.
1944: Beginnings of EDVAC
The Von Neumann
How do we represent data in a computer?
At the lowest level, a computer is an electronic machine.
works by controlling the flow of electrons
Bits, Data Types,
Easy to recognize two conditions:
1. presence of a voltage well call t
Human-Readable Machine Language
Computers like ones and zeros
Humans like symbols
; increment index reg.
Assembler is a program that turns symbols into
A data structure is a particular organization
of data in memory.
We want to group related items together.
We want to organize these data bundles in a way that is
convenient to program and efficient to execute.