Introduction to Computer Systems

Similar documents
Introduction to Computer Systems

Chris Riesbeck, Fall Introduction to Computer Systems

Introduction to Computer Systems

A software view. Computer Systems. The Compilation system. How it works. 1. Preprocesser. 1. Preprocessor (cpp)

Bilgisayar Sistemlerine Genel Bakış

Computer Organization - Overview

ENCE Computer Organization and Architecture. Chapter 1. Software Perspective

Great Reality #2: You ve Got to Know Assembly Does not generate random values Arithmetic operations have important mathematical properties

Introduction to Computer Systems

Introduction to Computer Systems

Course Overview CSCE 312. Instructor: Daniel A. Jiménez. Bryant and O Hallaron, Computer Systems: A Programmer s Perspective, Third Edition

CSCI2467: Systems Programming Concepts

Computer Systems Organization

Introduction to Computer Systems

Introduction Presentation A

Chapter 1 A Tour of Computer Systems

A Tour of Computer Systems

Introduction to Computer Systems

The Memory Hierarchy 10/25/16

Overview of the ECE Computer Software Curriculum. David O Hallaron Associate Professor of ECE and CS Carnegie Mellon University

Welcome To The New Foundations of Computer Systems (Fall 2017)

Introduction to Computer Architecture. Meet your Colleagues. Course Theme CISC Michela Taufer September 4, 2008

High Performance Computing Lecture 1. Matthew Jacob Indian Institute of Science

Introduction to Computer Systems

Course Information and Introduction

18-447: Computer Architecture Lecture 16: Virtual Memory

Memory Management. Kevin Webb Swarthmore College February 27, 2018

LC-3 Assembly Language

COS 318: Operating Systems

Course Overview. CSCI 224 / ECE 317: Computer Architecture. Instructors: Prof. Jason Fritts. Slides adapted from Bryant & O Hallaron s slides

Introduction to System Programming

CS 3330 Introduction 1

CS 3330 Introduction. Daniel and Charles. CS 3330 Computer Architecture 1

198:231 Intro to Computer Organization. 198:231 Introduction to Computer Organization Lecture 14

Course Wrap-Up CSE 351 Spring

Introduction to Computer Systems /18 243, Spring st Lecture, Aug. 25 th. The course that gives CMU its Zip!

378: Machine Organization and Assembly Language

Memory Management! How the hardware and OS give application pgms:" The illusion of a large contiguous address space" Protection against each other"

Chapter 2. OS Overview

What s next. Computer Systems A Programmer s Perspective

M2 Instruction Set Architecture

COMP 321: Introduction to Computer Systems

Introduction to System Programming Course 2015 Spring Euiseong Seo

CPS104 Computer Organization Lecture 1

CS 471 Operating Systems. Yue Cheng. George Mason University Fall 2017

COS 318: Operating Systems. Overview. Andy Bavier Computer Science Department Princeton University

Lecture 1: Course Overview

CS 31: Intro to Systems Storage and Memory. Kevin Webb Swarthmore College March 17, 2015

Introduction to Operating Systems Prof. Chester Rebeiro Department of Computer Science and Engineering Indian Institute of Technology, Madras

CS241 Computer Organization Spring

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

Processes and Virtual Memory Concepts

Introduction to Computer Systems: Semester 1 Computer Architecture

Memory Management! Goals of this Lecture!

Advanced Operating Systems (CS 202)

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

CSE 303: Concepts and Tools for Software Development

Memory Management. Goals of this Lecture. Motivation for Memory Hierarchy

CS 241 Data Organization. August 21, 2018

Computer Systems A Programmer s Perspective 1 (Beta Draft)

CSC 369H1S. Operating Systems Spring 2007 Professor Angela Demke Brown U of T

Compilation, Disassembly, and Profiling (in Linux)

Draft. Chapter 1 Program Structure. 1.1 Introduction. 1.2 The 0s and the 1s. 1.3 Bits and Bytes. 1.4 Representation of Numbers in Memory

14:332:331. Lecture 1

C Compilation Model. Comp-206 : Introduction to Software Systems Lecture 9. Alexandre Denault Computer Science McGill University Fall 2006

EL2310 Scientific Programming

CS Programming In C

Virtual Memory. Motivations for VM Address translation Accelerating translation with TLBs

9/19/18. COS 318: Operating Systems. Overview. Important Times. Hardware of A Typical Computer. Today CPU. I/O bus. Network

Operating Systems (ECS 150) Spring 2011

Advanced Memory Organizations

Welcome to CS 241 Systems Programming at Illinois

CSC 2405: Computer Systems II

Introduction to C CMSC 104 Spring 2014, Section 02, Lecture 6 Jason Tang

Computer Systems C S Cynthia Lee Today s materials adapted from Kevin Webb at Swarthmore College

Caches II. CSE 351 Spring Instructor: Ruth Anderson

CS240: Programming in C

Operating System Labs. Yuanbin Wu

Midterm 1. Administrivia. Virtualizing Resources. CS162 Operating Systems and Systems Programming Lecture 12. Address Translation

ABSTRACTION ISN T THE ENTIRE STORY

