The Hardware/Software Interface CSE 351 Winter 2015

Slides:



Advertisements
Similar presentations
Introduction to Computer Programming I CSE 113
Advertisements

Computers in Principle & Practice I - V Deena Engel Computers in Principle and Practice I V , Sections 1 & 2 Fall, 2009 Deena Engel .
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: Staff, text, and policies Lecture topics and assignments Lab rationale and infrastructure F ’08 class01b.ppt.
Welcome to Introduction to Java Programming At J.D.O’Bryant Science & Mathematics Chonho Lee Department of Computer Science University of Massachusetts.
1 School of Computing Science Simon Fraser University CMPT 300: Operating Systems I Dr. Mohamed Hefeeda.
General information CSE 230 : Introduction to Software Engineering
CSCE 312 Computer Organization Lecture 0: Course Administration EJ Kim Department of Computer Science and Engineering 338B Bright
CS 213 Introduction to Computer Systems Course Organization David O’Hallaron August 28, 2001 Topics: Staff, text, and policies Lecture topics and assignments.
CS190/295 Programming in Python for Life Sciences: Lecture 1 Instructor: Xiaohui Xie University of California, Irvine.
COMP 321: Introduction to Computer Systems Scott Rixner Alan L. Cox
Winter 2015 COMP 2130 Introduction to Computer Systems Computing Science Thompson Rivers University Introduction and Overview.
CSE 501N Fall ‘09 00: Introduction 27 August 2009 Nick Leidenfrost.
COMP Introduction to Programming Yi Hong May 13, 2015.
University of Washington The Hardware/Software Interface CSE351 Summer 2013 Instructor: Benjamin Wood Teaching Assistants: Jacob Gile, Riley Klingler 1.
CS 106 Introduction to Computer Science I 01 / 25 / 2010 Instructor: Michael Eckmann.
1 Introduction to Operating Systems 9/16/2008 Lecture #1.
James Tam CPSC 203: Introduction To Computers (Independent Study) James Tam.
Intro to Architecture – Page 1 of 22CSCI 4717 – Computer Architecture CSCI 4717/5717 Computer Architecture Topic: Introduction Reading: Chapter 1.
1 A Simple but Realistic Assembly Language for a Course in Computer Organization Eric Larson Moon Ok Kim Seattle University October 25, 2008.
CS/ECE 3330 Computer Architecture Kim Hazelwood Fall 2009.
Introduction and Overview Summer 2014 COMP 2130 Introduction to Computer Systems Computing Science Thompson Rivers University.
University of Washington Roadmap 1 car *c = malloc(sizeof(car)); c->miles = 100; c->gals = 17; float mpg = get_mpg(c); free(c); Car c = new Car(); c.setMiles(100);
CSCI 51 Introduction to Computer Science Dr. Joshua Stough January 20, 2009.
Welcome!! CIT 593 Intro to Computer Systems aka “Introduction to Computer Architecture” Fall 2012.
1 CPRE210: Introduction to Digital Design Instructor –Arun K. Somani –Tel: – –Office Hours: MWF 10:00-11:00 Teaching Assistant.
University of Washington The Hardware/Software Interface CSE351 Spring 2013 (spring has sprung!) Instructor: Luis Ceze Teaching Assistants: Katelin Bailey,
CMSC 2021 CMSC 202 Computer Science II for Majors Fall 2002 Mr. Frey (0101 – 0104) Mr. Raouf (0201 – 0204)
+ Introduction to Class IST210 Class Lecture. + Course Objectives Understand the importance of data, databases, and database management Design and implement.
Course Introduction Bryce Boe 2013/09/30 CS24, Fall 2013.
University of Washington Today Finished up virtual memory On to memory allocation Lab 3 grades up HW 4 up later today. Lab 5 out (this afternoon): time.
Operating Systems Lecture 1 Jinyang Li. Class goals Understand how an OS works by studying its: –Design principles –Implementation realities Gain some.
Introduction Fall 2001 Foundations of Computer Systems Prerequisite:91.166* or * Section A Instructor: Dr. David Hutchinson Office:
University of Washington The Hardware/Software Interface CSE351 Autumn 2013 Instructor: Gaetano Borriello Teaching Assistants: Peter Ney, Sunjay Cauligi,
University of Washington Exceptional Control Flow The Hardware/Software Interface CSE351 Winter 2013.
CMSC 2021 CMSC 202 Computer Science II for Majors Spring 2002 Sections Ms. Susan Mitchell.
Copyright ©: Nahrstedt, Angrave, Abdelzaher1 University of Illinois at Urbana-Champaign Welcome to CS 241 Systems Programming University of Illinois at.
CMSC 2021 CMSC 202 Computer Science II for Majors Spring 2001 Sections Ms. Susan Mitchell.
CMSC 2021 CMSC 202 Computer Science II for Majors Spring 2003 Mr. Frey (0101 – 0104) Mr. Raouf (0201 – 0204)
CS 106 Introduction to Computer Science I 01 / 22 / 2007 Instructor: Michael Eckmann.
1 Introduction to C Programming 計算機程式設計 2/22/2012 朱浩華.
CS 213 Introduction to Computer Systems Course Organization David O’Hallaron August 25, 1998 Topics: Staff, text, and policies Lecture topics and assignments.
Review of the numeration systems The hardware/software representation of the computer and the coverage of that representation by this course. What is the.
Course Introduction David Ferry, Chris Gill Department of Computer Science and Engineering Washington University, St. Louis MO 1E81.
Introduction Computer Organization Spring 1436/37H (2015/16G) Dr. Mohammed Sinky Computer Architecture
Course Information CSE 2031 Fall Instructor U. T. Nguyen /new-yen/ Office: CSEB Office hours:  Tuesday,
1 CS/ECE 354 Fall 2013 “New, and improved!”. 2 Karen Miller Phone: CS.
Operating Systems CMPSC 473 Introduction and Overview August 24, Lecture 1 Instructor: Bhuvan Urgaonkar.
CS 213 Introduction to Computer Systems Course Organization Guy Blelloch and Bruce Maggs January 16, 2001 Topics: Staff, text, and policies Lecture topics.
Lecture 1 Introductions, Overviews, Operating Systems.
Copyright ©: Nahrstedt, Angrave, Abdelzaher, Caccamo1 University of Illinois at Urbana-Champaign Welcome to CS 241 Systems Programming University of Illinois.
Introduction and Overview Winter 2013 COMP 2130 Introduction to Computer Systems Computing Science Thompson Rivers University.
University of Washington The Hardware/Software Interface CSE 351 Autumn 2014 Instructor: Ruth Anderson Teaching Assistants: Matthew Dorsett, Dylan Johnson,
Welcome to The Hardware/Software Interface
The Hardware/Software Interface CSE351 Winter 2013
Final exam: Wednesday, March 20, 2:30pm
The Hardware/Software Interface CSE 351 Winter 2017
Roadmap C: Java: Assembly language: OS: Machine code: Computer system:
The Hardware/Software Interface CSE 351 Autumn 2016
CS190/295 Programming in Python for Life Sciences: Lecture 1
Andy Wang Operating Systems COP 4610 / CGS 5765
Andy Wang Operating Systems COP 4610 / CGS 5765
Andy Wang Operating Systems COP 4610 / CGS 5765
Andy Wang Operating Systems COP 4610 / CGS 5765
Andy Wang Operating Systems COP 4610 / CGS 5765
CSE 153 Design of Operating Systems Winter 2019
Andy Wang Operating Systems COP 4610 / CGS 5765
EECE.4810/EECE.5730 Operating Systems
CS201 – Course Expectations
Presentation transcript:

