Carnegie Mellon About the New Slides for Introduction to Computer Systems 15-213/18-243, spring 2009 Markus Püschel Electrical and Computer Engineering.

Slides:



Advertisements
Similar presentations
Machine-Level Programming III: Procedures Feb. 8, 2000 Topics IA32 stack Stack-based languages Stack frames Register saving conventions Creating pointers.
Advertisements

Carnegie Mellon Today Program optimization  Optimization blocker: Memory aliasing  Out of order processing: Instruction level parallelism  Understanding.
CS 4284 Systems Capstone Godmar Back Processes and Threads.
University of Washington Procedures and Stacks II The Hardware/Software Interface CSE351 Winter 2013.
1 Homework / Exam Turn in mp2 at start of class today Reading –PAL, pp 3-6, Exam #1 next class –Open Book / Open Notes –NO calculators or other.
University of Washington Last Time For loops  for loop → while loop → do-while loop → goto version  for loop → while loop → goto “jump to middle” version.
Machine-Level Programming III: Procedures Apr. 17, 2006 Topics IA32 stack discipline Register saving conventions Creating pointers to local variables CS213.
PC hardware and x86 3/3/08 Frans Kaashoek MIT
1 Function Calls Professor Jennifer Rexford COS 217 Reading: Chapter 4 of “Programming From the Ground Up” (available online from the course Web site)
Machine-Level Programming III: Procedures Sept. 17, 2007 IA32 stack discipline Register saving conventions Creating pointers to local variablesx86-64 Argument.
– 1 – , F’02 ICS05 Instructor: Peter A. Dinda TA: Bin Lin Recitation 4.
1 Homework Reading –PAL, pp , Machine Projects –Finish mp2warmup Questions? –Start mp2 as soon as possible Labs –Continue labs with your.
Machine-Level Programming III: Procedures Jan 30, 2003
Assembly תרגול 8 פונקציות והתקפת buffer.. Procedures (Functions) A procedure call involves passing both data and control from one part of the code to.
Lecture 25 Generating Code for Basic Blocks Topics Code Generation Readings: April 19, 2006 CSCE 531 Compiler Construction.
Machine-Level Programming III: Procedures Sept. 15, 2006 IA32 stack discipline Register saving conventions Creating pointers to local variablesx86-64 Argument.
Stack Activation Records Topics IA32 stack discipline Register saving conventions Creating pointers to local variables February 6, 2003 CSCE 212H Computer.
6.828: PC hardware and x86 Frans Kaashoek
Carnegie Mellon Introduction to Computer Systems /18-243, spring 2009 Recitation, Jan. 14 th.
1 Carnegie Mellon Stacks : Introduction to Computer Systems Recitation 5: September 24, 2012 Joon-Sup Han Section F.
Ithaca College Machine-Level Programming IV: IA32 Procedures Comp 21000: Introduction to Computer Systems & Assembly Lang Spring 2013 * Modified slides.
University of Washington Today More on procedures, stack etc. Lab 2 due today!  We hope it was fun! What is a stack?  And how about a stack frame? 1.
Code Generation Gülfem Savrun Yeniçeri CS 142 (b) 02/26/2013.
Fabián E. Bustamante, Spring 2007 Machine-Level Programming III - Procedures Today IA32 stack discipline Register saving conventions Creating pointers.
Recitation 2 – 2/11/02 Outline Stacks & Procedures Homogenous Data –Arrays –Nested Arrays Mengzhi Wang Office Hours: Thursday.
Recitation 2: Outline Assembly programming Using gdb L2 practice stuff Minglong Shao Office hours: Thursdays 5-6PM Wean Hall.
Assembly תרגול 5 תכנות באסמבלי. Assembly vs. Higher level languages There are NO variables’ type definitions.  All kinds of data are stored in the same.
University of Washington Today Lab 2 due next Monday! Finish-up control flow Switch statements 1.
About the Slides for Introduction to Computer Systems : Introduction to Computer Systems 0th Lecture, Sep. 1, 2015 Markus Püschel ETH Zurich (with.
1 Carnegie Mellon Machine-Level Programming II: Arithmetic and Control Lecture, Feb. 28, 2012 These slides are from website which.
Machine-level Programming III: Procedures Topics –IA32 stack discipline –Register saving conventions –Creating pointers to local variables.
1 Procedure Call and Array. 2 Outline Data manipulation Control structure Suggested reading –Chap 3.7, 3.8.
Carnegie Mellon 1 Machine-Level Programming I: Basics Lecture, Feb. 21, 2013 These slides are from website which accompanies the.
University of Amsterdam Computer Systems – the instruction set architecture Arnoud Visser 1 Computer Systems The instruction set architecture.
University of Washington x86 Programming II The Hardware/Software Interface CSE351 Winter 2013.
1 Assembly Language: Function Calls Jennifer Rexford.
Recitation 2 – 2/11/02 Outline Stacks & Procedures Homogenous Data –Arrays –Nested Arrays Structured Data –struct s / union s –Arrays of structs.
Machine-Level Programming 2 Control Flow Topics Condition Codes Setting Testing Control Flow If-then-else Varieties of Loops Switch Statements.
A job ad at a game programming company
Assembly function call convention
Reading Condition Codes (Cont.)
Machine-Level Programming 2 Control Flow
Credits and Disclaimers
C function call conventions and the stack
IA32 Processors Evolutionary Design
Conditional Branch Example
Homework Reading Machine Projects Labs PAL, pp ,
Recitation 2 – 2/11/02 Outline Stacks & Procedures
Homework In-line Assembly Code Machine Language
Recitation 2 – 2/4/01 Outline Machine Model
Assembly Language Programming V: In-line Assembly Code
Machine-Level Programming II: Arithmetic & Control
Machine-Level Programming 1 Introduction
Computer Architecture adapted by Jason Fritts then by David Ferry
Machine-Level Programming 4 Procedures
Instructor: David Ferry
Condition Codes Single Bit Registers
Machine-Level Programming 2 Control Flow
Instructors: Majd Sakr and Khaled Harras
Assembly Language Programming II: C Compiler Calling Sequences
Machine-Level Programming 2 Control Flow
Machine-Level Programming III: Procedures Sept 18, 2001
Machine-Level Representation of Programs III
Machine-Level Programming 2 Control Flow
Instructors: Majd Sakr and Khaled Harras
Machine-Level Programming: Introduction
Machine-Level Programming II: Control Flow
Credits and Disclaimers
Presentation transcript:

Carnegie Mellon About the New Slides for Introduction to Computer Systems /18-243, spring 2009 Markus Püschel Electrical and Computer Engineering

Carnegie Mellon Brief Summary In spring 2009 I redesigned and unified almost the entire slide set Course website: Exceptions (see above website):  Lecture 2: bits and bytes  Lecture 24: web services  Lecture 25: concurrency  Lecture 27: Multi core architectures  Some slides that are in the ppt but were hidden for that term Some parts where updated and some material added  mostly program optimizations/floating point parts: lectures 9-12 The website has also scanned notes  includes a few new visualizations  Do: ls *notes* in the lectures directory

Carnegie Mellon On the Design All slides are in Powerpoint 2007 (PC version) Probably could be edited using Powerpoint 2003 plus  File format plugin File format plugin  Calibri font Calibri font  I would still recommend to use 2007 for editing Design is suitable for printing out slides  Only light colors, in particular for boxes Some slides have covered areas (that disappear later) suitable for quizzing in class The design follows the Small Guide to Giving PresentationsSmall Guide to Giving Presentations Next slides: Color/format conventions

Carnegie Mellon Style for Code /* * hello.c - Pthreads "hello, world" program */ #include "csapp.h" void *thread(void *vargp); int main() { pthread_t tid; Pthread_create(&tid, NULL, thread, NULL); Pthread_join(tid, NULL); exit(0); } /* thread routine */ void *thread(void *vargp) { printf("Hello, world!\n"); return NULL; }

Carnegie Mellon Style for Code and Alternative Code C Code int fact_do(int x) { int result = 1; do { result *= x; x = x-1; } while (x > 1); return result; } Goto Version int fact_goto(int x) { int result = 1; loop: result *= x; x = x-1; if (x > 1) goto loop; return result; }

Carnegie Mellon Style for Assembly Code: Version I int absdiff(int x, int y) { int result; if (x > y) { result = x-y; } else { result = y-x; } return result; } absdiff: pushl %ebp movl %esp, %ebp movl 8(%ebp), %edx movl 12(%ebp), %eax cmpl %eax, %edx jle.L7 subl %eax, %edx movl %edx, %eax.L8: leave ret.L7: subl %edx, %eax jmp.L8 Body1 Setup Finish Body2

Carnegie Mellon Style for Assembly Code: Version II struct rec { int i; int a[3]; int *p; }; # %edx = r movl (%edx),%ecx# r->i leal 0(,%ecx,4),%eax# 4*(r->i) leal 4(%edx,%eax),%eax# r+4+4*(r->i) movl %eax,16(%edx)# Update r->p void set_p(struct rec *r) { r->p = &r->a[r->i]; }

Carnegie Mellon Linux Command Prompt linux>./badcnt BOOM! cnt= linux>./badcnt BOOM! cnt= linux>./badcnt BOOM! cnt=

Carnegie Mellon Stack and Registers Return Addr Saved Registers + Local Variables Argument Build Old %ebp Arguments Caller Frame %ebp %esp %eax %edx %ecx %ebx %esi %edi %esp %ebp Caller-Save Callee-Save Special

Carnegie Mellon Bar Plot CPU Seconds String Length

Carnegie Mellon Tables MachineNoconaCore 2 rfact fact Cycles per element (or per mult) MethodInt (add/mult)Float (add/mult) combine unroll unroll2-ra bound Some instructions take > 1 cycle, but can be pipelined InstructionLatencyCycles/Issue Load / Store51 Integer Multiply101 Integer/Long Divide36/10636/106 Single/Double FP Multiply72 Single/Double FP Add52 Single/Double FP Divide32/4632/46

Carnegie Mellon Color Palette Boxes/areas:  Assembly, memory, …  Linux, memory, …  Code, …  Code, registers, …  Registers, …  Memory, … Occasionally I use darker versions of the colors above Text:  Emphasizing something in the text  Comments inside yellow code boxes