# Concurrent Programming This repository holds all my answers to the exercises for the 202.2 Concurrent Programming course > [!NOTE] > Some exercises may not be complete, although most of them are fully functioning ## Table of Contents * [Exercises](#exercises) * [Lab 01 - Thread Objects and Synchronization](#lab-01---thread-objects-and-synchronization) * [Lab 01 (bis) - Thread Objects and Synchronization](#lab-01-bis---thread-objects-and-synchronization) * [Lab 02 - Liveness, Guarded Blocks and Immutable Objects](#lab-02---liveness-guarded-blocks-and-immutable-objects) * [Lab 02 (bis) - Liveness, Guarded Blocks and Immutable Objects](#lab-02-bis---liveness-guarded-blocks-and-immutable-objects) * [Lab 03 - Lock Objects](#lab-03---lock-objects) * [Lab 03 (bis) - Lock Objects](#lab-03-bis---lock-objects) * [Lab 04 - Executors, Callable and Fork-Join](#lab-04---executors-callable-and-fork-join) * [Lab 05 - Concurrent Collections and Atomic Variables](#lab-05---concurrent-collections-and-atomic-variables) * [Lab 06 - Synchronizers](#lab-06---synchronizers) * [Lab 07 (Workshop) - Summarizing exercises](#lab-07-workshop---summarizing-exercises) ## Exercises ### Lab 01 - Thread Objects and Synchronization - [A: Defining and Starting A Thread](src/exercises/ex_a/TestingSimpleThreads.java) - [B: Pausing Execution With Sleep](src/exercises/ex_b/TestingSleep.java) - [C: Interruptions](src/exercises/ex_c/TestingSleep.java) - [D: Joins](src/exercises/ex_d/TestingJoins.java) - [E: Thread Interference: Managing Bank Accounts](src/exercises/ex_e/TestingThreadInterferences.java) - [F: Synchronized Methods: Ensuring consistent operations on bank accounts](src/exercises/ex_f/TestingThreadInterferences.java) - [G: Synchronized Statements](src/exercises/ex_g/TestingSynchronizedStatements.java) ### Lab 01 (bis) - Thread Objects and Synchronization - [Dbis: Joins](src/exercises/ex_d_bis/TestStepThreads.java) ### Lab 02 - Liveness, Guarded Blocks and Immutable Objects - [H1: Refactoring from Deadlocks](src/exercises/ex_h1/TestThreadWithDeadlock.java) - [H2: Bridge crossing without deadlock](src/exercises/ex_h2/TestDeadlockBridge.java) - [I: Starvation: simulating the access of employees to a conference room](src/exercises/ex_i/TestingStarvation.java) - [J: Livelock : couple eating](src/exercises/ex_j/LivelockDinner.java) - [K: Guarded Blocks : managing packages in a post office](src/exercises/ex_k/TestingGuardedBlocks.java) - ~~L: Immutable objects: From person to statue~~ ### Lab 02 (bis) - Liveness, Guarded Blocks and Immutable Objects - [Kbis1: Guarded Blocks : a service desk](src/exercises/ex_k_bis1/TestServiceDesk.java) - ~~Kbis2: Playing Tennis~~ ### Lab 03 - Lock Objects - ~~M: ReentrantLock: Sharing a Vehicle in a couple~~ - [N: ReentrantReadWriteLock: News Feed](src/exercises/ex_n/TestingReentrantReadWriteLock_News.java) - [O: ReentrantLockWithConditions: NumberProducersConsumers](src/exercises/ex_o/TestingReentrantLockWithConditions.java) ### Lab 03 (bis) - Lock Objects - [Nbis: ReentrantReadWriteLock: Managing a library catalog system](src/exercises/ex_n_bis/LibraryCatalog.java) ### Lab 04 - Executors, Callable and Fork-Join - [P: Executors for Drums](src/exercises/ex_p/Partition.java) - [Pbis: Christmas Lights Task Scheduler](src/exercises/ex_p_bis/ChristmasTreeTester.java) - [Q1: Callables and Futures for a Pizzeria](src/exercises/ex_q1/Pizzeria.java) - [Q2: Fork/Join: Song](src/exercises/ex_q2/ForkJoinTest.java) - [Q3: Arrays.parallelSort](src/exercises/ex_q3/Library.java) - ~~Q4: Concurrent Array Sum Calculation~~ ### Lab 05 - Concurrent Collections and Atomic Variables - [R: BlockingQueue: Simulating a PostOffice](src/exercises/ex_r/TestingBlockingQueue_PostOffice.java) - [S1: ConcurrentHashMap in the Farm](src/exercises/ex_s1/TestingConcurrentHashMap_Farm.java) - [S2: Comparing Atomic Arrays and Standard Arrays](src/exercises/ex_s2/TestingAtomicInteger.java) - [S3: java.util.concurrent.atomic package: Creativity](src/exercises/ex_s3/TestingAtomicLong.java) ### Lab 06 - Synchronizers - [T: Semaphore for Dog Feeding](src/exercises/ex_t/TestingSemaphore_DogBreeder.java) - [U: CountDownLatch: Starting the Family Trip](src/exercises/ex_u/TestingCountDownLatch_FamilyTrip.java) - [V: CyclicBarrier: Patrouille de Glaciers](src/exercises/ex_v/TestingCyclicBarrier_PDG.java) - [W: Exchanger: Bring my Car to the Garage](src/exercises/ex_w/TestingExchanger_Garage.java) - [X: Phaser for the Next Family Bike Trip](src/exercises/ex_x/TestingPhaserFamilyBikeTrip.java) - [y: Synchronized Race (former exam)](src/exercises/ex_y/RaceTester.java) ### Lab 07 (Workshop) - Summarizing exercises - ~~Z1: The dining philosophers~~ - ~~Z2: The Sleeping Barber Problem~~ - ~~Z3: Print Queue Management~~ - [Z4: Concurrent Auction Problem](src/exercises/ex_z4/AuctionMain.java)