Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to Computer Systems Topics: Staff, text, and policies Lecture topics and assignments Class overview CS 213 S ’06 CS-213 Aleksandar Kuzmanovic.

Similar presentations


Presentation on theme: "Introduction to Computer Systems Topics: Staff, text, and policies Lecture topics and assignments Class overview CS 213 S ’06 CS-213 Aleksandar Kuzmanovic."— Presentation transcript:

1 Introduction to Computer Systems Topics: Staff, text, and policies Lecture topics and assignments Class overview CS 213 S ’06 CS-213 Aleksandar Kuzmanovic 3/27/2006

2 – 2 – CS-213, S’06 Teaching staff Instructor Prof. Aleksandar Kuzmanovic (Wed 10:00-12:00, Tech L457) TA David Choffnes (Tu, Th 1-2:30, Ford 2-217) Recitation (Tu, 5-6:30, Tech MG28) Undergraduate assistant TBA (TBA) Location and Time Lecture: MW 2-3:20, Tech LR3 Recitation: Tu, 5-6:30, Tech MG28

3 – 3 – CS-213, S’06 Prerequests CS211 (Fund. of comp. program.) or eq. Required Experience with C or C++ Required CS311 (Data structures and mgmt) Useful CS213 is required CS course It is prerequisite for CS 343 (Operating Systems) It is also prerequisite for ALL systems courses »See http://nsrg.cs.northwestern.edu for a current listhttp://nsrg.cs.northwestern.edu

4 – 4 – CS-213, S’06 Textbooks Required: Randal E. Bryant and David R. O’Hallaron, “Computer Systems: A Programmer’s Perspective”, Prentice Hall 2003. csapp.cs.cmu.eduRecommended: Brian Kernighan and Dennis Ritchie, “The C Programming Language, Second Edition”, Prentice Hall, 1988 Richard Stevens, “Advanced Programming in the Unix Environment”, Addison-Wesley, 1992

5 – 5 – CS-213, S’06 Homeworks, Labs, and Exams 4 labs, 4 homeworks, 2 exams Grading Grading 10% Homeworks (2.5% per homework) 50% Programming labs (12.5% per lab) 20% Midterm (covers first half of the course) 20% Final (covers second half of the course) Final grades: >90 (or 90 th percentile): A >80 (or 80 th percentile): B, >70 (or 70 th percentile): C, etc. Late Policy Late Policy After 1 day, maximum score is 90% After 2 days, maximum score is 80%, etc.

6 – 6 – CS-213, S’06 Policies: Assignments Work groups You must work in groups of 2 for all labs Let me and the TA know the groups by the end of the weekHandins Assignments due at 11:59pm on specified due date. Electronic handins only.

7 – 7 – CS-213, S’06 Course Components Lectures Higher level conceptsRecitations Applied concepts, important tools and skills for labs, clarification of lectures, exam coverageLabs The heart of the course 1 or 2 weeks Provide in-depth understanding of an aspect of systems Programming and measurement

8 – 8 – CS-213, S’06 Getting Help Web http://cs.northwestern.edu/~akuzma/classes/CS213-s06/ Copies of lectures, assignments, handouts Clarifications to assignmentsNewsgroups cs.213.announce and cs.213.discuss Clarifications to assignments, general discussion Can’t reply immediately! Personal help Professor, Wednesdays 10-noon TA: Tu, Th 1-2:30

9 – 9 – CS-213, S’06 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. Penalty for cheating: Removal from course with failing grade.

10 – 10 – CS-213, S’06 Facilities TLAB (Tech F-252: the Tech end of the bridge that connects Tech and Ford) - a cluster of Linux machines - (e.g., TLAB-11.cs.northwestern.edu) You should all have TLAB accounts by now; -if not, contact Scott Hoover ( scott@cs.northwestern.edu ) scott@cs.northwestern.edu For accessing the TLAB facilities - contact Carol Surma ( carol@rhodes.ece.northwestern.edu) carol@rhodes.ece.northwestern.edu Should you have other problems - contact the TA directly

11 – 11 – CS-213, S’06 Programs and Data (8) Topics Bits operations, arithmetic, assembly language programs, representation of C control and data structures Includes aspects of architecture and compilersAssignments L1: Manipulating bits L2: Defusing a binary bomb L3: Hacking a buffer bomb

12 – 12 – CS-213, S’06 The Memory Hierarchy (2) Topics Memory technology, memory hierarchy, caches, disks, locality Includes aspects of architecture and OS.

