Introduction to Computer Systems Topics: Theme Four great realities of computer systems Chap 1 in “Computer Systems” book 15-213 “The Class That Gives.

Slides:



Advertisements
Similar presentations
COSC 120 Computer Programming
Advertisements

Introduction to Computer Systems Topics: Staff, text, and policies Lecture topics and assignments Lab rationale CS 213 F ’06 CS-213 Yan Chen.
Introduction to Computer Systems
CSCE 121, Sec 200, 507, 508 Fall 2010 Prof. Jennifer L. Welch.
Stored Program Concept: The Hardware View
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with C++ Early Objects Sixth Edition by Tony Gaddis, Judy Walters,
Introduction to Computer Systems Topics: Staff, text, and policies Lecture topics and assignments Class overview CS 213 S ’06 CS-213 Aleksandar Kuzmanovic.
Chapter 2: Impact of Machine Architectures What is the Relationship Between Programs, Programming Languages, and Computers.
Introduction to Computer Systems Topics: Staff, text, and policies Lecture topics and assignments Class overview CS 213 S ’08 CS-213 Aleksandar Kuzmanovic.
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 1: An Overview of Computers and Programming Languages C++ Programming:
Starting Out with C++: Early Objects 5/e © 2006 Pearson Education. All Rights Reserved Starting Out with C++: Early Objects 5 th Edition Chapter 1 Introduction.
CPU Describe the purpose of the CPU
CPU Registers PC Arith Logic Unit Bus Interface I/O Bridge System bus Memory bus Main Memory USB Controller Graphics Adapter Disk Controller I/O Bus Mouse.
COMPONENTS OF THE SYSTEM UNIT
Alternate Version of STARTING OUT WITH C++ 4 th Edition Chapter 1 Introduction to Computers and Programming.
Chapter Introduction to Computers and Programming 1.
Computer Architecture Lecture 01 Fasih ur Rehman.
CSC 125 Introduction to C++ Programming Chapter 1 Introduction to Computers and Programming.
Lesson 3 — How a Computer Processes Data
Computer Organization Computer Organization & Assembly Language: Module 2.
An Introduction Chapter Chapter 1 Introduction2 Computer Systems  Programmable machines  Hardware + Software (program) HardwareProgram.
Topics Introduction Hardware and Software How Computers Store Data
Understanding Computers, Ch.31 Chapter 3 The System Unit: Processing and Memory.
CS 1308 Computer Literacy and the Internet Computer Systems Organization.
CMSC 313, F ‘09 1 Introduction to Assembly TopicsTopics –Assembly Overview –Instructions –Hardware.
University of Amsterdam Computer Systems – a guided tour Arnoud Visser 1 Computer Systems A guided Tour.
CPU Computer Hardware Organization (How does the computer look from inside?) Register file ALU PC System bus Memory bus Main memory Bus interface I/O bridge.
Intro to Computer Systems Summer 2014 COMP 2130 Introduction to Computer Systems Computing Science Thompson Rivers University.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with C++ Early Objects Seventh Edition by Tony Gaddis, Judy.
Computer Systems Organization CS 1428 Foundations of Computer Science.
Chapter 1 Introduction. Objectives To explain the definition of computer architecture To discuss the history of computers To describe the von-neumann.
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 1: An Overview of Computers and Programming Languages.
Lesson 3 — How a Computer Processes Data Unit 1 — Computer Basics.
Computer Basic Vocabulary
Computer Organization & Assembly Language © by DR. M. Amer.
Computer Organization II Topics: Theme Five great realities of computer systems How this fits within CS curriculum CS 2733.
CS 1308 Computer Literacy and the Internet. Objectives In this chapter, you will learn about:  The components of a computer system  Putting all the.
A.Abhari CPS1251 Topic 1: Introduction to Computers Computer Hardware Computer components Connecting Computers Computer Software Operating System (OS)
Chapter 1 Introduction. Components of a Computer CPU (central processing unit) Executing instructions –Carrying out arithmetic and logical operations.
Computer operation is of how the different parts of a computer system work together to perform a task.
By Tom and James. Hardware is a physical part of the system that you can pick up and move. There are two types of hardware, external and internal. External.
C HAPTER 4 OS: C OMPUTER O RGANIZATION TOPICS: The Von Neumann Architecture The CPU.
Question What technology differentiates the different stages a computer had gone through from generation 1 to present?
Simple ALU How to perform this C language integer operation in the computer C=A+B; ? The arithmetic/logic unit (ALU) of a processor performs integer arithmetic.
1 Basic Processor Architecture. 2 Building Blocks of Processor Systems CPU.
1 3 Computing System Fundamentals 3.2 Computer Architecture.
Hello world !!! ASCII representation of hello.c.
Copyright © 2014, 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with C++ Early Objects Eighth Edition by Tony Gaddis,
IC 3 BASICS, Internet and Computing Core Certification Computing Fundamentals Lesson 2 How Does a Computer Process Data?
Operating Systems A Biswas, Dept. of Information Technology.
Chapter 1: Introduction to Computers and Programming
Computing Science Computer Structure: Lesson 1: Processor Structure
Computers’ Basic Organization
Computer Systems MTSU CSCI 3240 Spring 2016 Dr. Hyrum D. Carroll
Chapter 1: A Tour of Computer Systems
Microprocessor Systems Design I
CS703 - Advanced Operating Systems
Chapter 1: Introduction to Computers and Programming
Computer Science I CSC 135.
Introduction to Computer Systems
CSCE Fall 2013 Prof. Jennifer L. Welch.
Introduction to Computer Systems
CSCE Fall 2012 Prof. Jennifer L. Welch.
Introduction to Computer Systems
Introduction to Computer Systems
Introduction to Computer Systems
Hardware Organization
Chapter 1: Introduction to Computers and Programming
Presentation transcript:

