lecture_00_introduction_handouts
lecture_00_introduction_handouts
CS454
Principles of
Concurrent
Programming
Spring 2024
Instructor: Luís Pina
Lecture 0: Introduction
1
1
1/9/2024
Introduction
• My name is: Luís Pina
• Lu-eesh (like in leash) Pee-na (not Peña)
• Joined UIC in August 2019
Introduction
• My background is in Programming
Languages and Software Systems
• My dissertation was on Dynamic Software
Updates
• How to update a program without stopping it?
2
1/9/2024
Introduction
• I enjoy biking
3
1/9/2024
4
1/9/2024
How did
we get
here?
5
1/9/2024
The past
• Free performance improvement
with new hardware
• Single-threaded performance
keeps going up
• Because clock speed keeps
increasing
• No need/room to increase cores
• Not enough transistors
6
1/9/2024
The future?
The future?
7
1/9/2024
The future?
WRONG
8
1/9/2024
18
9
1/9/2024
Mobile
CPU die
(nVidia
Tegra 2)
10
1/9/2024
How do we
program
multicores?
CS454 Spring 2024 - Prof. Luís Pina 22
22
11
1/9/2024
12
1/9/2024
// Thread 1 // Thread 2
a = 1; b = 1;
return b; return a;
Which is impossible?
a) T1 returns 1, T2 returns 0
b) T1 returns 0, T2 returns 1
c) T1 returns 1, T2 returns 1
d) T1 returns 0, T2 returns 0
e) All results above are possible
// Thread 1 // Thread 2
a = 1; b = 1;
return b; return a;
13
1/9/2024
Demo
// Thread 1 // Thread 2
a = 1; b = 1;
return b; return a;
14
1/9/2024
// Thread 1 // Thread 2
a = 1; b = 1;
return b; return a;
// Thread 2
b = 1;
return a;
15
1/9/2024
// Thread 2
b = 1;
return a;
// Thread 2
b = 1;
return a;
16
1/9/2024
Concurrent Programming
• Locks are only a part of
concurrent programming
• More things to see:
• Memory models
• Cache effects
• Thread communication
• Android UI thread
• Non-blocking Synchronization
• Atomic instructions
• Volatile variables
• Much more…
Pre-requisites
CS 361: Computer Systems
• C programming
• Threads, locks, mutual exclusion
17
1/9/2024
Prerequisites
How familiar with Java are you?
a) Never heard of Java
b) I have heard of Java but never used it
c) I used Java on a personal project
d) I took a class at UIC that used Java
e) I interned at a company that used Java
44
Grading - Undergrads
• Attendance: 15%
• Midterm: 15%
• Final: 20%
45
18
1/9/2024
Grading - Grads
• Attendance: 10%
• Midterm: 15%
• Final: 15%
46
Attendance
You can get points for attendance using one of two ways:
• In person and online synchronous
• Attend the lecture live Mondays and Wednesdays
• Online through Zoom
• Link on syllabus, Piazza, BB
• Answer 80% of clicker questions = full marks
• Classes start on time, but you can be a bit late and miss the first question and still get
full attendance
• Correctness does not count: Wrong answers are OK
• We will use iClicker for this
• Today does not count
• You can use iClicker Cloud remotely or from your phone
• No need to buy a clicker
• Please create an account on www.iclicker.com
47
19
1/9/2024
Attendance
You can get points for attendance using one of two ways:
• In person and online synchronous
• Attend the lecture live Mondays and Wednesdays
• Online through Zoom
• Link on syllabus, Piazza, BB
• Answer 80% of clicker questions = full marks
• Classes start on time, but you can be a bit late and miss the first question and still get
full attendance You attended class and
• Correctness does not count: Wrong answers are OK answered all clicker
• We will use iClicker for this questions wrong
• Today does not count a) You got attendance for
this class
• You can use iClicker Cloud remotely or from your phone
b) To get attendance, you
• No need to buy a clicker
also have to fill the BB
• Please create an account on www.iclicker.com
poll and get all answers
CS454 Spring 2024 – Prof. Luis Pina right 48
48
Attendance
You can get points for attendance using one of two ways:
• In person and online synchronous
• Attend the lecture live Mondays and Wednesdays
• Online through Zoom
• Link on syllabus, Piazza, BB
• Answer 80% of clicker questions = full marks
• Classes start on time, but you can be a bit late and miss the first question and still get
full attendance You attended class but arrived
late and missed the 1st
• Correctness does not count: Wrong answers are OK
question (but answered all
• We will use iClicker for this others)
• Today does not count a) You got attendance for this
• You can use iClicker Cloud remotely or from your phone class
• No need to buy a clicker b) To get attendance, you also
• Please create an account on www.iclicker.com have to fill the BB poll and
get all answers right
CS454 Spring 2024 – Prof. Luis Pina 49
49
20
1/9/2024
Attendance
You can get points for attendance using one of two ways:
• Asynchronous
• Watch the lecture offline
• Fill out poll on Gradescope on the clicker questions
• Until Sunday at 5pm
• Must get all the answers correct to count
• Poll is a subset of all clicker questions
• Clicker question N in class may not be question N in the poll
• Use the provided slides to answer questions correctly
50
Async Attendance
21
1/9/2024
Async Attendance
Attendance
• Attend 80% of classes for full marks
• In person, remote, or offline
• You can mix and match
• You can miss 5 classes
53
22
1/9/2024
Attendance Disclaimer
• You are supposed to come in-person
• If in-person attendance drops below 50%, getting attendance via Zoom
will not be an option anymore
• Use Zoom as a back-up in case you really cannot be on campus that day
54
Assignments
• 5 assignments in Java worth 10% each = 50%
• Assignments are autograded with tests, each worth 10%
• I release all the tests with the assignments
• But I take hard-coding very seriously
• You get your grade after each submission
55
23
1/9/2024
Assignment Release
• Every other week there’s an assignment due
• One week: Assignment is out
• Next week: Assignment is due
56
57
24
1/9/2024
58
59
25
1/9/2024
Assignment Submission
• Written in Java 11
• Submitted through Github
• You have to accept the Github Classroom invitation
• You get a private repository for your code
• The last commit before the deadline is your submission
• Recommended editor: InteliJ IDEA
• Automatic Grader on Github
• Runs for each commit
• You can check your grade at any point
• I will release a set-up video for Assignment 0 that explains everything
• You must finish Assignment 0 to ensure you understand everything
60
Register your
Github account
• Please register your Github
account name using the following
link: https://forms.gle/zneacPFYpR9MVwgEA
61
26
1/9/2024
Register your
Github account
• Please register your Github
account name on the BB poll
62
Assignment Bonus
• Ask questions on Piazza
• Questions must be
• Public
• Not anonymous to the instructors
• Tagged with the assignment label
• Each question marked as good is worth 5% bonus
• Answer questions on Piazza
• Each endorsed answer is worth 5% bonus
• Find duplicates
• Answer an already answered question with a link to the original answer
• 5% each
63
27
1/9/2024
• No late submissions
• Your submission is the latest commit in your
Github repo before the deadline
64
Assignment Re-Submission
• Assignments can be resubmitted for one week after
the due date
• I will release a video solution of each assignment
• You can go over my solution, fix your submission, and
resubmit it
• “Pair-program with the professor”
• You have until the next Saturday at 5PM to do so
• Final assignment grade
• Average between the original grade (with bonus) and the
resubmission grade
• Restrictions
• Original grade of 30% or more (50% for grads)
• Text submission explaining what you changed
65
28
1/9/2024
Assignments Grading
• Mostly auto-graded
• Immediate feedback after submission
Assignments Grading
• Mostly auto-graded
• Immediate feedback after submission
29
1/9/2024
Academic
• How many are OK?
Integrity
i. I wrote pseudo-code together with a colleague that
we then implemented separately
ii. Someone sent me their implementation of (i) before I
finished mine and I used it
iii. I worked with a friend just to get the assignment
started, then we went our separate ways
iv. I got someone to write code for me
Academic Integrity
• You have to write all the code you turn in
• You can discuss how to implement the assignments with
your colleagues
30
1/9/2024
Assignment Plagiarism
if (a == 1) b = 2; if (x != 1) { // empty }
else { y = 2; }
70
Assignment Plagiarism
if
== =
a 1 b 2
if (a == 1) b = 2; if (x != 1) { // empty }
else { y = 2; }
71
31
1/9/2024
Assignment Plagiarism
if if
== = == =
a 1 b 2 x 1 y 2
if (a == 1) b = 2; if (x != 1) { // empty }
else { y = 2; }
72
Assignment Plagiarism
73
32
1/9/2024
Assignment Plagiarism
74
Assignment Plagiarism
•Zero grade on the assignment
75
33
1/9/2024
Assignment Plagiarism
•Good reasons to not
• Office hours
• Piazza (you get bonus for asking questions!)
• Resubmission possible
• You can improve a low grade by A LOT
• Original submission 30%, resubmission 100% = 65% (more than 2x improvement)
• Original submission 50%, resubmission 100% = 75%
• Original submission 80%, resubmission 100% = 90%
76
Exams
• Midterm exam: 15%
• February 27th, 2024
• During class
• Final exam: 20%
• TBD (the university tells me when)
• Exams are in-person
• Everybody takes it at the same time in the same room as lectures take place
77
34
1/9/2024
Reading
• Required Textbooks
• The Art of Multiprocessor Programming
Grading - Undergrads
• Attendance: 15%
• Midterm: 15%
• Final: 20%
79
35
1/9/2024
Grading - Grads
• Attendance: 10%
• Midterm: 15%
• Final: 15%
80
Research Presentation
• Pick a topic about concurrency not seen in class
• One chapter from the book that we did not cover
• A research paper you are working on / you read
• A tool you want to learn more about
81
36
1/9/2024
Grading - Grads
• Attendance: 10%
• Midterm: 15%
• Final: 15%
82
83
37
1/9/2024
quizzes
• Failed midterm
• Current grade
• End grade
38
1/9/2024
https://cs474-uic.github.io/cs454-s24-site/
86
Announcements
• All announcements will be posted on Piazza
• No announcements on Blackboard
• No announcements via email
• Only individual communications from me to you
• Some announcements will be repeated on the class website
• External class visibility
• Not a good source for class-related updates
• Useful for syllabus, planning, calendar, schedule
87
39
1/9/2024
Self-Care
• Sleep, eat, exercise
• Take time off work
• “Pomodoro technique” to focus on tasks
•https://en.wikipedia.org/wiki/Pomodoro_Technique
• “Getting things done” for time management
•https://en.wikipedia.org/wiki/Getting_Things_Done
• 7 ways to maximize misery
•https://www.youtube.com/watch?v=LO1mTELoj6o
•Book “How to Be Miserable: 40 Strategies You Already Use” by
Paterson PhD, Randy J.
Resources
•Wellness center:
• https://wellnesscenter.uic.edu/resources-and-services/
•Free food pantry
•Free wellness supplies
•Stress relief
•Homelessness, addiction help
40
1/9/2024
Office Hours
• On Zoom
• Same as online lectures
• Online:
• Wednesdays 3pm-4pm, and Fridays 11am-12noon
• Zoom
41
1/9/2024
Office Hours
• On BB Collab
• Same as online lectures
Can you make it to
• Prof Pina (me)
• Wednesdays, 3pm to 4pm
office hours?
• Thursdays 2pm to 3pm a) Yes for all
• Fridays, 11am to 12noon b) Yes for many
• More upon request c) Yes for one
• Extra before assignment deadline (Friday) d) No for any
Netiquette
1. Use professional language. Always say please and thank you and leave text messaging
abbreviations out of messages and posts. Be positive and constructive in your feedback to replies
to students.
2. Try not to use all caps--it comes across as shouting to the reader. Use "bold" formatting or use
quotes to emphasize a word or phrase. It may be okay at times for headings or to place emphasis
on a web page, but try to avoid it when communicating on discussion boards or corresponding
with others electronically.
3. User proper language and titles – no slang or profanity. Even if a word is one you consider to be
"not so bad," it could be offensive to others.
4. Review posts and messages before saving. Check for grammar and spelling errors and restate
your message when necessary.
5. Ask for clarification. If you do not understand an assignment or feedback from me, please ask for
clarification. I will do my best to word my posts/messages as clearly as possible, but in an online
environment, I cannot "see" if my messages are being understood.
6. Consider turning on your camera/microphone on interactions with the instructors. You are
encouraged to turn on your camera and microphone during live lectures, and even more so during
interactions with the instructor during office hours. The instructors will always have their camera
and microphone on.
42
1/9/2024
Lecture slides
• Made available ahead of the lecture on Piazza’s resources
101
Assignment
• Goal: Understand how to:
0
• Start an assignment
• Work on an assignment
• Submit an assignment
• Check your grade
• Trivial Java code // Each student has their own code
System.out.println("987123817");
• Different for each student
• You have to check the autograder to see what is your solution
• Accept assignment at: https://classroom.github.com/a/o6KW5LaF
• Follow instructions on the Assignment 0 intro video, on Echo360
• You must submit Assignment 0 to receive any grade
43
1/9/2024
Take-Home Quiz
•Goal: Become familiar with the academic integrity and syllabus
•Take-home quiz on Gradescope
•Due on Saturday 01/20
•No grade for CS454 without finishing this quiz
•100% answers correct required
•Unlimited automatic submissions
•Got one answer wrong? Re-read, resubmit
•Got two wrong? See above x2, no penalty
Questions?
104
44
1/9/2024
Tasks
Before Wednesday
• Check access to Piazza
• Check access to Gradescope
• Add iClicker for attendance
Saturday 01/20
Thursday
105
45