13 – 13 – CS-213, S’06 Linking and Exceptional Control Flow (3) Topics Object files, static and dynamic linking, libraries, loading Hardware exceptions, processes, process control, Unix signals, nonlocal jumps Includes aspects of compilers, OS, and architecture

14 – 14 – CS-213, S’06 Virtual memory (2) Topics Virtual memory, address translation, dynamic storage allocation Includes aspects of architecture and OSAssignments L4: Writing your own malloc package

15 – 15 – CS-213, S’06 I/O, Networking, and Concurrency (3) Topics High level and low-level I/O, network programming, Internet services, Web servers concurrency, concurrent server design, threads, I/O multiplexing with select. Includes aspects of networking, OS, and architecture.

16 – 16 – CS-213, S’06 Lab Rationale Doing a lab should result in new skills and concepts Data Lab: computer arithmetic, digital logic. Bomb Labs: assembly language, using a debugger, understanding the stack Malloc Lab: understanding pointers and nasty memory bugs.

17 – 17 – CS-213, S’06 Course Theme Abstraction is good, but don’t forget reality! Courses to date emphasize abstraction Abstract data types Asymptotic analysis These abstractions have limits Especially in the presence of bugs Need to understand underlying implementations Useful outcomes Become more effective programmers Able to find and eliminate bugs efficiently Able to tune program performance Prepare for later “systems” classes in CS & ECE Compilers, Operating Systems, Networks, Computer Architecture, Embedded Systems

18 – 18 – CS-213, S’06 Coarse Goal Must understand system to optimize performance How programs compiled and executed How to measure program performance and identify bottlenecks How to improve performance without destroying code modularity and generality Implementations change, but concepts don’t

19 – 19 – CS-213, S’06 Course Perspective Most Systems Courses are Builder-Centric Computer Architecture Design a processor Operating Systems Implement large portions of operating system Compilers Write compiler for simple language Networking Implement and simulate network protocols

20 – 20 – CS-213, S’06 Course Perspective (Cont.) This Course is Programmer-Centric Purpose is 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 »E.g., concurrency, signal handlers Cover material in this course that you won’t see elsewhere

21 – 21 – CS-213, S’06 Hello World In a sense, the goal of the course is to help you understand what happens and why when you run “hello” on your system? Goal: introduce key concepts, terminology, and components /*hello world*/ # include int main() { printf(“hello, world\n”); } /*hello world*/ # include int main() { printf(“hello, world\n”); }

22 – 22 – CS-213, S’06 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 that corresponds to some character (ASCII standard) E.g., ‘#’ -> 35 Files that consist of ASCII characters -> text files All other files -> binary files (e.g., 35 is a part of a machine command) Context is important The same sequence of bytes might represent a character string or machine instruction Machines put everything in bits! Chapter 2 -> machine representations of numbers

23 – 23 – CS-213, S’06 Programs Translated by Other Programs Pre- processor ( cpp ) hello.i Compiler ( cc1 ) hello.s Assembler ( as ) hello.o Linker ( ld ) hellohello.c Source program (text) Modified source program (text) Assembly program (text) Relocatable object programs (binary) Executable object program (binary) printf.o Phases: Pre-processing E.g., #include is inserted into hello.i Compilation hello.s -> each statement is an assembly language program Assembly hello.o -> is a binary file whose bytes encode machine language instructions Linking E.g., hello.c uses printf(), it resides in a separate precompiled object file printf.o unix> gcc –o hello hello.c

24 – 24 – CS-213, S’06 Why do We Care about This? Optimizing program performance Optimizing program performance To write efficient code -> we do need a basic understanding of how a compiler translates different C statements into assembly language How to tune C programs to help compiler Understanding link-time errors Understanding link-time errors Why does it matter what order we list libraries? Why some link-errors do not appear before run time? Avoiding security holes Avoiding security holes Buffer overflow bugs

25 – 25 – CS-213, S’06 Shell Shell a command-line interpreter that - prints a prompt - waits for you to type command line - loads and runs hello program - prints a prompt unix>./hello hello, world unix> unix>./hello hello, world unix>

26 – 26 – CS-213, S’06 Hardware organization Buses Transfer fixed-sized chunks of data (WORDS) Intel Pentium -> 4Bytes bus Main memory I/O bridge Bus interface ALU Register file CPU System busMemory bus Disk controller Graphics adapter USB controller MouseKeyboardDisplay Disk I/O bus Expansion slots for other devices such as network adapters hello executable stored on disk PC

