CPSC 213. Introduction to Computer Systems. About the Course. Course Policies. Reading. Introduction. Unit 0

Similar documents
CPSC 213. Introduction to Computer Systems. Introduction. Unit 0

CPS104 Computer Organization Lecture 1. CPS104: Computer Organization. Meat of the Course. Robert Wagner

CPS104 Computer Organization Lecture 1

EECE 321: Computer Organization

Introduction to Computing Systems: From Bits and Gates to C and Beyond 2 nd Edition

CS 150 Introduction to Computer Science 1

CS61C : Machine Structures

Outline. Intro. Week 1, Fri Jan 4. What is CG used for? What is Computer Graphics? University of British Columbia CPSC 314 Computer Graphics Jan 2013

Intro. Week 1, Fri Jan 4

IT 252 Computer Organization and Architecture. Introduction. Chia-Chi Teng

COMP251: Algorithms and Data Structures. Jérôme Waldispühl School of Computer Science McGill University

Please put your cellphone on vibrate

Announcements. 1. Forms to return today after class:

Introduction to Computer Systems

CS61C Machine Structures. Lecture 1 Introduction. 8/27/2006 John Wawrzynek (Warzneck)

CSE 141 Computer Architecture Spring Lecture 3 Instruction Set Architecute. Course Schedule. Announcements

CSC 326H1F, Fall Programming Languages. What languages do you know? Instructor: Ali Juma. A survey of counted loops: FORTRAN

Computer Architecture. Fall Dongkun Shin, SKKU

Lecture 3 Machine Language. Instructions: Instruction Execution cycle. Speaking computer before voice recognition interfaces

TTh 9.25 AM AM Strain 322

CPE300: Digital System Architecture and Design

CSC Operating Systems Fall Lecture - I Introduction. Tevfik Ko!ar. Louisiana State University. August 25 th, Contact Information

CS 61C: Great Ideas in Computer Architecture Introduction to Assembly Language and RISC-V Instruction Set Architecture

CPSC 313, 04w Term 2 Midterm Exam 2 Solutions

CS240: Programming in C

Introduction to Computer Systems

Welcome to CS 241 Systems Programming at Illinois

Introduction to Computer Systems

Searching for Information. A Simple Method for Searching. Simple Searching. Class #21: Searching/Sorting I

Review: Performance Latency vs. Throughput. Time (seconds/program) is performance measure Instructions Clock cycles Seconds.

378: Machine Organization and Assembly Language

Basic Concepts COE 205. Computer Organization and Assembly Language Dr. Aiman El-Maleh

Welcome to CS 241 Systems Programming at Illinois

Chris Riesbeck, Fall Introduction to Computer Systems

CSE 114, Computer Science 1 Course Information. Spring 2017 Stony Brook University Instructor: Dr. Paul Fodor

CS270 Computer Organization Fall 2017

COMP Data Structures

CISC 124: Introduction To Computing Science II

COMP Data Structures

a number of pencil-and-paper(-and-calculator) questions two Intel assembly programming questions

CS61C : Machine Structures

Review! Lecture 5 C Memory Management !

CMPE012 Computer Engineering 12 (and Lab) Computing Systems and Assembly Language Programming. Summer 2009

CS61C : Machine Structures

Tutorials. Tutorial every Friday at 11:30 AM in Toldo 204 * discuss the next lab assignment

ENCM 369 Winter 2019 Lab 6 for the Week of February 25

Computer Systems. Binary Representation. Binary Representation. Logical Computation: Boolean Algebra

KOMAR UNIVERSITY OF SCIENCE AND TECHNOLOGY (KUST)

EE 209: Programming Structures for Electrical Engineering

CSC116: Introduction to Computing - Java

Midterms Save the Dates!

CIS*1500 Introduction to Programming

Winter 2006 FINAL EXAMINATION Auxiliary Gymnasium Tuesday, April 18 7:00pm to 10:00pm

MARIE: An Introduction to a Simple Computer

CPSC 121: Models of Computation. Module 10: A Working Computer

Spring 2014 Midterm Exam Review

CS 241 Data Organization. August 21, 2018

Welcome to Solving Problems with Computers I

Central Washington University Department of Computer Science Course Syllabus

Inf2C - Computer Systems Lecture 1 Course overview & the big picture

