CS 270 CS 270: Computer Organization Course Overview Instructor: Professor Stephen P. Carl.

Slides:



Advertisements
Similar presentations
Carnegie Mellon Course Overview Computer Systems Organization (Fall 2014) Section 001 (Honors) and Section 002 (Regular) Professor Andrew Case Teaching.
Advertisements

CSCE 3121 Computer Organization Lecture 1. CSCE 3122 Course Overview Topics: –Theme –Five great realities of computer systems –Computer System Overview.
Computer Systems & Programming (CS 367) Section 002: Prof. Elizabeth White Spring 2010.
1 Carnegie Mellon The course that gives CMU its “Zip”! Course Overview : Introduction to Computer Systems 1 st Lecture, Aug. 24, 2010 Instructors:
University of Washington The Hardware/Software Interface CSE351 Spring st Lecture, March 28 Instructor: Luis Ceze Teaching Assistants: Aaron Miller,
Introduction to Computer Systems Topics: Theme Five great realities of computer systems How this fits within CS curriculum S ‘08 class01a.ppt
CSCE 3121 Computer Organization Lecture 1 Bryant’s Book Chapter 1.
1 School of Computing Science Simon Fraser University CMPT 300: Operating Systems I Dr. Mohamed Hefeeda.
Chapter 1. Introduction This course is all about how computers work But what do we mean by a computer? –Different types: desktop, servers, embedded devices.
Computer Organization: Introduction Spring 2006 Jen-Chang Liu ( )
CS 300 – Lecture 20 Intro to Computer Architecture / Assembly Language Caches.
1  1998 Morgan Kaufmann Publishers Lectures for 2nd Edition Note: these lectures are often supplemented with other materials and also problems from the.
Introduction to Computer Systems Topics: Theme Five great realities of computer systems How this fits within CS curriculum CS 213 F ’03 class01a.ppt
Introduction to Computer Systems* Topics: Theme Five great realities of computer systems How this fits within CS curriculum F ’07 class01a.ppt
Introduction to Computer Systems Topics: Theme Five great realities of computer systems How this fits within CS curriculum F ’04 class01a.ppt
3.1Introduction to CPU Central processing unit etched on silicon chip called microprocessor Contain tens of millions of tiny transistors Key components:
COMP 321: Introduction to Computer Systems Scott Rixner Alan L. Cox
Department of Computer and Information Science, School of Science, IUPUI Dale Roberts, Lecturer Computer Science, IUPUI CSCI.
CS 61C L01 Introduction (1) Garcia, Spring 2004 © UCB Lecturer PSOE Dan Garcia CS61C www page www-inst.eecs.berkeley.edu/~cs61c/
An Introduction Chapter Chapter 1 Introduction2 Computer Systems  Programmable machines  Hardware + Software (program) HardwareProgram.
Lecture#14. Last Lecture Summary Memory Address, size What memory stores OS, Application programs, Data, Instructions Types of Memory Non Volatile and.
The Computer Systems By : Prabir Nandi Computer Instructor KV Lumding.
COURSE OVERVIEW COMPUTER ARCHITECTURE AND ORGANIZATION Instructor: Professor Emmett Witchel.
Lecture 0: Introduction EEN 312: Processors: Hardware, Software, and Interfacing Department of Electrical and Computer Engineering Fall 2012, Dr. Rozier.
Introduction to Computer Systems Topics: Theme Four great realities of computer systems Chap 1 in “Computer Systems” book “The Class That Gives.
Carnegie Mellon Course Overview Computer Systems Organization (Fall 2015) Instructor: Jinyang Li.
1 Computer System Organization I/O systemProcessor Compiler Operating System (Windows 98) Application (Netscape) Digital Design Circuit Design Instruction.
Lec 1Systems Architecture1 Systems Architecture Lecture 1: Random Access Machines Jeremy R. Johnson Anatole D. Ruslanov William M. Mongan Some material.
1 Carnegie Mellon The course that gives CMU its “Zip”! Course Overview (18-213): Introduction to Computer Systems 1 st Lecture, Aug. 26, 2014 Instructors:
Assembly Language and Computer Organization Topics: Theme Programming in C Great realities of computer systems How this fits within CS curriculum Logistical.
Computer Organization and Design Computer Abstractions and Technology
Introduction to Computer Systems Topics: Theme Five great realities of computer systems How this fits within CS curriculum Logistics intro.ppt CS 105 “Tour.
Assembly Language and Computer Organization Topics: Theme Programming in C Great realities of computer systems How this fits within CS curriculum Logistical.
Introduction to Computer Systems Topics: Theme Five great realities of computer systems How this fits within CS curriculum Logistical issues F ‘08.
Introduction to Computer Systems Topics: Theme Five great realities of computer systems (continued) “The class that bytes”
Chapter 1 Computer Abstractions and Technology. Chapter 1 — Computer Abstractions and Technology — 2 The Computer Revolution Progress in computer technology.
Computer Organization & Assembly Language © by DR. M. Amer.
Computer Systems Overview Topics: Staff, text, and policies Lecture topics and assignments Lab rationale CS 105 “Tour of the Black Holes of Computing!”
1 Carnegie Mellon The course that gives CMU its “Zip”! Course Overview (18-213): Introduction to Computer Systems 1 st Lecture, Aug. 28, 2012 Instructors:
Introduction to Computer Systems Topics: Theme Five great realities of computer systems How this fits within CS curriculum F ’06 class01a.ppt
Computer Organization II Topics: Theme Five great realities of computer systems How this fits within CS curriculum CS 2733.
Assembly Language and Computer Organization Topics: Theme Programming in C Great realities of computer systems How this fits within CS curriculum Logistical.
Course Overview CENG331 - Computer Organization
1 Bryant and O’Hallaron, Computer Systems: A Programmer’s Perspective, Third Edition Carnegie Mellon Overview Course theme Five realities How the course.
DR. SIMING LIU SPRING 2016 COMPUTER SCIENCE AND ENGINEERING UNIVERSITY OF NEVADA, RENO CS 219 Computer Organization.
Introduction CSE 410, Spring 2005 Computer Systems
1 Bryant and O’Hallaron, Computer Systems: A Programmer’s Perspective, Third Edition Carnegie Mellon Course Overview Introduction to Computer Systems 1.
Introduction to Computers - Hardware
Course Overview CSE 238/2038/2138: Systems Programming
The course that gives CMU its “Zip”!
Final exam: Wednesday, March 20, 2:30pm
Computer Systems & Programming (CS 367)
Course Overview CSCI 2400/ ECE 3217: Computer Architecture
Course Overview CENG331 - Computer Organization
Computer Systems: A Programmer’s Perspective aka: CS:APP
Assembly Language and Computer Organization
Assembly Language and Computer Organization
Computer Systems Summary
Introduction to Computer Systems
Introduction to Computer Systems
Introduction to Computer Systems
Introduction to Computer Systems
Welcome to Architectures of Digital Systems
Overview Course theme Five realities
Introduction to Computer Systems
COMS 361 Computer Organization
Introduction to Computer Systems
Introduction to Computer Systems
CS-2011 — Machine Organization and Assembly Language
Presentation transcript:

