Lecture notes for CSC 252, Thurs. Jan. 16, 2014 ice breaker what is systems? what all do we need to run a program? HW processor memory non-volatile storage I/O devices (keyboard, screen, mouse, network, ...) bus(es) to tie them together memory, backside, USB, PCI, FireWire, etc. SW compiler operating system process abstraction and scheduling, memory mgmt, file system, network protocol stack, ... libraries (math, data abstractions, OS wrappers, ...) GUI tools config mgr, version control, profiler, debugger, ... Computer organization is the study of how all that stuff fits together, with a particular emphasis on the interrelationship between hardware and software. -------- Typically organized as a hierarchy of layers: Applications (compiler, assembler, linker) Run-time libraries, user-level servers, process-level VMs GUI, math, malloc/GC, data abstractions, buffered I/O, ... maybe dynamic compilation OS kernel (itself typically comprising multiple layers) provides processes, virtual memory, files maybe: system-level VM --> ISA, I/O HW microarchitecture, system-level architecture digital logic circuits solid-state physics Particular emphasis on the noted layer, where the interface between hardware and software typically occurs. Example ISAs of commercial importance today: x86 (ia32, amd64 = em64t = x86-64; includes 80286/386/486/Pentium/Opteron) Intel, AMD, formerly Cyrix ARM many, many vendors, inc. Apple (iPhone, iPad), Qualcomm (many other phone brands, inc. Samsung), nVidia, Intel, ... (ISA owned by ARM, Inc.) #1 architecture in the embedded world Power/PowerPC IBM, FreeScale (Motorola spin-off), formerly Apple Power has a few things PowerPC doesn't Apple G5 was essentially a single-core Power 4 Cell processor (PlayStation 3) has a PowerPC front end; XBox is 3-core PowerPC; Wii is single-core PowerPC. Sparc Sun, TI, Fujitsu good size embedded market, too -- lots of vendors MIPS MIPS, SGI, NEC once big in the desktop and server world, now mainly embedded ia64 (Itanium) Intel, HP big gamble; trumped by AMD Opteron; probably won't survive long-term z IBM only (successor to the 360/370/390 series -- still IBM's biggest money-maker) Huge number of smaller current players; huge number of older, abandoned ISAs. ======================== How many declared or provisional majors? others? How many freshmen/sophomores/juniors/seniors? How many did/did not take 173? Who knows Assembler (any sort)/C/C++? ======================== Administrivia Web site -- all the administrative stuff I'm covering today is on-line www.cs.rochester.edu/u/scott/courses/252/ Prerequisite: CSC 172 or equivalent. CSC 173 strongly recommended, but not required. Instructors MLS Shibo Wang James Yuzawa, ...? My office hours: by appointment (send email), or stop by if I'm in. Shibo Mon 11-12, Thur. 9-10, CSB 401. BlackBoard discussion group. Resources Computers CSUG machines remote access available; see the web site -------- sign sheet for account/disk space if you are not a _declared_ CS major (will get you more disk space) -------- Lecture notes on-line Book ** GET THE 2ND EDITION ** Projects will be mostly in C and x86 assembler. I will cover the latter in class. I won't spend much time on the former. If you don't know C you'll want to get a book and/or read some of the on-line resources; see the web site for suggestions. -------- ASSIGNMENTS for Tuesday: get/reactivate your csug account forward mail if necessary protect your director(ies) buy the book read chapter 1 pre-skim chapter 2 browse the web site visit the BlackBoard discussion group learn to use emacs info mode, or some other texinfo browser -------- Grading calculation (approximate) Assignments 10% "pre-assignments" 45% main assignments Exams 20% midterm 25% final Extra credit Course attendance and participation Please arrive on time Assignments seven projects planned trivia assignments NO LATE ASSIGNMENTS Academic honesty share ideas but not artifacts don't copy _anything_ unless you're putting it in quote marks Advice attend all lectures ask questions in class read the book; answer all end-of-section questions start immediately on assignments visit the professor and TAs out of class tools will not be adequately covered in lecture read the BlackBoard discussion group AT LEAST once a day ======================== Intro to Systems Software, via example: the "hello, world" program. How do we get it to run? Consider system layers application level use editor to create hello.c source file use shell to invoke editor and compiler, and to request that program be run compiler translation and linking (static, dynamic) translation typically implemented in Linux with four passes preprocessor compiler (may have multiple phases inside) assembler All driven by 'gcc' compiler driver. Intermediate steps (at least the ones inside translation) often invisible to programmer. OS receives requests (system calls) from shell moves data from disk to memory, creates and dispatches process(es) to execute compiler passes and hello program assembly-level architecture processor executes instructions from memory; instructions move data, do math, make choices (change program counter) data moves among disk, keyboard, screen, memory, and processor over busses in response to instructions -------- Intro to Computer Hardware Memory comes in hierarchy registers cache (usually multiple levels these days) "main" memory (almost always DRAM these days) I/O spans a huge range of devices keyboards, mice, tablets, joysticks, etc. screens, visors, speakers, etc. frame buffers additional levels of storage (memory) secondary storage (usually disk or flash RAM; several alternatives on the way) tertiary storage (removable media: CDs/DVDs, flash drives, tape) local-area networks (Ethernet, WiFi, BlueTooth, FibreChannel, etc.) wide-area networks (DSL, cable, fibre, microwave, satellite) More detailed picture of a typical modern workstation components connected via hierarchy of busses faster --> higher intrinsic cost, higher connection cost, smaller physical size substantial variation from machine to machine; typical PC has core(s) -- 1-8 per processor connected through (multiple levels of) cache(s) to "system" bus, connected to I/O bridge memory bank(s) and graphics processor connected to I/O bridge over memory bus fast I/O devices and controllers for slower I/O busses connected to I/O bridge over PCI and ATA busses slower devices connected to slower busses (e.g. USB, Firewire) busses bandwidth USB 12 MB/s (USB 1), 480 MB/s (USB 2), or 5Gb/s (USB 3) FireWire 400 or 800 Mb/s (6.4Gb/sec anticipated) SATA 1.5 or 3Gb/s PCI, PCI-X 2 - 40 Gb/s, depending on generation (internal only) PCIe (very different, despite name) 2 - 64 Gb/s Like processor speed and memory size, these are moving targets. Lots more detail later on what the processor looks like inside. To run hello program: keystrokes go to memory via the processor registers hello code goes from disk to memory directly instructions go from memory to the processor output string goes from memory to screen via processor registers ---------------------------------------- Big Ideas von Neumann equivalence translation abstraction interpretation/virtualization (emulation sometimes used as a synonym for interpretation, sometimes with expectation of more versimilitide, e.g. wrt real-time performance, bugs, etc. -- perhaps w/ HW support) virtual machines caching and the storage hierarchy virtual memory concurrency & parallelism, at all levels circuits microarchitecture instruction (intra-core) thread SIMD core processor device distribution -------- Instructional units in course/book: data formats, inc. computer arithmetic assembly level programs processor architecture factors influencing program performance the memory hierarchy, including caches and I/O devices (linking -- probably won't cover this) interrupts, signals, and process control measuring time virtual memory and storage management concurrency and networking Projects bit twiddling "binary bomb" "buffer bomb" pipelining performance measurement and tuning shell design dynamic memory allocation ********************************** Introduce TAs Account sign-up **********************************