UC Berkeley CS61C : Machine Structures

ECE232: Hardware Organization and Design

Computer Architecture EE 4720 Midterm Examination

Computer Architecture 2/26/01 Lecture #

14:332:331. Lecture 1

CSC209H Lecture 1. Dan Zingaro. January 7, 2015

Computer Science 324 Computer Architecture Mount Holyoke College Fall Topic Notes: MIPS Instruction Set Architecture

CSC116: Introduction to Computing - Java

Computer Systems Organization

Chapter 2. OS Overview

CMPSCI 201: Architecture and Assembly Language

CS 152 Computer Architecture and Engineering Lecture 1 Single Cycle Design

[301] Introduction. Tyler Caraza-Harter

CS 61C: Great Ideas in Computer Architecture Intro to Assembly Language, MIPS Intro

Advanced Programming CMPS 109

CSC258: Computer Organization. Memory Systems

Introduction to Programming System Design CSCI 455x (4 Units)

Slide Set 5. for ENCM 369 Winter 2014 Lecture Section 01. Steve Norman, PhD, PEng

Instruction Set Architectures. Part 1

CS 61C: Great Ideas in Computer Architecture RISC-V Instruction Formats

9/14/17. Levels of Representation/Interpretation. Big Idea: Stored-Program Computer

CS 241 Data Organization using C

Computer Organization Chapter 4. Prof. Qi Tian Fall 2013

Operating Systems (ECS 150) Spring 2011

Introduction to Computer Systems

CS/SE3SH3 Operating Systems

ENCM 501 Winter 2017 Assignment 3 for the Week of January 30

ECE232: Hardware Organization and Design

CS 4349 Lecture August 21st, 2017

Topic Notes: MIPS Instruction Set Architecture

CS61C : Machine Structures

ENCM 501 Winter 2015 Assignment 3 for the Week of February 2

Spring 2017 :: CSE 506. Introduction. Nima Honarmand

Computer Systems and Networks. ECPE 170 Jeff Shafer University of the Pacific. MIPS Assembly

CS120 Computer Science I. Instructor: Jia Song

CS 150 Introduction to Computer Science 1. August 31, 2009

CS 0449 Intro to Systems Software Fall Term: 2181

CS 61C: Great Ideas in Computer Architecture. Direct Mapped Caches

CS 61C: Great Ideas in Computer Architecture Intro to Assembly Language, MIPS Intro

University of British Columbia CPSC 111, Intro to Computation Jan-Apr 2006 Tamara Munzner

Transcription:

About the Course it's all on the web page... http://www.ugrad.cs.ubc.ca/~cs213/winter1t1/ - news, admin details, schedule and readings CPSC 213 - lecture slides (always posted before class) - 213 Companion (free PDF) - course wiki (coming soon) for discussion - updated often, don't forget to reload page! Introduction to Computer Systems me instructor: Tamara Munzner - call me Tamara or Dr. Munzner, as you like Unit - office hours X661 9am-11am Mondays or by appointment Xwing entrances facing Dempster this elevator to X6 me! Introduction 2 1 2 Reading Course Policies see web page for exact schedule textbook: Bryant and O'Hallaron also used in CPSC 313 followon course ok to use either 1st or 2nd edition (very little difference for us) read http://www.ugrad.cs.ubc.ca/~cs213/winter1t1/policies.html marking labs: 1% - 1 assignments (same thing, no separate lab material) - one week for each, out Monday morning and due Sunday 6pm UBC Bookstore textbook delay publisher's problem ETA Sep 1 quizzes: 1%, best 3 out of 4-1/6, 1/2, 11/3, 11/2 first 2 min of class midterm: 2% - Wed 1/27, full class session catch up as soon as you can! final: 4% - date TBD. do not book tickets out of town until announced! must pass labs and final (% or better) to pass course regrading detailed argument in writing wait 24 hours after work/solutions returned email TA first for assignments, then instructor if not resolved bring paper to instructor for quizzes/midterms 3 3 4 4