CS 270 CS 270: Computer Organization Course Overview Instructor: Professor Stephen P. Carl

CS 270 Quote of the Day 640 Kbytes [of main memory] ought to be enough for anybody. –Bill Gates, 1981

CS 270 Course Perspective Most Systems Courses are Builder-Centric; this Course is Programmer-Centric  How one can become a more effective programming by knowing more about the underlying system  Enable you to:  Write programs that are more reliable and efficient  Incorporate features that require hooks into OS –E.g., concurrency, signal handlers (in CS 428)  Not just a course for dedicated hackers (But - might just bring out the hidden hacker in you)  You won’t see most of this material in any other course

CS 270 Course Components Lectures  Higher level concepts Labs and Assignments  The heart of the course  weeks  Provide in-depth understanding of an aspect of systems  Programming and problem solving Exams (2 + final)  Test your understanding of concepts & mathematical principles

CS 270 Timeliness Grace days  4 for the course  Covers scheduling crunch, out-of-town trips, illnesses, minor setbacks  Save them until late in the term! Lateness penalties  Once grace days used up, get penalized 10% per day  Typically shut off all handins 4 days after due date Catastrophic events  Major illness, death in family, …  Work with your professor on plan for getting back on track Advice  Once you start running late, it’s really hard to catch up

CS 270 Cheating What is cheating?  Sharing code: either by copying, retyping, looking at, or supplying a copy of a file.  Coaching: helping your friend to write a lab, line by line.  Copying code from previous course or from elsewhere on WWW  Only allowed to use code we supply, or from CS:APP website What is NOT cheating?  Explaining how to use systems or tools.  Helping others with high-level design issues. Penalty for cheating:  Case remanded to Honor Council. Detection of cheating:  We do check and our tools for doing this are much better than you might think