27 – 27 – CS-213, S’06 Hardware organization I/O Devices System connections to external world Mouse, keyboard (input) Display, disk device (output) Main memory I/O bridge Bus interface ALU Register file CPU System busMemory bus Disk controller Graphics adapter USB controller MouseKeyboardDisplay Disk I/O bus Expansion slots for other devices such as network adapters hello executable stored on disk PC

28 – 28 – CS-213, S’06 Hardware organization Main Memory Temporary storage device Holds both a program and the data it manipulates with Main memory I/O bridge Bus interface ALU Register file CPU System busMemory bus Disk controller Graphics adapter USB controller MouseKeyboardDisplay Disk I/O bus Expansion slots for other devices such as network adapters hello executable stored on disk PC

29 – 29 – CS-213, S’06 Hardware organization Control Processor Unit (CPU) Executes instructions stored in main memory Program Counter (PC or Register) contains the address of some machine- language instruction from memory Main memory I/O bridge Bus interface ALU Register file CPU System busMemory bus PC CPU Reads the instruction from memory Performs simple operation (load, store, update) Updates the PC to point to next instruction

30 – 30 – CS-213, S’06 Running the Hello Program Reading the hello command from the keyboard Main memory I/O bridge Bus interface ALU Register file System busMemory bus Disk controller Graphics adapter USB controller MouseKeyboardDisplay Disk I/O bus Expansion slots for other devices such as network adapters PC "hello" User types "hello"

31 – 31 – CS-213, S’06 Running the Hello Program Shell program loads hello.exe into main memory Main memory I/O bridge Bus interface ALU Register file System busMemory bus Disk controller Graphics adapter USB controller MouseKeyboardDisplay Disk I/O bus Expansion slots for other devices such as network adapters hello executable stored on disk PC hello code "hello,world\n"

32 – 32 – CS-213, S’06 Running the Hello Program The processor executes instructions and displays “hello…” Main memory I/O bridge Bus interface ALU Register file System busMemory bus Disk controller Graphics adapter USB controller MouseKeyboardDisplay Disk I/O bus Expansion slots for other devices such as network adapters hello executable stored on disk PC hello code "hello,world\n"

33 – 33 – CS-213, S’06 Caching A system spends a lot of time moving information from one place to another Larger storage devices are slower than smaller ones Register file ~ 100 Bytes Main memory ~ millions of Bytes It is easier and cheaper to make processors run faster than it is to make main memory run faster (SRAM – Static RAM) Main memory (DRAM) Memory bridge Bus interface L2 cache (SRAM) ALU Register file CPU chip Cache busSystem busMemory bus L1 cache (SRAM)

34 – 34 – CS-213, S’06 Storage Devices Form a Hierarchy Storage at one level serves as cache at the next level Registers On-chip L1 cache (SRAM) Main memory (DRAM) Local secondary storage (local disks) Larger, slower, and cheaper (per byte) storage devices Remote secondary storage (distributed file systems, Web servers) Local disks hold files retrieved from disks on remote network servers. Main memory holds disk blocks retrieved from local disks. Off-chip L2 cache (SRAM) L1 cache holds cache lines retrieved from the L2 cache. CPU registers hold words retrieved from cache memory. L2 cache holds cache lines retrieved from memory. L0: L1: L2: L3: L4: L5: Smaller, faster, and costlier (per byte) storage devices

35 – 35 – CS-213, S’06 Operating System (OS) OS – a layer of software interposed between the application program and the hardware Two primary purposes To protect the hardware from misuse by applications To provide simple and uniform mechanisms for manipulating low-level hardware devices Application programs ProcessorMain memoryI/O devices Operating system Software Hardware

36 – 36 – CS-213, S’06 OS Abstractions Files are abstractions of I/O devices Virtual Memory is an abstraction for the main memory and I/O devices Processes are abstractions for the processor, main memory, and I/O devices ProcessorMain memoryI/O devices Processes Files Virtual memory

37 – 37 – CS-213, S’06 Processes The OS provides the illusion that the program is the only one in the system Process OS’s abstraction of a running program Context switching Saving the context of one process Restoring the process of the new process shell process hello process Application code Time Context switch Context switch OS code Application code OS code Application code

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

39 – 39 – CS-213, S’06 Networking Computers do more than execute programs They need to get data in and out I/O system critical to program reliability and performance They communicate with each other over networks Because of the Internet, copying info from 1 machine to another has become important


Download ppt "Introduction to Computer Systems Topics: Staff, text, and policies Lecture topics and assignments Class overview CS 213 S ’06 CS-213 Aleksandar Kuzmanovic."

Similar presentations


Ads by Google