This is Java application developed by Clarice Abreu.
The project was developed for the Operation Systems course from University of São Paulo.
The discription of the project in Portuguese is available at: https://drive.google.com/open?id=12s7DsRjRag9ie9A-iDVQMfVnF8lJTSuY
The complete report of the project in Portuguese is available at: https://docs.google.com/document/d/18XSamfLG6u7XeN9CTWI0hQ-W9QifN4bFXoIaQJ543DI/edit?usp=sharing
The main objective of the app is to read and write in a shared file which is treated as a critial area. The app tests three different approches:
- Blocking the entire critical area every time a writer or reader object enters it.
- Blocking the critical area only when writer's objects enter it and giving preference to readers over writers
- Blocking the critical area only when writer's objects enter it and giving preference to writers over readers
The access to the file is made 100 times by 100 Threads. The ratio of reader-writer Threads ranges from 0 writers and 100 readers to 100 readers and 0 writers, and the order between writers and readers is randomized. Therefore the application runs as the following:
- 1st Iteration: 0 writers Threads and 100 readers Threads access the critical area in the three different approachs
- 2nd Iteration: 1 writer Thread and 99 readers Threads access the critical area in the three different approachs
- 3rd Iteration: 2 writers Threads and 98 readers Threads access the critical area in the three different approachs
- ...
- 99th Iteration: 99 writers Threads and 1 reader Thread access the critical area in the three different approachs
- 100th Iteration: 100 writers Threads and 0 readers Threads access the critical area in the three different approachs
- The blue line represents the critical area being blocked every time it is entered from any object (Approach 1)
- The red line represents the critical area being blocked only by writers and readers have the preference to enter it (Approach 2)
- The yelllow line represents the critical area being blocked only by writers and they have the preference to enter it (Approach 3)