Late/Missed Work, Illness Plagiarism and Cheating no late work accepted work together! but don t cheat! email me immediately if you'll miss lab/exam from illness written documentation due within 7 days after you return to school copy of doctor's note or other proof (ICBC accident report, etc) never present anyone else s work as your own but, don t let this stop you from helping each other learn... - general discussion always fine - one-hour context switch rule for specific discussions don't take written notes do something else for an hour written cover sheet with dates of absence and list of work missed I'll decide on how to handle might give extension if solutions not out yet then sit down to do the work on your own - proper attribution include list of names if you had significant discussions with others not allowed - working as a team and handing in joint work as your own might grade you only on completed work - looking at somebody else's paper or smuggling notes into exam - getting or giving code, electronically or hardcopy - typing in code from somebody else's screen - using code from previous terms - paying somebody to write your code it's a bad idea: you don't learn the stuff, and we'll probably catch you - I do prosecute, so that it's a level playing field for everybody else - possible penalties: for the work, for the course, suspended, permanent notation in transcript... 6 Overview of the course What you will get out of this... 6 Hardware context of a single executing program Become a better programmer by hardware context is CPU and Main Memory deepening your understand of how programs execute develop CPU architecture to implement C and Java learning to build concurrent and distributed programs differentiate compiler (static) and runtime (dynamic) computation Learn to design real systems by System context of multiple executing programs with IO evaluating design trade-offs through examples extend context to add IO, concurrency and system software distinguish static and dynamic system components and techniques thread abstraction to hide IO asynchrony and to express concurrency Impress your friends and family by synchronization to manage concurrency virtual memory to provide multi-program, single-system model telling them what a program really is hardware protection to encapsulate operating system message-passing to communicate between processes and machines GOAL: To develop a model of computation that is rooted in what really happens when programs execute. 7 8