The Hardware/Software Interface CSE 351 Winter 2015 Instructor: Luis Ceze Teaching Assistants: Matthew Dorsett, Eric Mackay, Kaleo Brandt, Graeme Britz, Dylan Johnson, Alfian Rizqi How do we translate software down to hardware? How do we implement software using hardware?

Who is Luis? Approximate computing New technologies and applications DNA computing Winter 2015

And the awesome 351 staff! Eric: I’m a 2nd year PhD student researching computer architecture. My research interests include compilers and operating systems. I have a wife and 1 kid, plus one on the way. I enjoy weightlifting, cooking, hiking, and most other types of outdoor activities. Matt: I’m in my final quarter of the 5th-year Masters program, and I’ll start working at Microsoft in May. I really enjoy endurance sports; I have run the Boston Marathon the last two years, and I compete in triathlons up to the half-Ironman distance. Other hobbies of mine include bouldering, playing soccer, and riding my motorcycle way too fast. This is my 7th quarter TAing this class! Feel free to come to me for help, I hopefully will have an answer. Winter 2015

And the awesome 351 staff! Hi there, I’m Graeme. I’ll be graduating at the end of Fall 2015. I have lots of interests including hiking, dancing, linguistics, cognitive science, reading, and cooking. This was my first CSE majors course and I’m excited to TA for it! I'm Kaleo. This is my second quarter in the major, and it's a lot of fun! Besides computers, I enjoy reading, cooking, eating, and drawing. This is my first time as a TA, but please don't hesitate to ask questions! Winter 2015

