Computer Science 225
Advanced Programming
Spring 2022, Siena College
Lecture 16: More Threads and Concurrency
Date: Monday, April 4, 2022
Agenda
- Announcements
- Problem Set 6 due at the end of the week
- Lab 7: Recursive Graphics and Graphics Objects (in Canvas and GitHub) -
finish up soon, see added info on the lab's Canvas page
- Lab 8: Animation (in Canvas and GitHub) - due as usual this week before
your labs
- Final Project
- groups should be formed today and share your repository link
with me
- proposals due in a week
- We will go over the questions from last Friday's task in class
this Friday
- Exam 2 next week
- similar format to Exam 1: closed book written questions, and
open book/notes/examples/API programming tasks
- up to today's class, Lab 8, Problem Set 6 (Friday's
work in class and this week's lab will be helpful to you but not
specifically covered)
- expect a question which is essentially a redo of an Exam 1
question (so be sure you understand all of those!)
- scheduling: fill out the form if you haven't yet, time or
times will be announced soon
- no labs next week
- In-class exercise (5 points), create a Google document in your
shared CSIS 225 folder for your response.
- Build a table that lists all of the possible interleavings of
the instructions in the notes where Thread A and Thread B
concurrently execute an increment and a decrement of the same
variable counter.
- Suppose the counter variable starts at 0 before any of
the statements are executed. Add a column to your table that
gives the value of counter after the statements have been
executed.
- Highlight the rows so that ones for which counter will
have the correct final value (that is, the same as it was when we
started) in green, and ones that give an incorrect answer in
red.
- repaint frequency
- a bouncing ball
Examples