ECE 2400 / ENGRD 2140 Computer Systems Programming Course Overview
Total Page:16
File Type:pdf, Size:1020Kb
ECE 2400 / ENGRD 2140 Computer Systems Programming Course Overview Christopher Batten School of Electrical and Computer Engineering Cornell University http://www.csl.cornell.edu/courses/ece2400 What is Computer Systems Programming? Activity Trends in Computer Systems Programming Course Logistics ECE 2400 / ENGRD 2140 Computer Systems Programming What is Computer Systems Programming? Application-Level Software Activity: Comparing Algorithms System-Level Trends in Computer Systems Programming Software Course Logistics ECE 2400 Course Overview 2 / 33 • What is Computer Systems Programming? • Activity Trends in Computer Systems Programming Course Logistics Applications vs. Technology Application Gap too large to bridge in one step (but there are exceptions, e.g., a magnetic compass) Technology ECE 2400 Course Overview 3 / 33 • What is Computer Systems Programming? • Activity Trends in Computer Systems Programming Course Logistics Applications vs. Technology Application Technology ECE 2400 Course Overview 3 / 33 • What is Computer Systems Programming? • Activity Trends in Computer Systems Programming Course Logistics The Computer Systems Stack Application Algorithm Traditional Programming Language Computer Science Operating System Compiler Computer Engineering is at the Instruction Set Architecture interface between hardware and software Microarchitecture and considers the entire system Register-Transfer Level Gate Level Traditional Computer Engineering Circuits Electrical Engineering Devices Technology In its broadest definition, computer engineering is the development of the abstraction/implementation layers that allow us to execute information processing applications efficiently using available manufacturing technologies ECE 2400 Course Overview 4 / 33 • What is Computer Systems Programming? • Activity Trends in Computer Systems Programming Course Logistics Python for Application-Level Programming Application I High-level, user- Algorithm facing software Programming Language Enable productively Operating System I developing Compiler applications that Instruction Set Architecture provide new Microarchitecture Application-Level Software functionality to Register-Transfer Level Gate Level users Computer Engineering Circuits ? I Enable productively Devices collecting, Technology analyzing, visualizing data I Sometimes called a productivity-level language ECE 2400 Course Overview 5 / 33 • What is Computer Systems Programming? • Activity Trends in Computer Systems Programming Course Logistics C/C++ for System-Level Programming Application I Connects Algorithm application software Programming Language to the low-level Operating System computer hardware Compiler Enables carefully Instruction Set Architecture I managing Microarchitecture Application-Level Software performance and Register-Transfer Level Gate Level resource constraints System-Level Computer Engineering Circuits Software? I Sometimes called Devices an efficiency-level Technology language ECE 2400 Course Overview 6 / 33 • What is Computer Systems Programming? • Activity Trends in Computer Systems Programming Course Logistics Dynamically Interpreted vs. Statically Compiled def min(a,b): int min( int a, if a < b: Python Python C/C++ C/C++ int b ) c = a Source Code Library Code Source Code Library Code { else int c; c = b if ( a < b ) return c c = a; else "Runtime" "Runtime" Ahead-of-Time Ahead-of-Time c = b; Compiler Compiler Compiler Compiler return c; } LOAD_FAST pushq %rbp LOAD_FAST Python Python Machine Machine movq %rsp,%rbp COMPARE_OP cmpl %esi,%edi POP_JUMP_IF_F Bytecode Bytecode Object File Object File cmovl %edi,%esi LOAD_FAST movl %esi,%eax STORE_FAST popq %rbp JUMP_FORWARD retq LOAD_FAST Execute STORE_FAST w/ Interpreter Linker 1010101 LOAD_FAST 100100010001001 RETURN_VALUE 11100111110111 111101001110111 100010011111000 Machine 1011101 Binary 11000011 The standard Python Execute interpreter is called CPython Binary and it is written in C! ECE 2400 Course Overview 7 / 33 • What is Computer Systems Programming? • Activity Trends in Computer Systems Programming Course Logistics Computer Systems Programming is Diverse Application Algorithm I Python, MATLAB Programming Language Ruby, Javascript Operating System I Compiler I SQL, LINQ Instruction Set Architecture I NumPy Microarchitecture Application-Level I GUI frameworks Software Register-Transfer Level Gate Level System-Level Computer Engineering Circuits Software? Devices I Interpreters Technology I Compilers I Databases I Numerical libraries I Operating systems I Embedded control ECE 2400 Course Overview 8 / 33 • What is Computer Systems Programming? • Activity Trends in Computer Systems Programming Course Logistics Aside: C/C++ for Application-Level Software Application Algorithm Programming Language Operating System Compiler Instruction Set Architecture Microarchitecture Application-Level Application-LevelSoftware Register-Transfer Level & Gate Level System-Level Software Computer Engineering Circuits ? Devices Technology ECE 2400 Course Overview 9 / 33 • What is Computer Systems Programming? • Activity Trends in Computer Systems Programming Course Logistics A Tale of Two Programming Languages Python Programming Language C/C++ Programming Language I Introduced: 1991 I Introduced: 1972(C), 1979(C++) I Most of the machine details are I Most of the machine details are hidden from programmer exposed to the programmer I Programmer gives up some I Programmer is in complete control for improved productivity control for improved efficiency I Easily supports multiple I Easily supports multiple programming paradigms programming paradigms I Extensive standard library is I More limited standard library is included included I Slow and memory inefficient I Fast and memory efficient ECE 2400 Course Overview 10 / 33 • What is Computer Systems Programming? • Activity Trends in Computer Systems Programming Course Logistics Comparing the Popularity of Python vs. C/C++ The 2021 Top Programming Languages, IEEE Spectrum ECE 2400 Course Overview 11 / 33 • What is Computer Systems Programming? • Activity Trends in Computer Systems Programming Course Logistics Comparing the Performance of Python vs. C/C++ 300 100 50 30 10 5 3 1 C Go Perl Lisp C++ Rust PHP Java Swift Ruby Program Time / Fastest Program Time Pascal Python Fortran The Computer Language Benchmarks Game ECE 2400 Course Overview 12 / 33 • What is Computer Systems Programming? • Activity Trends in Computer Systems Programming Course Logistics Program = Algorithm + Data Structure While this course covers C/C++ and system-level programming, this course also builds off of your prior programming experience to further develop your understanding of algorithms and data structures Algorithm Data Structure I Algorithm: Clear set of steps to solve any problem instance in a particular class of problems I Data Structure: Way of efficiently organizing and storing data along with operations for accessing and manipulating this data ECE 2400 Course Overview 13 / 33 What is Computer Systems Programming? • Activity • Trends in Computer Systems Programming Course Logistics ECE 2400 / ENGRD 2140 Computer Systems Programming What is Computer Systems Programming? Application-Level Software Activity: Comparing Algorithms System-Level Trends in Computer Systems Programming Software Course Logistics ECE 2400 Course Overview 14 / 33 What is Computer Systems Programming? • Activity • Trends in Computer Systems Programming Course Logistics Activity: Comparing Algorithms I Application: Sort 16 numbers I Activity Steps . 1. Half the class will use Algorithm A, half uses Algorithm B . 2. When instructor starts timer, flip over worksheet . 3. Sort 16 numbers using assigned algorithm . 4. Lookup when completed and write time on worksheet . 5. Raise hand . 6. When everyone is finished, then analyze data I Algorithm A repeat 16 times find smallest number not crossed off in input list copy smallest number to next open entry in output list cross smallest number off input list ECE 2400 Course Overview 15 / 33 What is Computer Systems Programming? • Activity • Trends in Computer Systems Programming Course Logistics Activity: Comparing Algorithms I Algorithm B repeat 8 times, once for each pair in column 1 copy smallest from input pair into next entry in column 1 copy largest from input pair into next entry in column 1 repeat 4 times, once for group of 4 in column 2 repeat 4 times compare top two numbers not crossed off in both groups copy smallest number to next open entry in column 2 cross smallest number off input list ... and so on ... ECE 2400 Course Overview 16 / 33 What is Computer Systems Programming? Activity • Trends in Computer Systems Programming • Course Logistics ECE 2400 / ENGRD 2140 Computer Systems Programming What is Computer Systems Programming? Application-Level Software Activity: Comparing Algorithms System-Level Trends in Computer Systems Programming Software Course Logistics ECE 2400 Course Overview 17 / 33 What is Computer Systems Programming? Activity • Trends in Computer Systems Programming • Course Logistics Trend towards IoT and Cloud w/ Novel Hardware Roughly every decade a new, smaller, lower priced computer class forms based on a new programming platform resulting in entire new industries 8 10 8 Supercomputers 10 Minicomputers 7 7 10 10 Mainframes Personal 6 Computers 6 10 10 Scalable 5 Mainframes Clusters 3 10 Handhelds 5 Minicomputers 10 Cloud 4 Computing 10 3 4 10 Workstations 10 2 Volume in cm Price in Dollars Laptops 10 3 Workstations 10 Personal 1 10 Computers Laptops 2 Handhelds