And the awesome 351 staff! Hello! My name is Dylan. I'm a Junior and this is my second time TA'ing CSE 351. In my free time I enjoy rock climbing, reading science fiction quadrilogies, astrophotography, and programming video game emulators (after 351 you will be able to also!). Looking forward to a great quarter!  My name is Alfian Rizqi and I'm a junior. This is my 2nd quarter TAing this class. I have interest in sci-fi. I love it when it is snowing and my favorite sport is skiing. If you can guess where I'm from based on my shirt, you're awesome! Winter 2015

Who are you? About 86 registered, likely to be several more (to room capacity) CSE majors, EE majors, some want-to-be majors Big fans of computer science, no doubt! Who has written a program: in Java? in C? in an assembly language? with multiple threads or processes? Who knows: What a buffer overflow is? What a cache is? What virtual memory is? Winter 2015

Quick Announcements Website: cse.uw.edu/351 Lab 0 released, due Monday, 1/12 at 5pm Make sure you get our virtual machine set up and are able to do work Basic exercises to start getting familiar with C Credit/no-credit Get this done as quickly as possible For students not enrolled yet but want to: don’t forget the overload form! Automated Coursecasting is being used in this course. Recordings of the classes will be located at: http://www.css.washington.edu/course/CSE351A Access to the on-line recordings is limited to students enrolled in the class, and individuals who are listed in MyUW Classlists as Instructors. Students and Instructors will be prompted to logon with their UWNetID when they attempt to view the Screencasting Web pages. * Please note: University personnel engaged in a job related duty incident to employment may be monitoring classes, even if the class has been limited to instructors, teaching assistants, and students enrolled in the class. To watch a Screencast, click the Screencast link. Adobe Flash Player is required. Visit the Adobe Flash Player Download Center if Flash is not installed on your computer: http://www.adobe.com/products/flashplayer/ * Frequently asked questions about the Digital Audio Recording Service are located here: http://www.css.washington.edu/wiki/Frequently_Asked_Questions_about_On- Demand_Audio_Service * Automated Video Screencasting Service Terms of Use are located here: http://www.css.washington.edu/wiki/Automated_Video_Screencasting_Terms_of_Use * Digital Audio Recording Service Terms of Use are located here: http://www.css.washington.edu/wiki/On-Demand_Audio_Content_Terms_of_Use Spring 2014 Introduction

The Hardware/Software Interface What is hardware? software? What is an interface? Why do we need a hardware/software interface? Why do we need to understand both sides of this interface? This class: how to get from higher-level languages down to machine Many layers of abstraction Understand the interface: Understand how the computer works, debug, improve performance, HW/SW Interface Winter 2015

C/Java, assembly, and machine code High Level Language (e.g. C, Java) if (x != 0) y = (y+z)/x;  cmpl $0, -4(%ebp) je .L2 movl -12(%ebp), %eax movl -8(%ebp), %edx leal (%edx, %eax), %eax movl %eax, %edx sarl $31, %edx idivl -4(%ebp) movl %eax, -8(%ebp) .L2: Assembly Language  1000001101111100001001000001110000000000 0111010000011000 10001011010001000010010000010100 10001011010001100010010100010100 100011010000010000000010 1000100111000010 110000011111101000011111 11110111011111000010010000011100 10001001010001000010010000011000 Machine Code Winter 2015

C/Java, assembly, and machine code High Level Language (e.g. C, Java) if (x != 0) y = (y+z)/x;  Compiler  cmpl $0, -4(%ebp) je .L2 movl -12(%ebp), %eax movl -8(%ebp), %edx leal (%edx, %eax), %eax movl %eax, %edx sarl $31, %edx idivl -4(%ebp) movl %eax, -8(%ebp) .L2: Assembly Language  Assembler  1000001101111100001001000001110000000000 0111010000011000 10001011010001000010010000010100 10001011010001100010010100010100 100011010000010000000010 1000100111000010 110000011111101000011111 11110111011111000010010000011100 10001001010001000010010000011000 Machine Code Winter 2015