COS 318: Operating Systems. Overview. Prof. Margaret Martonosi Computer Science Department Princeton University

CS 110 Computer Architecture. Lecture 2: Introduction to C, Part I. Instructor: Sören Schwertfeger.

CSci Introduction to Operating Systems. Administrivia, Intro

I/O Handling. ECE 650 Systems Programming & Engineering Duke University, Spring Based on Operating Systems Concepts, Silberschatz Chapter 13

CS 61C: Great Ideas in Computer Architecture Lecture 2: Introduction to C, Part I

CS307: Operating Systems

Unix API Books. Linux Kernel Books. Assignments and Exams. Grading for CSC 256. Operating Systems 8/31/2018. CSC 256/456 Fall

Lecture 3: Instruction Set Architecture

Operating Systems CMPSCI 377 Spring Mark Corner University of Massachusetts Amherst

CS24: INTRODUCTION TO COMPUTING SYSTEMS. Spring 2018 Lecture 18

CS Programming In C

Read-only memory (ROM): programmed during production Programmable ROM (PROM): can be programmed once SRAM (Static RAM)

CS 110 Computer Architecture. Lecture 2: Introduction to C, Part I. Instructor: Sören Schwertfeger.

Software Project. Lecturers: Ran Caneti, Gideon Dror Teaching assistants: Nathan Manor, Ben Riva

Course Outline Computing Science Department. Faculty of Science. COMP Credits Introduction to Computer Systems (3,1,0) Fall 2015

Welcome to CS 241 Systems Programming at Illinois

Hello, World! in C. Johann Myrkraverk Oskarsson October 23, The Quintessential Example Program 1. I Printing Text 2. II The Main Function 3

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

CSCI2467: Systems Programming Concepts

Programming 1. Lecture 1 COP 3014 Fall August 28, 2017

Transcription:

Introduction to Computer Systems Today: Welcome to EECS 213 Lecture topics and assignments Next time: Bits & bytes and some Boolean algebra Fabián E. Bustamante, Spring 2010

Welcome to Intro. to Computer Systems Everything you need to know http://aqualab.cs.northwestern.edu/classes/eecs213/eecs-213-s10.html Your instructor: Fabián E. Bustamante Your TA: John Otto Communication channels: Course webpage News eecs-213@cs 2

Course theme Abstraction is good, but don t forget reality! Courses to date emphasize abstraction Abstract data types, asymptotic analysis, Abstractions have limits Especially in the presence of bugs Need to understand underlying implementations Useful outcomes Become more effective programmers Prepare for later systems classes in CS & ECE What do you need? EECS 211 or equivalent & Experience with C or C++ - required EECS 311 - useful 3

Course perspective Most systems courses are builder-centric Operating Systems: Implement portions of an OS Compilers: Write compiler for simple language Networking: Implement and simulate network protocols This course is programmer-centric To show how by knowing more about the underlying system, one can be more effective as a programmer Enable you to Write programs that are more reliable and efficient Incorporate features that require hooks into OS Not just a course for dedicated hackers We bring out the hidden hacker in everyone Cover material in this course that you won t see elsewhere 4

Textbooks Required Bryant & O Hallaron, Computer Systems: A Programmer s Perspective, PH 2010. Recommended Kernighan & Ritchie (K&R), The C Programming Language, Second Edition, PH 1988 R. Stevens, Advanced Programming in the Unix Environment, AW 1992; there s a new edition by R. Stevens and S. Rago, AW 2005 5

Course components Lectures Higher level concepts 10% of grade from class participation Labs (4) The heart of the course in-depth understanding 12.5% of grade each Working on teams of 2 Homework assignments (4) 10% of grade Exams midterm & final 20% of grade each 6

Policies Late policy 10% off per day (up to 5 days late) Cheating What is cheating? Sharing code: either by copying, retyping, looking at, or supplying a copy of a file. What is NOT cheating? Helping others use systems or tools Helping others with high-level design issues Helping others debug their code 7

Facilities Tlab (Tech F-252, on the bridge to Ford) and Wilkinson Lab (3 rd floor). You should all have accounts by now; problems? contact root (root@eecs.northwestern.edu) Need physical access to labs? Contact Carol Surma (carol@rhodes.ece.northwestern.edu) 8

Lab rationale Teach new skills and concepts Data Computer arithmetic, digital logic Out: 3/29 In: 4/14 Bomb Assembly language, using a debugger, understanding the stack Out: 4/14 In: 5/3 Malloc Data layout and organization, space/time tradeoffs Out: 5/3 In: 5/17 Shell Processes, concurrency, process control, signals and signal handling Out: 5/17 In: 6/2 9

Some topics covered Programs and data Bits arithmetic, assembly, representation of C control Memory hierarch Memory technology, memory hierarchy, caches, disks, locality Linking & exceptional control flow Object files, dynamic linking, libraries, process control, Virtual memory Virtual mem., address translation, dynamic storage allocation Concurrency High level & low-level I/O, threads, Includes aspects of architecture and OS throughout 10

Hello World What happens and why when you run hello on your system? /*hello world*/ # include <stdio.h> int main() { printf( hello, world\n ); } Goal: introduce key concepts, terminology, and components 11

