lec1 - University of Washington€¦ · CSE333 lec1 intro // 06-18-12 // perkins Communications...
Transcript of lec1 - University of Washington€¦ · CSE333 lec1 intro // 06-18-12 // perkins Communications...
![Page 1: lec1 - University of Washington€¦ · CSE333 lec1 intro // 06-18-12 // perkins Communications Discussion board (gopost)-Best for most things - everyone benefits from exchanges-Hint:](https://reader033.fdocuments.net/reader033/viewer/2022050223/5f690574df75c2750608c3ab/html5/thumbnails/1.jpg)
CSE333 lec1 intro // 06-18-12 // perkins
CSE 333Lecture 1 - Systems programming
Hal Perkins
Department of Computer Science & Engineering
University of Washington
![Page 2: lec1 - University of Washington€¦ · CSE333 lec1 intro // 06-18-12 // perkins Communications Discussion board (gopost)-Best for most things - everyone benefits from exchanges-Hint:](https://reader033.fdocuments.net/reader033/viewer/2022050223/5f690574df75c2750608c3ab/html5/thumbnails/2.jpg)
CSE333 lec1 intro // 06-18-12 // perkins
Welcome!
Today’s goals:
- introductions
- big picture
- course syllabus
- setting some expectations
![Page 3: lec1 - University of Washington€¦ · CSE333 lec1 intro // 06-18-12 // perkins Communications Discussion board (gopost)-Best for most things - everyone benefits from exchanges-Hint:](https://reader033.fdocuments.net/reader033/viewer/2022050223/5f690574df75c2750608c3ab/html5/thumbnails/3.jpg)
CSE333 lec1 intro // 06-18-12 // perkins
UsHal Perkins
Cortney Corbin
Soumya Vasisht
![Page 4: lec1 - University of Washington€¦ · CSE333 lec1 intro // 06-18-12 // perkins Communications Discussion board (gopost)-Best for most things - everyone benefits from exchanges-Hint:](https://reader033.fdocuments.net/reader033/viewer/2022050223/5f690574df75c2750608c3ab/html5/thumbnails/4.jpg)
CSE333 lec1 intro // 06-18-12 // perkins
Welcome!
Today’s goals:
- introductions
- big picture
- course syllabus
- setting some expectations
![Page 5: lec1 - University of Washington€¦ · CSE333 lec1 intro // 06-18-12 // perkins Communications Discussion board (gopost)-Best for most things - everyone benefits from exchanges-Hint:](https://reader033.fdocuments.net/reader033/viewer/2022050223/5f690574df75c2750608c3ab/html5/thumbnails/5.jpg)
CSE333 lec1 intro // 06-18-12 // perkins
Course map: 100,000 foot view
hardware
operating systemHW/SW interface(x86 + devices)
CPU memory storage networkGPU clock audio radio peripherals
OS / app interface(system calls)
C standard library(glibc)
C application
C++ STL / boost / standard library
C++ application
JRE
Java application
![Page 6: lec1 - University of Washington€¦ · CSE333 lec1 intro // 06-18-12 // perkins Communications Discussion board (gopost)-Best for most things - everyone benefits from exchanges-Hint:](https://reader033.fdocuments.net/reader033/viewer/2022050223/5f690574df75c2750608c3ab/html5/thumbnails/6.jpg)
CSE333 lec1 intro // 06-18-12 // perkins
Software “System”
A platform, application, or other structure that:
- is composed of multiple modules
‣ the system’s architecture defines the interfaces of and relationships between the modules
- often is complex
‣ in terms of its implementation, performance, management
- hopefully has requirements
‣ performance, security, fault tolerance, data consistency
![Page 7: lec1 - University of Washington€¦ · CSE333 lec1 intro // 06-18-12 // perkins Communications Discussion board (gopost)-Best for most things - everyone benefits from exchanges-Hint:](https://reader033.fdocuments.net/reader033/viewer/2022050223/5f690574df75c2750608c3ab/html5/thumbnails/7.jpg)
CSE333 lec1 intro // 06-18-12 // perkins
A layered view
layer below
your system
client
layer below
client client
• • •
understandsand relies onlayers below
providesservice to
layers above
![Page 8: lec1 - University of Washington€¦ · CSE333 lec1 intro // 06-18-12 // perkins Communications Discussion board (gopost)-Best for most things - everyone benefits from exchanges-Hint:](https://reader033.fdocuments.net/reader033/viewer/2022050223/5f690574df75c2750608c3ab/html5/thumbnails/8.jpg)
CSE333 lec1 intro // 06-18-12 // perkins
A layered view
layer below
your system
client
layer below
client client
• • •
constrainedby performance,
footprint, behavior of the layers below
more useful, portable, reliable
abstractions
![Page 9: lec1 - University of Washington€¦ · CSE333 lec1 intro // 06-18-12 // perkins Communications Discussion board (gopost)-Best for most things - everyone benefits from exchanges-Hint:](https://reader033.fdocuments.net/reader033/viewer/2022050223/5f690574df75c2750608c3ab/html5/thumbnails/9.jpg)
CSE333 lec1 intro // 06-18-12 // perkins
Example system
Operating system
- a software layer that abstracts away the messy details of hardware into a useful, portable, powerful interface
- modules:
‣ file system, virtual memory system, network stack, protection system, scheduling subsystem, ...
‣ each of these is a major system of its own!
- design and implementation has tons of engineering tradeoffs
‣ e.g., speed vs. (portability, maintainability, simplicity)
![Page 10: lec1 - University of Washington€¦ · CSE333 lec1 intro // 06-18-12 // perkins Communications Discussion board (gopost)-Best for most things - everyone benefits from exchanges-Hint:](https://reader033.fdocuments.net/reader033/viewer/2022050223/5f690574df75c2750608c3ab/html5/thumbnails/10.jpg)
CSE333 lec1 intro // 06-18-12 // perkins
Another example system
Web server framework
- a software layer that abstracts away the messy details of OSs, HTTP protocols, and storage systems to simplify building powerful, scalable Web services
- modules:
‣ HTTP server, HTML template system, database storage, user authentication system, ...
- also has many, many tradeoffs
‣ programmer convenience vs. performance
‣ simplicity vs. extensibility
![Page 11: lec1 - University of Washington€¦ · CSE333 lec1 intro // 06-18-12 // perkins Communications Discussion board (gopost)-Best for most things - everyone benefits from exchanges-Hint:](https://reader033.fdocuments.net/reader033/viewer/2022050223/5f690574df75c2750608c3ab/html5/thumbnails/11.jpg)
CSE333 lec1 intro // 06-18-12 // perkins
Systems programming
The programming skills, engineering discipline, and knowledge you need to build a system
- programming: C / C++
- discipline: testing, debugging, performance analysis
- knowledge: long list of interesting topics
‣ concurrency, OS interfaces and semantics, techniques for consistent data management, algorithms, distributed systems, ...
‣ most important: deep understanding of the “layer below”
• quiz: how many copies of your data are made when you use the read( ) system call to read from a file?
![Page 12: lec1 - University of Washington€¦ · CSE333 lec1 intro // 06-18-12 // perkins Communications Discussion board (gopost)-Best for most things - everyone benefits from exchanges-Hint:](https://reader033.fdocuments.net/reader033/viewer/2022050223/5f690574df75c2750608c3ab/html5/thumbnails/12.jpg)
CSE333 lec1 intro // 06-18-12 // perkins
Programming languages
Assembly language / machine code
- (approximately) directly executed by hardware
- tied to a specific machine architecture, not portable
- no notion of structure, few programmer conveniences
- possible to write really, really fast code
- necessary for a few critical parts of the operating system
- extraordinarily painful and fragile
![Page 13: lec1 - University of Washington€¦ · CSE333 lec1 intro // 06-18-12 // perkins Communications Discussion board (gopost)-Best for most things - everyone benefits from exchanges-Hint:](https://reader033.fdocuments.net/reader033/viewer/2022050223/5f690574df75c2750608c3ab/html5/thumbnails/13.jpg)
CSE333 lec1 intro // 06-18-12 // perkins
Programming languages
Structured but low-level languages (C, C++)
- hides some architectural details, is mostly portable, has a few useful abstractions like types, arrays, procedures, objects
- permits (forces?) programmer to handle low-level details like memory management, locks, threads
- low-level enough to be fast and to give the programmer control over resources
‣ double-edged sword: low-level enough to be complex, error-prone
‣ a useful shield: engineering discipline
![Page 14: lec1 - University of Washington€¦ · CSE333 lec1 intro // 06-18-12 // perkins Communications Discussion board (gopost)-Best for most things - everyone benefits from exchanges-Hint:](https://reader033.fdocuments.net/reader033/viewer/2022050223/5f690574df75c2750608c3ab/html5/thumbnails/14.jpg)
CSE333 lec1 intro // 06-18-12 // perkins
Programming languages
High-level languages (Python, Ruby, JavaScript, ...)
- focus on productivity and usability over performance
- powerful abstractions shield you from low-level gritty details (bounded arrays, garbage collection, rich libraries, ...)
- usually interpreted, translated, or compiled via an intermediate representation
- slower (by 1.2x-10x), less control
![Page 15: lec1 - University of Washington€¦ · CSE333 lec1 intro // 06-18-12 // perkins Communications Discussion board (gopost)-Best for most things - everyone benefits from exchanges-Hint:](https://reader033.fdocuments.net/reader033/viewer/2022050223/5f690574df75c2750608c3ab/html5/thumbnails/15.jpg)
CSE333 lec1 intro // 06-18-12 // perkins
Discipline
Cultivate good habits, encourage clean code
- coding style conventions
- unit testing, code coverage testing, regression testing
- documentation (code comments, design docs)
- code reviews
Will take you a lifetime to learn
- but oh-so-important, especially for systems code
‣ avoid write-once, read-never code
![Page 16: lec1 - University of Washington€¦ · CSE333 lec1 intro // 06-18-12 // perkins Communications Discussion board (gopost)-Best for most things - everyone benefits from exchanges-Hint:](https://reader033.fdocuments.net/reader033/viewer/2022050223/5f690574df75c2750608c3ab/html5/thumbnails/16.jpg)
CSE333 lec1 intro // 06-18-12 // perkins
Knowledge
Tools
- gcc, gdb, g++, objdump, nm, gcov/lcov, valgrind, IDEs, race detectors, model checkers, ...
Lower-level systems
- UNIX system call API, relational databases, map/reduce, Django, jQuery, ...
Systems foundations
- transactions, two-phase commit, consensus, RPC, virtualization, cache coherence, applied crypto, ...
![Page 17: lec1 - University of Washington€¦ · CSE333 lec1 intro // 06-18-12 // perkins Communications Discussion board (gopost)-Best for most things - everyone benefits from exchanges-Hint:](https://reader033.fdocuments.net/reader033/viewer/2022050223/5f690574df75c2750608c3ab/html5/thumbnails/17.jpg)
CSE333 lec1 intro // 06-18-12 // perkins
Welcome!
Today’s goals:
- introductions
- big picture
- course syllabus
- setting some expectations
![Page 18: lec1 - University of Washington€¦ · CSE333 lec1 intro // 06-18-12 // perkins Communications Discussion board (gopost)-Best for most things - everyone benefits from exchanges-Hint:](https://reader033.fdocuments.net/reader033/viewer/2022050223/5f690574df75c2750608c3ab/html5/thumbnails/18.jpg)
CSE333 lec1 intro // 06-18-12 // perkins
C / C++ programming
Major focus of this course
- ~2 weeks of diving deeper into C
‣ review some material from 351 and go deeper
- ~4 weeks of a (sane subset) of C++
- exposure to programming tools
‣ unit testing frameworks, performance profiling and analysis, revision control systems
![Page 19: lec1 - University of Washington€¦ · CSE333 lec1 intro // 06-18-12 // perkins Communications Discussion board (gopost)-Best for most things - everyone benefits from exchanges-Hint:](https://reader033.fdocuments.net/reader033/viewer/2022050223/5f690574df75c2750608c3ab/html5/thumbnails/19.jpg)
CSE333 lec1 intro // 06-18-12 // perkins
Interacting with UNIX and standard libraries
The “layers below” we will be relying on
- learn C’s standard library and some of C++’s STL
‣ including memory management (malloc/new, free/delete)
‣ we’ll look at some of C++11 and boost
- learn aspects of the UNIX system call API
‣ I/O: storage, networking
‣ process management, signals
![Page 20: lec1 - University of Washington€¦ · CSE333 lec1 intro // 06-18-12 // perkins Communications Discussion board (gopost)-Best for most things - everyone benefits from exchanges-Hint:](https://reader033.fdocuments.net/reader033/viewer/2022050223/5f690574df75c2750608c3ab/html5/thumbnails/20.jpg)
CSE333 lec1 intro // 06-18-12 // perkins
Potential additional topics
Concurrency
- threads
- perhaps asynchronous I/O and event-driven programming
Security
- will be mindful of security topics as they come up
- e.g., how to avoid buffer overflow issues in C/C++
![Page 21: lec1 - University of Washington€¦ · CSE333 lec1 intro // 06-18-12 // perkins Communications Discussion board (gopost)-Best for most things - everyone benefits from exchanges-Hint:](https://reader033.fdocuments.net/reader033/viewer/2022050223/5f690574df75c2750608c3ab/html5/thumbnails/21.jpg)
CSE333 lec1 intro // 06-18-12 // perkins
Welcome!
Today’s goals:
- introductions
- big picture
- course syllabus
- setting some expectations
![Page 22: lec1 - University of Washington€¦ · CSE333 lec1 intro // 06-18-12 // perkins Communications Discussion board (gopost)-Best for most things - everyone benefits from exchanges-Hint:](https://reader033.fdocuments.net/reader033/viewer/2022050223/5f690574df75c2750608c3ab/html5/thumbnails/22.jpg)
CSE333 lec1 intro // 06-18-12 // perkins
What you will be doingAttending lectures and sections
- lecture: ~25 of them, MWF here
- sections: ~9 of then, Thu 9:40, also here
- Take notes!!! Don’t expect everything to be on the web
Doing programming projects
- ~4 of them, successively building on each other
- includes C, C++; files, networking
Doing programming exercises
- one per lecture, due before the next lecture begins
- coarse-grained grading (0, 1, 2 or 3)
![Page 23: lec1 - University of Washington€¦ · CSE333 lec1 intro // 06-18-12 // perkins Communications Discussion board (gopost)-Best for most things - everyone benefits from exchanges-Hint:](https://reader033.fdocuments.net/reader033/viewer/2022050223/5f690574df75c2750608c3ab/html5/thumbnails/23.jpg)
CSE333 lec1 intro // 06-18-12 // perkins
Project DeadlinesGoal: keep everyone on schedule, consistent at 11 pm, allow a little slack - but how?
Option 1:
- 10% deduction each day late, max 2 days per assignment
- 2 free “late days” during the quarter
Option 2:
- No late penalties, assignments due at deadline
- 4 free “late days” for the quarter, no more than 2 per assignment
Which should we use? Alternatives?
No late days for exercises in any case - due 9 am before lecture
![Page 24: lec1 - University of Washington€¦ · CSE333 lec1 intro // 06-18-12 // perkins Communications Discussion board (gopost)-Best for most things - everyone benefits from exchanges-Hint:](https://reader033.fdocuments.net/reader033/viewer/2022050223/5f690574df75c2750608c3ab/html5/thumbnails/24.jpg)
CSE333 lec1 intro // 06-18-12 // perkins
Requirements
CSE351 is a prerequisite
- I assume you have just a little exposure to C
- I assume you know what a linked list, tree, hash table is
You need access to a CSE linux environment
- undergraduate labs, ssh into attu.cs, use CSE home VMs
![Page 25: lec1 - University of Washington€¦ · CSE333 lec1 intro // 06-18-12 // perkins Communications Discussion board (gopost)-Best for most things - everyone benefits from exchanges-Hint:](https://reader033.fdocuments.net/reader033/viewer/2022050223/5f690574df75c2750608c3ab/html5/thumbnails/25.jpg)
CSE333 lec1 intro // 06-18-12 // perkins
Textbooks
Recommended (strongly):
- Computer Systems, A Programmer’s Perspective (“CSAAP”)
‣ [2nd Ed]. CSE351 textbook; do you already have it?
- C: A Reference Manual (“CARM”) [5th Ed]
- C++ Primer (“C++P”) [5th Ed]
Optional (but cool):
- Effective C++ [3rd Ed]
We’ll also take advantage of online resources...
![Page 26: lec1 - University of Washington€¦ · CSE333 lec1 intro // 06-18-12 // perkins Communications Discussion board (gopost)-Best for most things - everyone benefits from exchanges-Hint:](https://reader033.fdocuments.net/reader033/viewer/2022050223/5f690574df75c2750608c3ab/html5/thumbnails/26.jpg)
CSE333 lec1 intro // 06-18-12 // perkins
Communications
Discussion board (gopost)
- Best for most things - everyone benefits from exchanges
- Hint: post something, then unread postings will be tagged
cse333-staff@cs
- Use for communications that don’t belong on the board
Perspective: Real software, real APIs, real bugs
- We’ll try to help as best we can, but mostly expect ideas for what to try, where to look. Debugging is your job.
![Page 27: lec1 - University of Washington€¦ · CSE333 lec1 intro // 06-18-12 // perkins Communications Discussion board (gopost)-Best for most things - everyone benefits from exchanges-Hint:](https://reader033.fdocuments.net/reader033/viewer/2022050223/5f690574df75c2750608c3ab/html5/thumbnails/27.jpg)
CSE333 lec1 intro // 06-18-12 // perkins
Collaboration
Some of the projects will be individual, some in teams
- assume individual unless explicitly stated otherwise
Cross-team collaboration is useful and expected
- help other teams with programming fundamentals, concepts
Plagiarism and cheating is verboten
- helping other teams with assignments, debugging their code
- relying on help without attributing in your writeups
![Page 28: lec1 - University of Washington€¦ · CSE333 lec1 intro // 06-18-12 // perkins Communications Discussion board (gopost)-Best for most things - everyone benefits from exchanges-Hint:](https://reader033.fdocuments.net/reader033/viewer/2022050223/5f690574df75c2750608c3ab/html5/thumbnails/28.jpg)
CSE333 lec1 intro // 06-18-12 // perkins
For Wednesday
Homework #0 is due (a short survey):
- https://catalyst.uw.edu/webq/survey/perkins/171716
Exercise 0 is due
- http://www.cs.washington.edu/education/courses/cse333/12su/exercises/ex0.html
![Page 29: lec1 - University of Washington€¦ · CSE333 lec1 intro // 06-18-12 // perkins Communications Discussion board (gopost)-Best for most things - everyone benefits from exchanges-Hint:](https://reader033.fdocuments.net/reader033/viewer/2022050223/5f690574df75c2750608c3ab/html5/thumbnails/29.jpg)
CSE333 lec1 intro // 06-18-12 // perkins
See you on Wednesday!