CSE 351 Winter 2015 Instructor Luis Ceze Teaching Assistants Matthew Dorsett Eric Mackay Kaleo Brandt Graeme Britz Dylan Johnson Alfian Rizqi Who is Luis Approximate computing ID: 794597
Download The PPT/PDF document "The Hardware/Software Interface" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.
Slide1
The Hardware/Software InterfaceCSE 351 Winter 2015
Instructor: Luis CezeTeaching Assistants:Matthew Dorsett, Eric Mackay, Kaleo Brandt, Graeme Britz, Dylan Johnson, Alfian Rizqi
Slide2Who is Luis?
Approximate computing
New technologies and applications
DNA computing
Winter 2015
Slide3And the awesome 351 staff!
Winter 2015Eric: 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.
Slide4And the awesome 351 staff!
Winter 2015Hi 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!
Slide5And the awesome 351 staff!
Winter 2015Hello! 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!
Slide6Who are you?
About 86 registered, likely to be several more (to room capacity)CSE majors, EE majors, some want-to-be majorsBig fans of computer science, no doubt!Who has written a program:in Java?in C?in an assembly language?with multiple threads or processes?Winter 2015
Slide7Quick Announcements
Website: cse.uw.edu/351Lab 0 released, due Monday, 1/12 at 5pmMake sure you get our virtual machine set up and are able to do workBasic exercises to start getting familiar with CCredit/no-creditGet this done as quickly as possible For students not enrolled yet but want to: don’t forget the overload form!7Spring 2014
Introduction
Slide8The 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?
HW/SW Interface
Winter 2015
Slide9C/Java, assembly, and machine code
Winter 2015
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:
1000001101111100001001000001110000000000
0111010000011000
10001011010001000010010000010100
10001011010001100010010100010100
10001101000001000000001010001001110000101100000111111010000111111111011101111100001001000001110010001001010001000010010000011000
Assembly Language
High Level Language (e.g. C, Java)
Machine Code
Slide10C/Java, assembly, and machine code
Winter 2015
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:
1000001101111100001001000001110000000000
0111010000011000
10001011010001000010010000010100
10001011010001100010010100010100
10001101000001000000001010001001110000101100000111111010000111111111011101111100001001000001110010001001010001000010010000011000
Assembly Language
High Level Language
(e.g. C, Java)Machine Code
Compiler
Assembler
Slide11C/Java, assembly, and machine code
The three program fragments are equivalentYou'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 languageWinter 2015
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:
1000001101111100001001000001110000000000
0111010000011000
10001011010001000010010000010100
10001011010001100010010100010100
100011010000010000000010
1000100111000010
1100000111111010000111111111011101111100001001000001110010001001010001000010010000011000
Slide12HW/SW Interface: The Historical Perspective
Hardware started out quite primitiveHardware designs were expensive -> instructions had to be very simple – e.g., a single instruction for adding two integersSoftware was also very basicSoftware primitives reflected the hardware pretty closely
Hardware
Architecture Specification (Interface)
Winter 2015
Slide13HW/SW Interface: Assemblers
Life was made a lot better by assemblers1 assembly instruction = 1 machine instruction, but...different syntax: assembly instructions are character strings, not bit strings, a lot easier to read/write by humanscan use symbolic names
Hardware
Assembler specification
Assembler
Winter 2015
User program in
assembly language
Slide14HW/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
Hardware
C language specification
Assembler
C
compiler
Winter 2015
User program in C
Slide15HW/SW Interface: Code / Compile / Run Times
Hardware
Assembler
C
compiler
Code Time
Compile Time
Run Time
Note: The compiler and assembler are just programs, developed using
this same process.
.exe file
.
c
file
Winter 2015
User program in C
Slide16Outline for today
Course themes: big and littleRoadmap of course topicsHow the course fits into the CSE curriculumLogisticsWinter 2015
Slide17The 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 systemsWinter 2015
Slide18Roadmap
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();
get_mpg: pushq %rbp
movq %rsp, %rbp ... popq %rbp ret
Java:
C:
Assembly language:
Machine code:
0111010000011000
100011010000010000000010
1000100111000010
110000011111101000011111
Computer system:
OS:
Memory
& data
Integers
& floats
Machine code & C
x86
assembly
Procedures & stacks
Arrays & structs
Memory & caches
Processes
Virtual memory
Memory allocation
Java vs. C
Winter 2015
Slide19Little Theme 1: Representation
All digital systems represent everything as 0s and 1sThe 0 and 1 are really two different voltage ranges in the wires“Everything” includes:Numbers – integers and floating pointCharacters – the building blocks of stringsInstructions – the directives to the CPU that make up a programPointers – addresses of data objects stored away in memoryThese encodings are stored throughout a computer systemIn registers, caches, memories, disks, etc.They all need addressesA way to find themFind a new place to put a new item Reclaim the place in memory when data no longer neededWinter 2015
Slide20Little Theme 2: Translation
There is a big gap between how we think about programs and data and the 0s and 1s of computersNeed languages to describe what we meanLanguages need to be translated one step at a timeWords, phrases and grammarsWe know Java as a programming languageHave to work our way down to the 0s and 1s of computersTry 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
Slide21Little 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 programsOperating system has to orchestrate them all Each gets a share of computing cyclesThey may need to share system resources (memory, I/O, disks)Yielding and taking control of the processorVoluntary or “by force”? Winter 2015
Slide22Course 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 otherKnowledge of some of the details of underlying implementationsBecome more effective programmersUnderstand some of the many factors that influence program performanceMore efficient at finding and eliminating bugsFacility with a couple more of the many languages that we use to describe programs and dataPrepare for later classes in CSE
Winter 2015
Slide23CSE351’s role in the CSE Curriculum
Pre-requisites142 and 143: Intro Programming I and IIAlso recommended: 390A: System and Software ToolsOne of 6 core courses311: Foundations of Computing I312: Foundations of Computing II331: SW Design and Implementation332: Data Abstractions351: HW/SW Interface352: HW Design and Implementation351 provides the context for many follow-on coursesWinter 2015
Slide24CSE351’s place in the CSE Curriculum
CSE351CSE451Op Systems
CSE401
Compilers
Concurrency
CSE333
Systems
Prog
Performance
CSE484
Security
CSE466
Emb
Systems
CS
143
Intro
Prog
II
CSE352
HW Design
Comp. Arch.
CSE461
Networks
Translate
into
Assembly
Distributed
Systems
CSE477/481/490/etc.
Capstone and Project Courses
The HW/SW Interface:
underlying principles linking hardware and software
Execution
Model
Real-Time
Control
Winter 2015
Slide25Course Perspective
This course will make you a better programmer.Purpose is to show how software really worksBy understanding the underlying system, one can be more effective as a programmer.Better debuggingBetter basis for evaluating performanceHow multiple activities work in concert (e.g., OS and user programs)Not just a course for hardware enthusiasts!What every CSE major needs to knowJob interviewers love to ask questions from 351!Provide a context in which to place the other CSE courses you’ll take
Winter 2015
Slide26Textbooks
Computer Systems: A Programmer’s Perspective, 2nd EditionRandal 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
Slide27Course
ComponentsLectures (25+videos)Introduce the concepts; supplemented by textbook
Sections (10)Applied concepts, important tools and skills for labs, clarification of lectures, exam
review and preparationWritten 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 classFinal is Wednesday
,
Mar 18, in this same room, again!
Winter 2015
Slide28Resources
Course web pagecse.uw.edu/351
Schedule, policies, labs, homeworks, and everything else
Course discussion boardKeep 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
Slide29Policies: Grading
Exams (45%): 15% midterm, 30% finalWritten assignments (20%): weighted according to effortWe’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
Slide30Other details
Consider taking CSE 390A Unix Tools, 1 credit, useful skillsOffice hours will be held this week, check web page for timesLab 0, due Monday, 1/12 at 5pmOn the websiteInstall CSE home VM early, make sure it works for youBasic exercises to start getting familiar with CGet this done as quickly as possible Section ThursdayPlease install the virtual machine BEFORE coming to sectionBRING your computer with you to sectionWe will have some in-class activities to help you get started with lab 0
Winter 2015
Slide31Welcome to CSE351!
Let’s have funLet’s learn – togetherLet’s communicateLet’s make this a useful class for all of usMany 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 mineCMU: Randy Bryant, David O’Halloran, Gregory Kesden, Markus PüschelHarvard: Matt Welsh (now at Google-Seattle)UW: Gaetano Borriello, Luis Ceze, Peter Hornyack, Hal Perkins,
Ben Wood, John Zahorjan, Winter 2015