ECE 2400 / ENGRD 2140Computer Systems Programming
Course Overview
Christopher BattenSchool 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
Application-LevelSoftware
System-LevelSoftware
ECE 2400 / ENGRD 2140Computer Systems Programming
What is Computer Systems Programming?
Activity: Comparing Algorithms
Trends in Computer Systems Programming
Course Logistics
ECE 2400 Course Overview 2 / 30
• What is Computer Systems Programming? • Activity Trends in Computer Systems Programming Course Logistics
The Computer Systems Stack
Application
Gap too large to bridge in one step(but there are exceptions, e.g., a magnetic compass)
Technology
ECE 2400 Course Overview 3 / 30
• What is Computer Systems Programming? • Activity Trends in Computer Systems Programming Course Logistics
The Computer Systems Stack
In its broadest definition, computer engineering is thedevelopment of the abstraction/implementation layers that allow us to
execute information processing applications efficientlyusing available manufacturing technologies
Register-Transfer Level
Circuits
Devices
Instruction Set Architecture
Programming Language
Algorithm
Microarchitecture
Co
mp
ute
rE
ng
ine
eri
ng
Application
Operating System
Gate Level
Compiler
Technology
TraditionalComputer Science
TraditionalElectrical Engineering
Computer Engineering is at theinterface between hardware and softwareand considers the entire system
ECE 2400 Course Overview 3 / 30
• What is Computer Systems Programming? • Activity Trends in Computer Systems Programming Course Logistics
Python for Application-Level Programming
Register-Transfer Level
Circuits
Devices
Instruction Set Architecture
Programming Language
Algorithm
Microarchitecture
Co
mp
ute
rE
ng
ine
eri
ng
Application
Operating System
Gate Level
Compiler
Technology
Application-LevelSoftware
?
I High-level, user-facing software
I Enable productivelydevelopingapplications thatprovide newfunctionality tousers
I Enable productivelycollecting,analyzing,visualizing data
I Sometimes called aproductivity-levellanguage
ECE 2400 Course Overview 4 / 30
• What is Computer Systems Programming? • Activity Trends in Computer Systems Programming Course Logistics
C/C++ for System-Level Programming
Register-Transfer Level
Circuits
Devices
Instruction Set Architecture
Programming Language
Algorithm
Microarchitecture
Co
mp
ute
rE
ng
ine
eri
ng
Application
Operating System
Gate Level
Compiler
Technology
Application-LevelSoftware
?System-LevelSoftware
I Connectsapplication softwareto the low-levelcomputer hardware
I Enables carefullymanagingperformance andresource constraints
I Sometimes calledan efficiency-levellanguage
ECE 2400 Course Overview 5 / 30
• What is Computer Systems Programming? • Activity Trends in Computer Systems Programming Course Logistics
Dynamically Interpreted vs. Statically Compiled
PythonSource Code
"Runtime"Compiler
PythonBytecode
Executew/ Interpreter
PythonLibrary Code
"Runtime"Compiler
PythonBytecode
def min(a,b): if a < b: c = aelse
c = b return c
LOAD_FASTLOAD_FASTCOMPARE_OPPOP_JUMP_IF_FLOAD_FASTSTORE_FASTJUMP_FORWARDLOAD_FASTSTORE_FASTLOAD_FASTRETURN_VALUE
C/C++
Source Code
Ahead-of-TimeCompiler
MachineObject File
Linker
MachineBinary
ExecuteBinary
C/C++Library Code
Ahead-of-TimeCompiler
MachineObject File
pushq %rbpmovq %rsp,%rbpcmpl %esi,%edicmovl %edi,%esimovl %esi,%eaxpopq %rbpretq
int min( int a, int b ){int c; if ( a < b ) c = a; else
c = b; return c;}
101010110010001000100111100111110111111101001110111100010011111000101110111000011
The standard Pythoninterpreter is called CPythonand it is written in C!
ECE 2400 Course Overview 6 / 30
• What is Computer Systems Programming? • Activity Trends in Computer Systems Programming Course Logistics
Computer Systems Programming is Diverse
Register-Transfer Level
Circuits
Devices
Instruction Set Architecture
Programming Language
Algorithm
Microarchitecture
Co
mp
ute
rE
ng
ine
eri
ng
Application
Operating System
Gate Level
Compiler
Technology
Application-LevelSoftware
?System-LevelSoftware
I Python, MATLABI Ruby, JavascriptI SQL, LINQI NumPyI GUI frameworks
I InterpretersI CompilersI DatabasesI Numerical librariesI Operating systemsI Embedded control
ECE 2400 Course Overview 7 / 30
• What is Computer Systems Programming? • Activity Trends in Computer Systems Programming Course Logistics
Aside: C/C++ for Application-Level Software
Register-Transfer Level
Circuits
Devices
Instruction Set Architecture
Programming Language
Algorithm
Microarchitecture
Co
mp
ute
rE
ng
ine
eri
ng
Application
Operating System
Gate Level
Compiler
Technology
Application-LevelSoftware
?
Application-Level&
System-LevelSoftware
ECE 2400 Course Overview 8 / 30
• What is Computer Systems Programming? • Activity Trends in Computer Systems Programming Course Logistics
A Tale of Two Programming Languages
Python Programming Language
I Introduced: 1991
I Most of the machine details arehidden from programmer
I Programmer gives up somecontrol for improved productivity
I Easily supports multipleprogramming paradigms
I Extensive standard library isincluded
I Slow and memory inefficient
C/C++ Programming Language
I Introduced: 1972(C), 1979(C++)
I Most of the machine details areexposed to the programmer
I Programmer is in completecontrol for improved efficiency
I Easily supports multipleprogramming paradigms
I More limited standard library isincluded
I Fast and memory efficient
ECE 2400 Course Overview 9 / 30
• What is Computer Systems Programming? • Activity Trends in Computer Systems Programming Course Logistics
Comparing the Popularity of Python vs. C/C++
The 2018 Top Programming Languages, IEEE Spectrum
ECE 2400 Course Overview 10 / 30
• What is Computer Systems Programming? • Activity Trends in Computer Systems Programming Course Logistics
Comparing the Performance of Python vs. C/C++
C
C+
+
Ru
st
Fo
rtra
n
Ja
va
Sw
ift
Go
Pa
sca
l
Lis
p
PH
P
Pe
rl
Ru
by
Pyth
on
Pro
gra
m T
ime
/ F
aste
st P
rog
ram
Tim
e
1
35
10
3050
100
300
The Computer Language Benchmarks Game
ECE 2400 Course Overview 11 / 30
• 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, thiscourse also builds off of your prior programming experience to further
develop your understanding of algorithms and data structures
Data StructureAlgorithm
I Algorithm: Clear set of steps to solve any problem instance in aparticular class of problems
I Data Structure: Way of efficiently organizing and storing dataalong with methods for accessing and manipulating this data
ECE 2400 Course Overview 12 / 30
What is Computer Systems Programming? • Activity • Trends in Computer Systems Programming Course Logistics
Application-LevelSoftware
System-LevelSoftware
ECE 2400 / ENGRD 2140Computer Systems Programming
What is Computer Systems Programming?
Activity: Comparing Algorithms
Trends in Computer Systems Programming
Course Logistics
ECE 2400 Course Overview 13 / 30
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 14 / 30
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 15 / 30
What is Computer Systems Programming? Activity • Trends in Computer Systems Programming • Course Logistics
Application-LevelSoftware
System-LevelSoftware
ECE 2400 / ENGRD 2140Computer Systems Programming
What is Computer Systems Programming?
Activity: Comparing Algorithms
Trends in Computer Systems Programming
Course Logistics
ECE 2400 Course Overview 16 / 30
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 formsbased on a new programming platform resulting in entire new industries
103
104
105
106
107
108
102
Pri
ce
in
Do
lla
rs
1950 1960 1970 1980 2000 2010
G. Bell. "Bell's Law for the Birth and Death of Computer Classes."CACM, Jan 2008.
1990
Vo
lum
e i
n c
m3
2020 1950 1960 1970 1980 2000 20101990 2020
Y. Lee et al. "Modular 1mm3 Die-Stacked Sensing Platform ..."JSSC, Jan 2013.
104
106
108
102
100
107
105
103
101
Mainframes
Mainframes
Minicomputers
Minicomputers
Workstations
WorkstationsPersonalComputers
PersonalComputers
Laptops
LaptopsHandhelds
Handhelds
Supercomputers
ScalableClusters
CloudComputing
Internetof Things
Internetof Things
ECE 2400 Course Overview 17 / 30
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 formsbased on a new programming platform resulting in entire new industries
103
104
105
106
107
108
102
Pri
ce
in
Do
lla
rs
1950 1960 1970 1980 2000 2010
G. Bell. "Bell's Law for the Birth and Death of Computer Classes."CACM, Jan 2008.
1990
Vo
lum
e i
n c
m3
2020 1950 1960 1970 1980 2000 20101990 2020
Y. Lee et al. "Modular 1mm3 Die-Stacked Sensing Platform ..."JSSC, Jan 2013.
104
106
108
102
100
107
105
103
101
Mainframes
Mainframes
Minicomputers
Minicomputers
Workstations
WorkstationsPersonalComputers
PersonalComputers
Laptops
LaptopsHandhelds
Handhelds
Supercomputers
ScalableClusters
CloudComputing
Internetof Things
Internetof Things
Cloud ComputingI Often requires low-latency,
high-throughput to meet overallapplication requirements
I Increasingly w/ specialized HW
Internet-of-ThingsI Very limited resource constraints
(e.g., energy, memory)I Requires carefully managing
these resources to meet overallapplication requirements
I Increasingly w/ specialized HW
ECE 2400 Course Overview 17 / 30
What is Computer Systems Programming? Activity • Trends in Computer Systems Programming • Course Logistics
Example Application: Image Recognition
Starfish
Dog
ECE 2400 Course Overview 18 / 30
What is Computer Systems Programming? Activity • Trends in Computer Systems Programming • Course Logistics
Machine Learning (ML): Training vs. Inference
forward"starfish"
Training
many images
Model
=? "dog"
labels
errorbackward
Inferenceforward
"dog"
fewimages
ECE 2400 Course Overview 19 / 30
What is Computer Systems Programming? Activity • Trends in Computer Systems Programming • Course Logistics
Computer Systems Programming in ML
CloudComputing
Internetof
Things
Google TPUI Training is done using the
TensorFlow C++ frameworkI Training can take weeksI Google TPU is custom chipI High-level ML frameworks use
C++ under the hood
Movidius Myriad 2I Custom chip for ML on
embedded IoT devicesI Carefully crafted C/C++ ML
libraries for inferenceI Embedded control also
in C/C++
ECE 2400 Course Overview 20 / 30
What is Computer Systems Programming? Activity Trends in Computer Systems Programming • Course Logistics •
Application-LevelSoftware
System-LevelSoftware
ECE 2400 / ENGRD 2140Computer Systems Programming
What is Computer Systems Programming?
Activity: Comparing Algorithms
Trends in Computer Systems Programming
Course Logistics
ECE 2400 Course Overview 21 / 30
What is Computer Systems Programming? Activity Trends in Computer Systems Programming • Course Logistics •
ECE 2400 Within the Engineering Curriculum
Register-Transfer Level
Circuits
Devices
Instruction Set Architecture
Programming Language
Algorithm
Microarchitecture
Co
mp
ute
rE
ng
ine
eri
ng
Application
Operating System
Gate Level
Compiler
Technology
ECE 2300 Digital Logic & Computer Org
ECE 3140 Embedded Systems
ECE 4750 Computer Architecture
ECE 4760 Design with Microcontrollers
ECE 2400 Computer Systems Programming
CS 1110 / CS 1112 Intro to Computing
ECE 2400 is also an ENGRD and thus satisfies theengineering distribution requirement
ECE 2400 can be an excellent way to generally incorporateprogramming into your non-ECE engineering curriculum
ECE 2400 Course Overview 22 / 30
What is Computer Systems Programming? Activity Trends in Computer Systems Programming • Course Logistics •
Course Objectives
I describe a variety of algorithms and data structures and how toanalyze these algorithms and data structures in terms of time andspace complexity
I apply the C/C++ programming languages to implement algorithmsand data structures using different programming paradigms
I evaluate algorithm and data structure alternatives and make acompelling theoretical and/or practical argument for one approach
I create non-trivial C/C++ programs (roughly 1,000 lines of code) andthe associated testing strategy from an English language specification
I write concise yet comprehensive technical reports that describe aprogram implemented in C/C++, explain the testing strategy used toverify functionality, and evaluate the program to characterize itsperformance and memory usage
ECE 2400 Course Overview 23 / 30
What is Computer Systems Programming? Activity Trends in Computer Systems Programming • Course Logistics •
Course Structure
I Part 1: Procedural Programming. introduction to C, variables, expressions, functions, conditional & iteration
statements, recursion, static types, pointers, arrays, dynamic allocation
I Part 2: Basic Algorithms and Data Structures. lists, vectors, complexity analysis, insertion sort, selection sort, merge sort,
quick sort, hybrid sorts, stacks, queues, sets, maps
I Part 3: Multi-Paradigm Programming. transition to C++, namespaces, flexible function prototypes, references,
exceptions, new/delete, object oriented programming (C++ classes andinheritance for dynamic polymorphism), generic programming (C++templates for static polymorphism), functional programming (C++ functorsand lambdas), concurrent programming (C++ threads and atomics)
I Part 4: More Algorithms and Data Structures. trees (binary trees, binary search trees), tables (lookup tables, hash
tables), graphs
ECE 2400 Course Overview 24 / 30
What is Computer Systems Programming? Activity Trends in Computer Systems Programming • Course Logistics •
Programming Assignments
I PA1–3: Fundamentals. PA1: Math functions. PA2: List and Vector Data Structures. PA3: Sorting Algorithms
I PA4–5: Handwriting Recognition System. PA5: Linear vs. Binary Searching. PA5: Trees vs. Tables
I Every programming assignment involves. C/C++ “agile” programming. State-of-the-art tools for build systems,
version control, continuous integration,code coverage
. Performance measurement
. Short technical report
ECE 2400 Course Overview 25 / 30
What is Computer Systems Programming? Activity Trends in Computer Systems Programming • Course Logistics •
Application-LevelSoftware
System-LevelSoftware
ECE 2400 Course Overview 26 / 30
What is Computer Systems Programming? Activity Trends in Computer Systems Programming • Course Logistics •
Course Staff
I Prof. Batten InstructorI Yanghui Oh ECE PhDI Justin Joco ECE MEngI Mariangel Rivera CS seniorI Grace Zheng CS seniorI Sarah North ECE juniorI Rikako Onuma CS junior
I Course Staff C/C++ Experience. Many upper-level courses which use C/C++. Internship on YouTube image processing application (C). Internship on chip design file format parser (C). Internship on low-latency stock market trade validator (C). Internship on drone detection using optical flow (C++)
ECE 2400 Course Overview 27 / 30
What is Computer Systems Programming? Activity Trends in Computer Systems Programming • Course Logistics •
Frequently Asked Questions
I I have not taken CS 1110 nor CS 1112, can I take this class?. We assume some basic programming experience, discuss with instructor
I ECE Majors – How does ECE 2400 satisfy degree requirements?. ECE 2400 can count as your second ENGRD course. ECE 2400 can count as an outside-ECE technical elective. ECE 2400 satisfies the ECE advanced programming requirement
I CS Majors – Can I use ECE 2400 in place of CS 2110?. Kind of but you should probably take CS 2110
I ECE/CS Dual Majors – Can I use ECE 2400 in place of CS 2110?. Absolutely! (NEW)
I CS Minors – Can I use ECE 2400 in place of CS 2110?. Absolutely! (NEW)
ECE 2400 Course Overview 28 / 30
What is Computer Systems Programming? Activity Trends in Computer Systems Programming • Course Logistics •
Frequently Asked Questions
I Other Majors – How does ECE 2400 satisfy degree requirements?. ECE 2400 can count as one of your two required ENGRD courses
I ECE MEngs – How does ECE 2400 satisfy degree requirements?. ECE 2400 can count as a technical elective, but you remember you can
only use on ECE undergraduate course as a technical elective
I Should I take both ECE 2400 and CS 2110?. Sure! (recall popularity and performance data)
ECE 2400 Course Overview 29 / 30
What is Computer Systems Programming? Activity Trends in Computer Systems Programming Course Logistics
Application-LevelSoftware
System-LevelSoftware
Take-Away Points
I Computer systems programming involvesdeveloping software to connect the low-levelcomputer hardware to high-level, user-facingapplication software and usually requires carefulconsideration of performance and resourceconstraints
I We are entering an exciting era where computersystems programming will play a critical role inenabling both cloud computing and theinternet-of-things
ECE 2400 Course Overview 30 / 30