C/Java, assembly, and machine code if (x != 0) y = (y+z)/x; The three program fragments are equivalent You'd rather write C! - a more human-friendly language The hardware likes bit strings! - everything is voltages The machine instructions are actually much shorter than the number of bits we would need to represent the characters in the assembly language  cmpl $0, -4(%ebp) je .L2 movl -12(%ebp), %eax movl -8(%ebp), %edx leal (%edx, %eax), %eax movl %eax, %edx sarl $31, %edx idivl -4(%ebp) movl %eax, -8(%ebp) .L2:  1000001101111100001001000001110000000000 0111010000011000 10001011010001000010010000010100 10001011010001100010010100010100 100011010000010000000010 1000100111000010 110000011111101000011111 11110111011111000010010000011100 10001001010001000010010000011000 Winter 2015

HW/SW Interface: The Historical Perspective Hardware started out quite primitive Hardware designs were expensive -> instructions had to be very simple – e.g., a single instruction for adding two integers Software was also very basic Software primitives reflected the hardware pretty closely Architecture Specification (Interface) As we built bigger and more complex programs, we needed more abstractions Hardware Winter 2015

HW/SW Interface: Assemblers Life was made a lot better by assemblers 1 assembly instruction = 1 machine instruction, but... different syntax: assembly instructions are character strings, not bit strings, a lot easier to read/write by humans can use symbolic names Assembler specification User program in assembly language Hardware Assembler Winter 2015

HW/SW Interface: Higher-Level Languages Higher level of abstraction: 1 line of a high-level language is compiled into many (sometimes very many) lines of assembly language C language specification User program in C Hardware C compiler Assembler Translation from higher-level languages down to machine code. Winter 2015

HW/SW Interface: Code / Compile / Run Times Code Time Compile Time Run Time User program in C Hardware C compiler Assembler Program lifetime in 3 stages Compile time amortized Take a little longer compiling, optimize program. .c file .exe file Note: The compiler and assembler are just programs, developed using this same process. Winter 2015

Outline for today Course themes: big and little Roadmap of course topics How the course fits into the CSE curriculum Logistics Winter 2015

The Big Theme: Abstractions and Interfaces Computing is about abstractions (but we can’t forget reality) What are the abstractions that we use? What do YOU need to know about them? When do they break down and you have to peek under the hood? What bugs can they cause and how do you find them? How does the hardware (0s and 1s, processor executing instructions) relate to the software (C/Java programs)? Become a better programmer and begin to understand the important concepts that have evolved in building ever more complex computer systems Winter 2015

Roadmap C: Java: Assembly language: OS: Machine code: Computer system: Memory & data Integers & floats Machine code & C x86 assembly Procedures & stacks Arrays & structs Memory & caches Processes Virtual memory Memory allocation Java vs. C C: Java: car *c = malloc(sizeof(car)); c->miles = 100; c->gals = 17; float mpg = get_mpg(c); free(c); Car c = new Car(); c.setMiles(100); c.setGals(17); float mpg = c.getMPG(); Assembly language: get_mpg: pushq %rbp movq %rsp, %rbp ... popq %rbp ret OS: Machine code: 0111010000011000 100011010000010000000010 1000100111000010 110000011111101000011111 Computer system: Winter 2015

Little Theme 1: Representation All digital systems represent everything as 0s and 1s The 0 and 1 are really two different voltage ranges in the wires “Everything” includes: Numbers – integers and floating point Characters – the building blocks of strings Instructions – the directives to the CPU that make up a program Pointers – addresses of data objects stored away in memory These encodings are stored throughout a computer system In registers, caches, memories, disks, etc. They all need addresses A way to find them Find a new place to put a new item Reclaim the place in memory when data no longer needed Winter 2015

Little Theme 2: Translation There is a big gap between how we think about programs and data and the 0s and 1s of computers Need languages to describe what we mean Languages need to be translated one step at a time Words, phrases and grammars We know Java as a programming language Have to work our way down to the 0s and 1s of computers Try not to lose anything in translation! We’ll encounter Java byte-codes, C language, assembly language, and machine code (for the X86 family of CPU architectures) Winter 2015

Little Theme 3: Control Flow How do computers orchestrate the many things they are doing? In one program: How do we implement if/else, loops, switches? What do we have to keep track of when we call a procedure, and then another, and then another, and so on? How do we know what to do upon “return”? Across programs and operating systems: Multiple user programs Operating system has to orchestrate them all Each gets a share of computing cycles They may need to share system resources (memory, I/O, disks) Yielding and taking control of the processor Voluntary or “by force”? Winter 2015