What happens what a program runs Here s a program class SortedList { static SortedList alist; int size; int list[]; What do you know now? void insert (int avalue) { int i = ; while (list[i] <= avalue) i++; for (int j=size-1; j>=i; j--) list[j+1] = list[j]; list[i] = avalue; size++; What do you understand about the execution of insert? 9 Example Data structures class SortedList { static SortedList alist; int size; int list[]; list stores { 1, 3,, 7, 9 SortedList.aList.insert(6) is called Data structures draw a diagram of the data structures as they exist just before insert is called 1 lets dig a little deeper void insert (int avalue) { int i = ; while (list[i] <= avalue) i++; for (int j=size-1; j>=i; j--) list[j+1] = list[j]; list[i] = avalue; size++; which of these existed before program started? - these are the static features of the program which were created by execution of program? - these are the dynamic features of the program SortList Class SortList Class alist alist a SortedList Object size list 1 3 7 9 class SortedList { static SortedList alist; int size; int list[]; assuming list[] was initialized to store 1 elements: a SortedList Object size list list = new Integer[1]; 11 void insert (int avalue) { int i = ; while (list[i] <= avalue) i++; for (int j=size-1; j>=i; j--) list[j+1] = list[j]; list[i] = avalue; size++; Static: 1 3 7 9 * class and alist variable (sort of - clearer in C) Dynamic: * * * * SortedList object size and list variables value of alist, size and list list of 1 integers 12

Execution of insert how would you describe this execution? carefully, step by step? Sequence of Instructions * program order * changed by control-flow structures save location of SortedList.aList.insert(6) avalue = 6 i = goto end-while if list[i]>avalue (1>6) i = +1 (1) goto end-while if list[i]>avalue (3>6) i = 1+1 (2) goto end-while if list[i]>avalue (>6) i = 2+1 (3) goto end-while if list[i]>avalue (7>6) end-while: j = size-1 (4) goto end-if if j<i (4<3) list[j+1] = list[i] (list[]=9) j = 4-1 (3) goto end-if if j<i (3<3) list[j+1] = list[i] (list[4]=7) j = 3-1 (2) goto end-if if j<i (2<3) end-if: list[i] = avalue (list[3] = 6) size = size+1 (6) statement after SortedList.aList.insert(6) class SortedList { static SortedList alist; int size; int list[]; void insert (int avalue) { int i = ; while (list[i] <= avalue) i++; for (int j=size-1; j>=i; j--) list[j+1] = list[j]; list[i] = avalue; size++; Instruction Types? * read/write variable * arithmetic * conditional goto Execution: What you Already Knew Data structures variables have a storage location and a value some variables are created before the program starts some variables are created by the program while it runs variable values can be set before program runs or by the execution Execution of program statements execution is a sequence of steps sequence-order can be changed by certain program statements each step executes an instruction instructions access variables, do arithmetic, or change control flow 13 Readings 14 Companion 1-2.1 An Overview of Computation 1 16

Phases of Computation Examples of Static vs Dynamic State Human Creation Compilation Execution Static state in Java Source Code Object Code Dynamic State Human creation design program and describe it in high-level language Compilation convert high-level, human description into machine-executable text Execution a physical machine executes the text parameterized by input values that are unknown at compilation producing output values that are unknowable at compilation Two important initial definitions Dynamic state in Java anything that can be determined before execution is called static anything that can only be determined during execution is called dynamic A Simple Machine that can Compute 17 18 CPU Memory Memory stores programs and data everything in memory has a unique name: its memory location (address) two operations: read or write value at location X CPU machine that executes programs to transform memory state loads program from memory on demand one step at a time The Simple Machine Model A Closer Look each step may also read or write memory Not in the Simple Machine I/O Devices such as mouse, keyboard, graphics, disk and network we will deal with these other things in the second half of the course 19 2

How do we start? Generalizing the Adder One thing we need to do is add integers What other things do we want to do with Integers you already know how to do this from 121 (hopefully :)) A 32-bit Adder implemented using logic gates implemented by transistors it adds bits one at a time, with carry-out, just like in grade 2. INPUT register INPUT register What do we do with the value in the output register + OUTPUT register and 21 22 Arithmetic and Logic Unit () generalizes ADDER to perform many operations on integers three inputs: two source operands (vala, valb) and a operation code () output value (vale) = operation-code (operand, operand1) : vala valb vale generalizes input and output registers of ADDER a single bank of registers that can be used for input or output registers named by numbers: two source (, ) and one destination () Functional View input for one step:,,, and a program is a sequence of these steps (and others) : vala valb vale and 23 24

Putting Initial Values into Registers Current model is too restrictive to add two numbers the numbers must be in registers programs must specify values explicitly Extend model to include immediates : vala valb vale an immediate value is a constant specified by a program instruction valc extend model to allow some instructions to specify an immediate (valc) Functional View : vala valb vale we now have an additional input, the immediate value, valc valc valc and Memory Access 2 The Simple Machine CPU/core 26 Memory is an array of bytes, indexed by byte address Memory access is restricted to a transfer between registers and memory the is thus unchanged, it still takes operands from registers this is approach taken by Reduced Instruction Set Computers (RISC) Extending model to include RISC-like memory access opcode selects from set of memory-access and operations memory address and value are in registers : Memory Central Processing Unit or Core (CPU) a register file logic for, memory access and control flow a clock to sequence instructions memory cache of some active parts of memory (e.g., instructions) Memory : Memory is too big to fit on the CPU chip, so it s stored off chip much slower than registers or cache (2 x slower than registers) 27 28

A Program sequence of instructions stored in memory An Instruction does one thing: math, memory-register transfer, or flow control specifies a value for each of the functional inputs A Program : valc=?, =?, =?, =?, =? valc=?, =?, =?, =?, =? valc=?, =?, =?, =?, =? valc=?, =?, =?, =?, =? : Memory CPU/core valc CPU Instruction Set Architecture (ISA) The ISA is the interface to a processor implementation defines the instructions the processor implements defines the format of each instruction Instruction format is a set of bits (a number) an opcode and set of operand values Types of instruction math memory access control transfer (gotos and conditional gotos) Design alternatives simplify compiler design (CISC such as Intel Architecture 32) simplify processor implementation (RISC) Assembly language symbolic representation of machine code Example Instruction: ADD 29 Simulating a Processor Implementation 3 Description Java simulator = 61 edit/execute assembly-language two source operands in registers: = ra, = rb see register file, memory, etc. put destination in register: = rb Assembly language general form: add ra, rb You will implement e.g., add r, r1 Instruction format 16 bit number, divided into 4-bit chunks: 61sd high-order 8 bits are (61) next 4 bits are (s) next 4 bits are / (d) add ra, rb 11 111 ssss dddd add r, r1 11 111 1 the fetch + execute logic for every instruction in SM213 ISA Fetch Instruction from Memory Execute it Tick Clock SM213 ISA developed as we progress through key language features patterned after MIPS ISA, one of the 2 first RISC architectures 31 32