CS 270 Policies: Attendance and Grading Presence in lectures: strongly advised (cut warning after 2 unexcused absences) Presence in design/help sessions: voluntary Exams: weighted 15, 15, 15 (final) Labs: completed/not completed Guaranteed:  > 90%: A  > 80%: B  > 70%: C

CS 270 Introduction: Themes and Concepts A bird’s eye view of computer system organization Processors and technological progress Abstraction vs. Reality  Internal data representations - it’s all just numbers  Why knowing Assembly language is a Good Thing  Computer storage is large but not infinite  Asymptotic complexity is only part of the story  Computers compute, but they also communicate

CS main components of any Computing System Sun Blade Computer Processor Computer Control (“brain”) Datapath (“brawn”) Memory (where programs, data live when running) Devices Input Output Keyboard, Mouse Display, Printer Disk (where programs, data live when not running)

CS main components of Computer Systems Datapath  Performs operations on signals moving through the CPU Control Circuitry  Routes signals into, through, and out of the CPU Memory  Volatile (RAM)  Permanent Storage (hard drives, DVD-ROM, etc.) Input devices  Mouse, keyboard, etc. Output devices  Monitor, printers, etc.

CS 270

March of Progress: Moore’s Law Moore’s Law: the number of transistors on a single integrated circuit, also called chip density, doubles every 18 months Applies to any kind of semiconductor chip: memory (RAM), microprocessors, GPUs, etc. Trend first described by Intel co-founder Gordon Moore in 1965.

CS 270 The March of Progress: DRAM capacity year size (Mbit) Now 1.4X/yr, or 2X every 2 years. 8000X since 1980! Size in bits of single-chip Dynamic Random Access Memory (DRAM )

CS 270 The March of Progress: Microprocessor Complexity Alpha 21264: 15 million PowerPC 620: 6.9 million Pentium Pro: 5.5 million (1995) Sparc Ultra: 5.2 million Athlon (K7): 22 Million Itanium 2: 41 Million Intel 8088: < 50,000 (1979) Intel 80486: 1 million (1989)

CS 270 The March of Progress: Processor Performance 1.54X/yr Intel P MHz (Fall 2001) year Performance measure

CS 270 The March of Progress: Dramatic Changes ° Memory DRAM capacity: 64x size improvement in last decade. ° Processor Speed: 100X performance in last decade. ° Disk Capacity doubled every year since 1997: 250X in last decade.

CS 270 The March of Progress: Dramatic Changes What will the state-of-the-art PC be when you graduate? Processor clock speed: 5000 MegaHertz (5.0 GigaHertz) Memory capacity: 4000 MegaBytes (4.0 GigaBytes) Disk capacity:2000 GigaBytes (2.0 TeraBytes) Time to learn some new units! Mega => Giga Giga => Tera Tera => Peta Peta => Exa Exa => Zetta Zetta => Yotta = 10 24

CS 270 The Death of Progress? The Power Wall

CS 270 Multicore Processors

CS 270

Computing Systems as Abstractions Most CS courses emphasize abstraction  Abstract data types (CS 157/257)  Asymptotic analysis (CS 320) Computer Systems are organized according to layers of abstraction.  In general, abstraction helps engineers of all sorts to manage complexity  Abstraction helps insulate programmers from differences between various hardware platforms

