0% found this document useful (0 votes)
20 views27 pages

01 Intro

This document outlines the topics that will be covered in a course on the hardware/software interface. It introduces the instructor and teaching assistants. It discusses the importance of understanding both hardware and software, and how abstractions are used to manage complexity through different levels like machine code, assembly, and high-level languages.

Uploaded by

oreh2345
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views27 pages

01 Intro

This document outlines the topics that will be covered in a course on the hardware/software interface. It introduces the instructor and teaching assistants. It discusses the importance of understanding both hardware and software, and how abstractions are used to manage complexity through different levels like machine code, assembly, and high-level languages.

Uploaded by

oreh2345
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 27

University of Washington

The Hardware/Software Interface


CSE351 Autumn 2013

Instructor:
Gaetano Borriello

Teaching Assistants:
Peter Ney, Sunjay Cauligi, Ben Du,
Sara Hansen-Lund, Errol Limenta, Whitney Schmidt
University of Washington

Gaetano Borriello

At UW since 1988
PhD at UC Berkeley
MS at Stanford
BS at NYU Poly
costruzioni.net

Research trajectory:
Integrated circuits
Computer-aided design
Reconfigurable hardware
Embedded systems
Networked sensors espresso.repubblica.it
Ubiquitous computing
Mobile systems
Applications in developing world
Autumn 2013 Introduction 2
University of Washington

Who are you?


¢ Over 100 students

¢ Mostly majors, some non-majors

¢ Big fans of computer science, no doubt!

¢ Who has written a program:


§ in Java?
§ in C?
§ in Assembly language?
§ with multiple threads or processes?

Autumn 2013 Introduction 3


University of Washington

Quick Announcements
¢ Website: cs.uw.edu/351
¢ Section information to be updated soon…
¢ Lab 0 released, due Monday, 9/30 at 5pm
§ Basic exercises to start getting familiar with C
§ Credit/no-credit

Autumn 2013 Introduction 4


University of Washington

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?

a ce
te rf
In
/ SW
HW
Autumn 2013 Introduction 5
University of Washington

C/Java, assembly, and machine code


if (x != 0) y = (y+z)/x;

cmpl $0, -4(%ebp) 1000001101111100001001000001110000000000


je .L2 0111010000011000
movl -12(%ebp), %eax 10001011010001000010010000010100
movl -8(%ebp), %edx 10001011010001100010010100010100
leal (%edx, %eax), %eax 100011010000010000000010
movl %eax, %edx 1000100111000010
sarl $31, %edx 110000011111101000011111
idivl -4(%ebp) 11110111011111000010010000011100
movl %eax, -8(%ebp) 10001001010001000010010000011000
.L2:

Autumn 2013 Introduction 6


University of Washington

C/Java, assembly, and machine code


if (x != 0) y = (y+z)/x;

ê
cmpl $0, -4(%ebp) 1000001101111100001001000001110000000000
je .L2 0111010000011000
movl -12(%ebp), %eax 10001011010001000010010000010100
movl -8(%ebp), %edx è 10001011010001100010010100010100
leal (%edx, %eax), %eax 100011010000010000000010
movl %eax, %edx 1000100111000010
sarl $31, %edx ç 110000011111101000011111
idivl -4(%ebp) 11110111011111000010010000011100
movl %eax, -8(%ebp) 10001001010001000010010000011000
.L2:

l The three program fragments are equivalent


l You'd rather write C! - a more human-friendly language
l The hardware likes bit strings! - everything is voltages
l The machine instructions are actually much shorter than the number of
bits we would need to represent the characters in the assembly language
Autumn 2013 Introduction 7
University of Washington

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)

Hardware

Autumn 2013 Introduction 8


University of Washington

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 Assembler Hardware
asm

Autumn 2013 Introduction 9


University of Washington

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 C Assembler Hardware
in C compiler

Autumn 2013 Introduction 10


University of Washington

HW/SW Interface: Code / Compile / Run Times

Code Time Compile Time Run Time

User
program C Assembler Hardware
in C compiler

.c file .exe file

Note: The compiler and assembler are just programs, developed using
this same process.

Autumn 2013 Introduction 11


University of Washington

Outline for today


¢ Course themes: big and little
¢ Roadmap of course topics
¢ Three important realities
¢ How the course fits into the CSE curriculum
¢ Logistics

Autumn 2013 Introduction 12


University of Washington

The Big Theme: Interfaces and


Abstractions
¢ 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

Autumn 2013 Introduction 13


University of Washington

Roadmap Memory & data


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

Computer
system:

Autumn 2013 Introduction 14


University of Washington

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
Autumn 2013 Introduction 15
University of Washington

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)

Autumn 2013 Introduction 16


University of Washington

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”?
Autumn 2013 Introduction 17
University of Washington

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
§ More efficient at finding and eliminating bugs
§ Understand some of the many factors that influence program
performance
§ Facility with a couple more of the many languages that we use to
describe programs and data
¢ Prepare for later classes in CSE
Autumn 2013 Introduction 18
University of Washington

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.

Autumn 2013 Introduction 19


University of Washington

CSE351’s place in the CSE Curriculum


CSE477/481/490/etc.
Capstone and Project Courses

CSE352 CSE333 CSE451 CSE401 CSE461 CSE484 CSE466


HW Design Systems Prog Op Systems Compilers Networks Security Emb Systems

Performance Concurrency Distributed Execution


Model
Machine Systems
Comp. Arch. Code Real-Time
Control

CSE351 The HW/SW Interface:


underlying principles linking
hardware and software

CS 143
Intro Prog II

Autumn 2013 Introduction 20


University of Washington

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 dedicated hackers
§ 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

Autumn 2013 Introduction 21


University of Washington

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)

Autumn 2013 Introduction 22


University of Washington

Course Components
¢ Lectures (29)
§ 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
¢ Labs (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 currently scheduled for Wednesday, October 30, in class
§ Final is definitely Wednesday, December 11, in this same room

Autumn 2013 Introduction 23


University of Washington

Resources
¢ Course web page
§ 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
§ Poll: will be posted this week
¢ Staff e-mail: [email protected]
§ Things that are not appropriate for discussion board or better offline
¢ Anonymous feedback
§ Any comments about anything related to the course where you would
feel better not attaching your name
Autumn 2013 Introduction 24
University of Washington

Policies: Grading
¢ Exams (40%): 15% midterm, 25% final
¢ Written assignments (20%): weighted according to effort
§ We’ll try to make these about the same
¢ Lab assignments (40%): 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/13au/policies.html
§ http://www.cse.uw.edu/students/policies/misconduct

Autumn 2013 Introduction 25


University of Washington

Other details
¢ Consider taking CSE 390A, 1 credit, useful skills
¢ Poll on office hours (starting next week)
§ Monday late morning / afternoon
§ Tuesday late morning / afternoon
§ Wednesday late morning / afternoon
§ Thursday late morning / afternoon
§ Friday late morning / afternoon
¢ Lab 0 due Monday 5pm.
§ On the website
§ Non-majors: should be able to work without CSE accounts, but …
§ Install CSE home VM
§ Thursday section on C and tools

Autumn 2013 Introduction 26


University of Washington

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: Ben Wood, Hal Perkins, John Zahorjan, Peter Hornyack, Luis Ceze

Autumn 2013 Introduction 27

You might also like