In src/day1/CoarseGrainedBank.kt,
make the sequential bank implementation thread-safe.
Please follow the coarse-grained locking scheme to make synchronization efficient.
For that, you need to use a single lock to protect all bank operations.
To test your solution, please run:
./gradlew test --tests CoarseGrainedBankTeston Linux or MacOSgradlew test --tests CoarseGrainedBankTeston Windows
In src/day1/FineGrainedBank.kt,
make the sequential bank implementation thread-safe.
Please follow the fine-grained locking scheme to make synchronization efficient.
For that, you need to use per-account locks, thus, ensuring natural parallelism
when accessing different accounts. The totalAmount() function should acquire
all the locks to get a consistent snapshot, while transfer(..) should acquire
the corresponding account locks.
To test your solution, please run:
./gradlew test --tests FineGrainedBankTeston Linux or MacOSgradlew test --tests FineGrainedBankTeston Windows
In src/day1/TreiberStack.kt,
implement the classic Treiber stack algorithm.
To test your solution, please run:
./gradlew test --tests TreiberStackTeston Linux or MacOSgradlew test --tests TreiberStackTeston Windows
In src/day1/TreiberStackWithElimination.kt,
implement the classic Treiber stack algorithm with the elimination technique.
To test your solution, please run:
./gradlew test --tests TreiberStackWithEliminationTeston Linux or MacOSgradlew test --tests TreiberStackWithEliminationTeston Windows