Course Outcomes Foundation: basics of high-level programming (Java) Understanding of some of the abstractions that exist between programs and the hardware they run on, why they exist, and how they build upon each other Knowledge of some of the details of underlying implementations Become more effective programmers Understand some of the many factors that influence program performance More efficient at finding and eliminating bugs Facility with a couple more of the many languages that we use to describe programs and data Prepare for later classes in CSE Winter 2015

CSE351’s role in the CSE Curriculum Pre-requisites 142 and 143: Intro Programming I and II Also recommended: 390A: System and Software Tools One of 6 core courses 311: Foundations of Computing I 312: Foundations of Computing II 331: SW Design and Implementation 332: Data Abstractions 351: HW/SW Interface 352: HW Design and Implementation 351 provides the context for many follow-on courses Winter 2015

CSE351’s place in the CSE Curriculum CSE477/481/490/etc. Capstone and Project Courses CSE352 HW Design CSE333 Systems Prog CSE451 Op Systems CSE401 Compilers CSE461 Networks CSE484 Security CSE466 Emb Systems Execution Model Performance Translate into Assembly Distributed Systems Concurrency Comp. Arch. Real-Time Control CSE351 The HW/SW Interface: underlying principles linking hardware and software CS 143 Intro Prog II Winter 2015

Course Perspective This course will make you a better programmer. Purpose is to show how software really works By understanding the underlying system, one can be more effective as a programmer. Better debugging Better basis for evaluating performance How multiple activities work in concert (e.g., OS and user programs) Not just a course for hardware enthusiasts! What every CSE major needs to know Job interviewers love to ask questions from 351! Provide a context in which to place the other CSE courses you’ll take Winter 2015

Textbooks Computer Systems: A Programmer’s Perspective, 2nd Edition Randal E. Bryant and David R. O’Hallaron Prentice-Hall, 2010 http://csapp.cs.cmu.edu This book really matters for the course! How to solve labs Practice problems typical of exam problems A good C book – any will do The C Programming Language (Kernighan and Ritchie) C: A Reference Manual (Harbison and Steele) Winter 2015

Course Components Lectures (25+videos) Sections (10) Introduce the concepts; supplemented by textbook Sections (10) Applied concepts, important tools and skills for labs, clarification of lectures, exam review and preparation Written homework assignments (4) Mostly problems from text to solidify understanding Programming labs/assignments (5, plus “lab 0”) Provide in-depth understanding (via practice) of an aspect of system Exams (midterm + final) Test your understanding of concepts and principles Midterm is scheduled for Monday, February 9, in class Final is Wednesday, Mar 18, in this same room, again! Winter 2015

Resources Course web page Course discussion board cse.uw.edu/351 Schedule, policies, labs, homeworks, and everything else Course discussion board Keep in touch outside of class – help each other Staff will monitor and contribute Course mailing list – check your @uw.edu Low traffic – mostly announcements; you are already subscribed Office hours, appointments, drop-ins We spread our office hours throughout the week Staff e-mail: cse351-tas@cse.uw.edu For things that are not appropriate for the discussion board Anonymous feedback Any comments about anything related to the course where you would feel better not attaching your name (we’ll provide a response in class) Winter 2015

Policies: Grading Exams (45%): 15% midterm, 30% final Written assignments (20%): weighted according to effort We’ll try to make these about the same Lab assignments (35%): weighted according to effort These will likely increase in weight as the quarter progresses Late days: 3 late days to use as you wish throughout the quarter – see website Collaboration: http://www.cse.uw.edu/education/courses/cse351/15wi/policies.html http://www.cse.uw.edu/students/policies/misconduct Winter 2015

Other details Consider taking CSE 390A Unix Tools, 1 credit, useful skills Office hours will be held this week, check web page for times Lab 0, due Monday, 1/12 at 5pm On the website Install CSE home VM early, make sure it works for you Basic exercises to start getting familiar with C Get this done as quickly as possible Section Thursday Please install the virtual machine BEFORE coming to section BRING your computer with you to section We will have some in-class activities to help you get started with lab 0 Winter 2015

Welcome to CSE351! Let’s have fun Let’s learn – together Let’s communicate Let’s make this a useful class for all of us Many thanks to the many instructors who have shared their lecture notes – I will be borrowing liberally through the qtr – they deserve all the credit, the errors are all mine CMU: Randy Bryant, David O’Halloran, Gregory Kesden, Markus Püschel Harvard: Matt Welsh (now at Google-Seattle) UW: Gaetano Borriello, Luis Ceze, Peter Hornyack, Hal Perkins, Ben Wood, John Zahorjan, Winter 2015