CS 270 Our Theme: Abstraction Is Important But Don’t Forget Reality Abstractions have limits  Especially in the presence of bugs  Understanding details of the underlying implementations: sometimes, you just need to Useful outcomes  Become a more effective programmer!  Find and eliminate bugs efficiently  Understand and tune for program performance  Preparation for later “systems” classes in CS  Operating Systems, Networking

CS 270 Reality #1: Ints are not Integers, Floats are not Reals Example 1: Is x 2 ≥ 0?  Floats: Yes!  Ints:  * >  * > ?? Example 2: Is (x + y) + z = x + (y + z)?  Unsigned & Signed Ints: Yes!  Floats:  (1e e20) > 3.14  1e20 + (-1e ) --> ??

CS 270 Code Security Example Similar to code found in FreeBSD’s implementation of getpeername There are legions of smart people trying to find vulnerabilities in programs /* Kernel memory region holding user-accessible data */ #define KSIZE 1024 char kbuf[KSIZE]; /* Copy at most maxlen bytes from kernel region to user buffer */ int copy_from_kernel(void *user_dest, int maxlen) { /* Byte count len is minimum of buffer size and maxlen */ int len = KSIZE < maxlen ? KSIZE : maxlen; memcpy(user_dest, kbuf, len); return len; }

CS 270 Typical Usage /* Kernel memory region holding user-accessible data */ #define KSIZE 1024 char kbuf[KSIZE]; /* Copy at most maxlen bytes from kernel region to user buffer */ int copy_from_kernel(void *user_dest, int maxlen) { /* Byte count len is minimum of buffer size and maxlen */ int len = KSIZE < maxlen ? KSIZE : maxlen; memcpy(user_dest, kbuf, len); return len; } #define MSIZE 528 void getstuff() { char mybuf[MSIZE]; copy_from_kernel(mybuf, MSIZE); printf(“%s\n”, mybuf); }

CS 270 Malicious Usage /* Kernel memory region holding user-accessible data */ #define KSIZE 1024 char kbuf[KSIZE]; /* Copy at most maxlen bytes from kernel region to user buffer */ int copy_from_kernel(void *user_dest, int maxlen) { /* Byte count len is minimum of buffer size and maxlen */ int len = KSIZE < maxlen ? KSIZE : maxlen; memcpy(user_dest, kbuf, len); return len; } #define MSIZE 528 void getstuff() { char mybuf[MSIZE]; copy_from_kernel(mybuf, -MSIZE);... }

CS 270 Computer Arithmetic Arithmetic operations have important mathematical properties Cannot assume all the usual mathematical properties, due to finiteness of representations  Integer operations satisfy “ring” properties  Commutativity, associativity, distributivity  Floating point operations satisfy “ordering” properties  Monotonicity, values of signs Observation  Need to understand which abstractions apply in which contexts  Important issues for compiler writers and serious application programmers

CS 270 Great (Grim?) Reality #2: You Need to Know Assembly Chances are, you’ll never write program in assembly  Compilers are much better & more patient than you are But understanding assembly is key to understanding the machine- level execution model.  When bugs happen, high-level language model breaks down  Tuning program performance  What optimizations are done/not done by the compiler?  What are the sources of program inefficiency?  Implementing system software  Compiler has machine code as target  Operating systems must manage process state  Creating / fighting malware  x86 assembly is the language of choice!

CS 270 Assembly Code Example Time Stamp Counter  Special 64-bit register in Intel-compatible machines  Incremented every clock cycle  Read with rdtsc instruction Application  Measure time (in clock cycles) required by a procedure: double t; start_counter(); P(); // function to be timed t = get_counter(); printf("P required %f clock cycles\n", t);

CS 270 Code to Read Counter Add a small amount of assembly code using GCC’s asm facility This inserts assembly code into machine code generated by compiler: static unsigned cyc_hi = 0; static unsigned cyc_lo = 0; /* Set *hi and *lo to the high and low order bits of the cycle counter. */ void access_counter(unsigned *hi, unsigned *lo) { asm("rdtsc; movl %edx,%0; movl %eax,%1" : "=r" (*hi), "=r" (*lo) : : "%edx", "%eax"); }