Information is bits + context Hello is a source code Sequence of bits (0 or 1) 8-bit data chunks are called Bytes Each byte has an integer value, corresponding to some character (ASCII, e.g. # 35) Files made up of ASCII char. text files All other files binary files (e.g., 35 is a part of a machine command) Context is important Same byte sequence might represent a character string or machine instruction 12

Programs translated by other programs unix> gcc o hello hello.c printf.o hello.c Source program (text) Preprocessor (cpp) hello.i Modified source program (text) Compiler (cc1) hello.s Assembly program (text) Assembler (as) hello.o Relocatable object programs (binary) Linker (ld) hello Executable object program (binary) Pre-processing E.g., #include <stdio.h> is inserted into hello.i Compilation (.s) Each statement is an assembly language program Assembly (.o) A binary file whose bytes encode mach. language instructions Linking Get printf() which resides in a separate precompiled object file 13

Hardware organization CPU PC Register file ALU Buses: transfer fixed-sized chunks of data (WORDS) Pentium: 4B bus System bus Memory bus Bus interface I/O Devices: System connections to external world. USB controller Graphics adapter CPU: Executes instructions stored I/O in MM. PC - holds Main address bridgeof machine-language memory instruction from memory I/O bus Main Mem.: Temporary storage device. Holds both a program and the data Expansion it manipulates. slots for other devices such Disk as network adapters controller Mouse Keyboard Display Disk hello executable stored on disk 14

Running Hello Running hello unix>./hello hello, world unix> What s the shell? What does it do? prints a prompt waits for you to type command line loads and runs hello program 15

Running Hello Register file Reading the hello command from the keyboard PC ALU Bus interface System bus I/O bridge Memory bus Main memory./hello" USB controller Graphics adapter I/O bus Disk controller Expansion slots for other devices such as network adapters Mouse Keyboard User types "hello" Display Disk 16

Running Hello PC Register file ALU Shell program loads hello.exe into main memory "hello,world\n" Bus interface System bus I/O bridge Memory bus Main memory hello code USB controller Graphics adapter I/O bus Disk controller Expansion slots for other devices such as network adapters Mouse Keyboard Display Disk hello executable stored on disk 17

Running Hello PC Register file ALU The processor executes instructions and displays hello "hello,world\n" Bus interface System bus I/O bridge Memory bus Main memory hello code USB controller Graphics adapter I/O bus Disk controller Expansion slots for other devices such as network adapters Mouse Keyboard Display "hello,world\n" Disk hello executable stored on disk 18

Caches matter System spends a lot of time moving info. around Larger storage devices are slower than smaller ones Register file ~ 100 Bytes & Main memory ~ millions of Bytes Easier and cheaper to make processors run faster than to make main memory run faster Standard answer cache CPU chip L1 cache (SRAM) Register file ALU Cache bus L2 cache (SRAM) Bus interface System bus Memory bridge Memory bus Main memory (DRAM) 19

Storage devices form a hierarchy Storage at one level serves as cache at the next level L1: L0: Registers On-chip L1 cache (SRAM) CPU registers hold words retrieved from cache memory. L1 cache holds cache lines retrieved from the L2 cache. Smaller, faster, and costlier (per byte) storage devices L3: L2: Off-chip L2 cache (SRAM) Main memory (DRAM) L2 cache holds cache lines retrieved from memory. Main memory holds disk blocks retrieved from local disks. L4: Local secondary storage (local disks) Local disks hold files retrieved from disks on remote network servers. L5: Remote secondary storage (distributed file systems, Web servers) 20

Operating system OS a layer of software interposed between the application program and the hardware Application programs Operating system Processor Main memory I/O devices Software Hardware Two primary goal Protect resources from misuse by applications Provide simple and uniform mechanisms for manipulating low-level hardware devices 21

OS Abstractions Files abstractions of I/O devices Virtual Memory abstraction for main memory and I/O devices Processes abstractions for processor, main memory, and I/O devices Processes Virtual memory Files Processor Main memory I/O devices 22

Processes OS provides the illusion of a dedicated machine per process Process OS s abstraction of a running program Context switch Saving context of one process, restoring that of another one Distorted notion of time Time shell process hello process Application code OS code Application code OS code Application code Context switch Context switch 23

Virtual memory Illusion that each process has exclusive use of a large main memory Example Virtual address space for Linux 0xffffffff 0xc0000000 0x40000000 Kernel virtual memory User stack (created at runtime) Memory mapped region for shared libraries Memory invisible to user code printf() function Run-time heap (created at runtime by malloc) Read/write data Read-only code and data Loaded from the hello executable file 0x08048000 0 Unused 24

Networking Talking to other systems Network seen as another I/O device Many system-level issues arise in presence of network Coping with unreliable media Cross platform compatibility Complex performance issues Expansion slots I/O bus USB controller Graphics adapter Disk controller Network adapter Mouse Keyboard Display Disk Network 25

Conclusions A computer system is more than just hardware A collection of intertwined HW & SF that must cooperate to achieve the end goal running applications The rest of our course will expand on this 26