Introduction to Computer Systems Topics: Theme Four great realities of computer systems Chap 1 in “Computer Systems” book “The Class That Gives CMU Its Zip!” And gives Ithaca??

– 2 – COMP 210, S 15 Course Theme Abstraction is good, but don’t forget reality! Courses to date emphasize abstraction Abstract data types (e.g., Comp 220) Asymptotic analysis (e.g., Comp 311) These abstractions have limits Especially in the presence of bugs Need to understand underlying implementations Don’t believe what Ali says

– 3 – COMP 210, S 15 Course Theme Useful outcomes Become more effective programmers Able to find and eliminate bugs efficiently Able to tune program performance Prepare for later “systems” classes Compilers, Operating Systems, Computer Networks, Computer Architecture

– 4 – COMP 210, S 15 Great Reality #1 Information is Bits + Context Examples Source Program: #include int main() { printf(“hello world\n”); } ASCII representation of the source program (text file): #include Etc…. Actual representation on the disk: …

– 5 – COMP 210, S 15 All information is represented as bits Including disk files, programs in memory, user data in memory, data transferred across the internet, … The only thing that distinguishes data objects is context Same bits may represent an integer, floating-point number, character string, or machine instruction.

– 6 – COMP 210, S 15 Great Reality #1 cont. Int’s are not Integers, Float’s are not Reals Examples (see testint.c on arda in Examples/Student) Is x 2 ≥ 0? Float’s: Yes! Int’s: » * > » * > ?? Is (x + y) + z = x + (y + z)? Unsigned & Signed Int’s: Yes! Float’s: » (1e e20) > 3.14 » 1e20 + (-1e ) --> ?? see Student/Examples/chap1_mathProb.c see Student/Examples/chap1_mathProb2.c

– 7 – COMP 210, S 15 Computer Arithmetic Does not generate random values Arithmetic operations have important mathematical properties Cannot assume “usual” properties Due to finiteness of representations Integer operations satisfy “ring” properties Commutativity, associativity, distributivity Floating point operations satisfy “ordering” properties Monotonicity, values of signs

– 8 – COMP 210, S 15 Computer Arithmetic Observation Need to understand which abstractions apply in which contexts Important issues for compiler writers and serious application programmers

– 9 – COMP 210, S 15 Great Reality #2 You’ve got to know assembly Chances are, you’ll never write program in assembly Compilers are much better & more patient than you are Understanding assembly key to machine-level execution model Behavior of programs in presence of bugs High-level language model breaks down Link-time errors hard to find Tuning program performance Understanding sources of program inefficiency Avoiding security holes Example: buffer overflow bugs Implementing system software Compiler has machine code as target Operating systems must manage process state

– 10 – COMP 210, S 15 Compilers Programs are translated by other programs into different forms A C program in text-file format must be translated in a low- level binary format Humans can read the text-file Computers can read the binary Assembly is (basically) a human readable form of binary Translate source to binary in Unix by compiler driver: unix> gcc –o hello hello.c

