https://github.com/stefnotch/tu2021-oop-forest
A little program me and a few course mates wrote at the TU Vienna
https://github.com/stefnotch/tu2021-oop-forest
Last synced: about 16 hours ago
JSON representation
A little program me and a few course mates wrote at the TU Vienna
- Host: GitHub
- URL: https://github.com/stefnotch/tu2021-oop-forest
- Owner: stefnotch
- Created: 2022-02-21T21:20:14.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-02-21T21:25:13.000Z (over 4 years ago)
- Last Synced: 2025-02-28T19:39:46.384Z (over 1 year ago)
- Language: Java
- Size: 9.77 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# tu2021-oop-forest
The task was to simulate some trees and a few bug populations. Each bug population had to be its own thread. They could eat the trees (shared datastructure) they were sitting on and each other (stopping threads). They could also reproduce (creating threads) or painfully starve to death.
This solution creates an entire "waiting graph", just like how one would imagine a very simplistic database to work. Pretty fun idea ;)
The intended solution was to enforce a total ordering of locks, so that in the worst case, when everyone locks their previous neighbor, the bottom right one can still do its job.
Also, Java is a terrible programming language. Not just because multithreading is so unsafe in it.