32 lines
1.4 KiB
Markdown
32 lines
1.4 KiB
Markdown
# Advanced Multithreading Workshop
|
|
|
|
This project contains the workshop materials for the Advanced Programming multithreading session. It has been migrated from Gradle to Maven and structured for clear delivery.
|
|
|
|
## Project Structure
|
|
|
|
- `src/main/java/workshop/exercises/`: Unsolved skeleton files with clear `TODO` markers. These are the templates to distribute to students and use during live coding.
|
|
- `src/main/java/workshop/solutions/`: Fully implemented reference solutions for grading and internal testing.
|
|
|
|
## Exercises Covered
|
|
|
|
1. **`LockWorkshop`**: Resolving race conditions on a shared mutable counter using explicit `ReentrantLock` coordination.
|
|
2. **`SynchronizedWorkshop`**: Resolving race conditions on a shared mutable counter using intrinsic Java monitors (`synchronized` block).
|
|
3. **`DeadlockPreventionWorkshop`**: Resolving a classic thread circular wait condition by enforcing global lock ordering based on unique Resource IDs.
|
|
4. **`TaylorSeries`**: Implementing high-precision math with `BigDecimal` and calculating the Taylor series for $\sin(x)$ using a thread pool (`ExecutorService`).
|
|
|
|
## Requirements
|
|
- Java 17 or higher
|
|
- Apache Maven 3.6+
|
|
|
|
## How to Build and Run
|
|
|
|
To compile the project:
|
|
```bash
|
|
mvn clean compile
|
|
```
|
|
|
|
To execute any of the workshop main classes (for example, the Lock Workshop solution):
|
|
```bash
|
|
mvn exec:java -Dexec.mainClass="workshop.solutions.LockWorkshopSolution"
|
|
```
|