– 11 – COMP 210, S 15 Compilers Translation phases: Preprocessing phase. The preprocessor (cpp) modifies the original C program according to directives that begin with # hello.c  hello.i Compilation phase. The compiler (ccl) translates the text file into a different text file containing an assembly level file. hello.i  hello.s Assembly phase. The assembler (as) translates the assembly file into a machine language (binary) format. hello.s  hello.o Linking phase. The linker (ld) merges separately compiled files, libraries (like stdio), etc. into an executable object file that can be loaded into memory and run. hello.0 printf.o  hello

– 12 – COMP 210, S 15 Compilers Translation phases: figure 1.3 Pre- processor ( cpp ) hello.i Compiler ( cc1 ) hello.s Assembler ( as ) hello.o Linker ( ld ) hellohello.c Source program (text) Modified source program (text) Assembly program (text) Relocatable object programs (binary) Executable object program (binary) printf.o

– 13 – COMP 210, S 15 Executing programs Processors only understand binary programs The hello.c program has been translated to the executable object file hello and stored on disk To run, we type the program’s name: unix>./hello hello world unix> A shell loads and runs the program.

– 14 – COMP 210, S 15 Executing programs Organization To understand how the program is run, must understand how the hardware is organized.

– 15 – COMP 210, S 15 Executing programs Motherboard Contains the processor, RAM, cache, bus interface

– 16 – COMP 210, S 15 Executing programs CPU The “brains”

– 17 – COMP 210, S 15 Executing programs Organization We create abstract models of the hardware.

– 18 – COMP 210, S 15 Executing programs Buses. Carry a number of bytes of information between components. The number is a fundamental system parameter called a word. Example: Pentium word = 4 bytes; i7core = 8 bytes; embedded controllers = 1 or 2 bytes.

– 19 – COMP 210, S 15 Executing programs I/O Devices. The system’s connection to the external world. Example: keyboard, mouse, display, disk drive Connected to the I/O bus by either a controller or an adapter. Controllers are chip sets in the device or on the motherboard. Adapter is a card that plugs into a slot on the motherboard. Disk controller Graphics adapter USB controller Disk

– 20 – COMP 210, S 15 Executing programs Main Memory. A temporary storage device that holds both a program and the data it manipulates. Consists of a collection of Dynamic Random Access Memory (RAM) chips. Logically organized as a linear array of bytes, each with a unique address. Instructions and data will take up a variable number of bytes in RAM. Main memory

– 21 – COMP 210, S 15 Executing programs The central processing unit (CPU). The engine that interprets (or executes) instructions stored in main memory. Consists of many electronic devices and small pieces of memory (registers): »Control unit (CU) »Arithmetic/Logic Unit (ALU) »Program counter (PC) register that points at next instruction in main memory. »Other general and special purpose registers. CU

– 22 – COMP 210, S 15 Executing programs The central processing unit (CPU). Continued. Performs the same basic tasks over and over again in a cycle (called the execution cycle) »Fetch the next instruction from main memory »Decode (or interpret) the bits in the instruction »Executes the instruction »Update the PC to point at the next instruction There are only a few simple operations (or instructions) that a processor can execute

– 23 – COMP 210, S 15 Executing programs Putting it all together: running the hello program When we type “./hello” the shell program reads each character and stores each into memory. Main memory I/O bridge Bus interface ALU Register file CPU System busMemory bus Disk controller Graphics adapter USB controller MouseKeyboardDisplay Disk I/O bus Expansion slots for other devices such as network adapters PC "hello" User types "hello"

– 24 – COMP 210, S 15 Executing programs Putting it all together: running the hello program When we hit the enter key, the shell loads the executable hello file by executing a sequence of instructions that copies the code and data from the disk to the memory. Uses DMA to bypass the CPU Main memory I/O bridge Bus interface ALU Register file CPU System busMemory bus Disk controller Graphics adapter USB controller MouseKeyboardDisplay Disk I/O bus Expansion slots for other devices such as network adapters hello executable stored on disk PC hello code "hello,world\n"

– 25 – COMP 210, S 15 Executing programs Putting it all together: running the hello program Now the CPU begins executing the instructions in the hello program. »The program instructions copy the bytes in the string “hello world\n” from memory to the register file, »then from there to the display device. »The device displays the string on the screen. »See next slide.

– 26 – COMP 210, S 15 Running the hello program Main memory I/O bridge Bus interface ALU Register file CPU System busMemory bus Disk controller Graphics adapter USB controller MouseKeyboardDisplay Disk I/O bus Expansion slots for other devices such as network adapters hello executable stored on disk PC hello code "hello,world\n"