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ış

Introduction to Computer Systems

Introduction to Computer Systems

ENCE Computer Organization and Architecture. Chapter 1. Software Perspective

Computer Organization - Overview

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

CSCI2467: Systems Programming Concepts

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

Introduction to Computer Systems

Computer Systems Organization

Introduction Presentation A

Introduction to Computer Systems

Chapter 1 A Tour of Computer Systems

A Tour of Computer Systems

Introduction to Computer Systems

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

Course Information and Introduction

The Memory Hierarchy 10/25/16

18-447: Computer Architecture Lecture 16: Virtual Memory

Memory Management. Kevin Webb Swarthmore College February 27, 2018

Introduction to System Programming

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

Chapter 2. OS Overview

Course Wrap-Up CSE 351 Spring

COS 318: Operating Systems

Introduction to System Programming Course 2015 Spring Euiseong Seo

CS 3330 Introduction 1

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

Lecture 1: Course Overview

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

CS 241 Data Organization. August 21, 2018

Processes and Virtual Memory Concepts

Memory Management! Goals of this Lecture!

LC-3 Assembly Language

Introduction to Computer Systems: Semester 1 Computer Architecture

CPS104 Computer Organization Lecture 1

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

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

COMP 321: Introduction to Computer Systems

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

M2 Instruction Set Architecture

CSE 303: Concepts and Tools for Software Development

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

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

Computer Systems A Programmer s Perspective 1 (Beta Draft)

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

CS241 Computer Organization Spring

378: Machine Organization and Assembly Language

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

What s next. Computer Systems A Programmer s Perspective

Advanced Operating Systems (CS 202)

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

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

EL2310 Scientific Programming

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

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

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

CSCI2467: Systems Programming Concepts

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

CS240: Programming in C

CSci Introduction to Operating Systems. Administrivia, Intro

ABSTRACTION ISN T THE ENTIRE STORY

Lecture 3: Instruction Set Architecture

CS Programming In C

Course and Unix Intro

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

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

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

CS Programming In C

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

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

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

CSE 333 Lecture 1 - Systems programming

6.S096 Lecture 1 Introduction to C

CSE3008: Operating Systems. Computer Systems Laboratory Sungkyunkwan University

14:332:331. Lecture 1

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

Page 1. Goals for Today" Virtualizing Resources" Important Aspects of Memory Multiplexing" CS162 Operating Systems and Systems Programming Lecture 20

CSC 2405: Computer Systems II

Operating Systems. Fall Dongkun Shin, SKKU

Advanced Memory Organizations

CSCE150A. Administrivia. Overview. Hardware. Software. Example. Program. Pseudocode. Flowchart. Control Structures. Hello World Program CSCE150A

Computer Science & Engineering 150A Problem Solving Using Computers

CS 31: Intro to Systems Caching. Kevin Webb Swarthmore College March 24, 2015

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

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

Caches II. CSE 351 Spring Instructor: Ruth Anderson

Compilation, Disassembly, and Profiling (in Linux)

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

Operating Systems. Spring Dongkun Shin, SKKU

Cache Memories. From Bryant and O Hallaron, Computer Systems. A Programmer s Perspective. Chapter 6.

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, 2007

Welcome to Intro. to Computer Systems! Everything you need to know http://aqualab.cs.northwestern.edu/classes/eecs213/eecs-213-s12.html! Your instructor: Fabián E. Bustamante! Your TA: Zach Bischof! Communication channels: Course webpage Google group Email (subject EECS343: <helpful comment> )! Prerequisites EECS 211 or equivalent Experience with C or C++ - required EECS 311 - useful 2

Course theme Abstraction is good, but don t forget reality!! Courses have so far emphasized abstraction Abstract data types, asymptotic analysis,! Abstractions have limits Especially in the presence of bugs Need to understand underlying implementations! Useful outcomes from taking this course Become more effective programmers Prepare for later systems classes in CS & CE 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 By knowing more about the underlying system, one can be more effective as a programmer Write programs that are more reliable and efficient Incorporate features that require hooks into OS We bring out the hidden hacker in everyone 4

Some topics covered! Programs and data Bits arithmetic, assembly, representation of C control! Memory hierarchy 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 5

Course components! Lectures Higher level concepts! 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

Lab rationale! Teach new skills and concepts Data Computer arithmetic, digital logic Out: Mar. 30 In: Apr. 10 Bomb Assembly language, using a debugger, understanding the stack Out: Apr. 13 In: Apr. 24 Malloc Data layout and organization, space/time tradeoffs Out: May 5 In: May 15 Shell Processes, concurrency, process control, signals and signal handling Out: May 18 In: May 29 7

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 and S. Rago, Advanced Programming in the Unix Environment, 2 nd Ed. AW 2005 8

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@eecs.northwestern.edu) 9

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 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.c 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 key 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)! Pre-! processor! (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

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 14

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 bridge! of 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! 15

Running Hello Register file! Reading the hello command from the keyboard PC! ALU! Bus interface! System bus! I/O! bridge! Memory bus! Main!./hello"! memory! 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! Cache bus! L1! Register file! cache! (SRAM)! ALU! 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 L0:! Registers! L1:! 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 the course will expand on this 26