CS 270 Grim Reality #3: “Random Access Memory” is a non- physical abstraction Memory is not unbounded  It must be allocated and managed  Many applications are memory dominated Bugs due to memory referencing errors are especially pernicious  Effects are distant in both time (error may show up long after erroneous instruction executes) and space (effect may be outside the bounds of the executing program) Memory performance is not uniform  Cache and virtual memory effects can greatly affect program performance  Adapting program to characteristics of memory system can lead to major speed improvements

CS 270 Example of a Memory Referencing Bug double fun(int i) { volatile double d[1] = {3.14}; volatile long int a[2]; a[i] = ; /* Possibly out of bounds */ return d[0]; } fun(0) –>3.14 fun(1) –>3.14 fun(2) –> fun(3) –> fun(4) –>3.14, then segmentation fault

CS 270 Memory Referencing Bug Example double fun(int i) { volatile double d[1] = {3.14}; volatile long int a[2]; a[i] = ; /* Possibly out of bounds */ return d[0]; } fun(0) –>3.14 fun(1) –>3.14 fun(2) –> fun(3) –> fun(4) –>3.14, then segmentation fault Saved State MSB of d[0] LSB of d[0] a[1] a[0] Location accessed by fun(i) Explanation:

CS 270 Memory Referencing Errors Unlike Java, C and C++ do not protect memory at all  Out of bounds array references  Invalid pointer values  Abuses of malloc/free (e.g., memory leaks) This usually leads to nasty bugs  Whether or not bug has any effect depends on system and compiler  Action at a distance  Corrupted object logically unrelated to one being accessed  Effect of bug may be first observed long after it is generated How can I deal with this?  Program in Scheme, Java or Python  Understand what possible interactions may occur  Use tools that detect referencing errors

CS 270 Memory System Performance Example Hierarchical memory organization Performance depends on access patterns  Including how we step through multi-dimensional arrays void copyji(int src[2048][2048], int dst[2048][2048]) { int i,j; // access in column-major order for (j = 0; j < 2048; j++) for (i = 0; i < 2048; i++) dst[i][j] = src[i][j]; } void copyij(int src[2048][2048], int dst[2048][2048]) { int i,j; // access in row-major order for (i = 0; i < 2048; i++) for (j = 0; j < 2048; j++) dst[i][j] = src[i][j]; } 21 times slower on Pentium 4

CS 270 The Memory Mountain Read throughput (MB/s) Stride (words) Working set size (bytes) Pentium III Xeon 550 MHz 16 KB on-chip L1 d-cache 16 KB on-chip L1 i-cache 512 KB off-chip unified L2 cache L1 L2 Mem

CS 270 Reality #4: There’s more to system performance than asymptotic complexity Constant factors matter too! And even exact op count does not predict performance  Easily see 10:1 performance range depending on how code was written  Must optimize at multiple levels: algorithm, data representations, procedures, and loops Must understand system to optimize performance  How are programs compiled and executed  How do we measure program performance and identify bottlenecks  How do we improve performance without destroying code modularity and generality

CS 270 Example: Matrix Multiplication Standard desktop computer, vendor compiler, using optimization flags Both implementations have exactly the same operations count (2n 3 ) What is going on? 160x Triple loop Best code (K. Goto)

CS 270 MMM Plot: Analysis Memory hierarchy and other optimizations: 20x Vector instructions: 4x Multiple threads: 4x Each speedup due to taking advantage of increasingly complex system resources Effect: less register spills, less L1/L2 cache misses, less TLB misses

CS 270 Reality #5: Computers do more than just execute programs They need to get data in and out  I/O system is critical to program reliability and performance They communicate with each other over networks  Many system-level issues arise in presence of network  Concurrent operations by autonomous processes  Coping with unreliable media  Cross platform compatibility  Complex performance issues

CS 270 Slide Acknowledgements Slides to accompany textbook due to Bryant and O’Hallaron Technology Trends slides due to Dr. XXX Carle of UC/Berkeley Some graphs from Hennesey and Patterson: Computer Organization and Design, 4th Ed.