-
Notifications
You must be signed in to change notification settings - Fork 0
/
reflection.txt
27 lines (22 loc) · 1.22 KB
/
reflection.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
When building this system, it was important to keep in mind that there were
a lot of concurrent process accessing the same objects. To resolve this
locks on data had to be implemented every time a write was called to an
object.
Monitors
The monitors in this system are all the shared data types, i.e. the Locks
and sections. They are the only objects that can call waits and notifies.
This allows the object to have self contained logic defining when it is
safe to change state.
Additionally I added external security checks to check twice if the state
change is valid. This is because it is easy to forget certain cases that
you may not have considered. For example if we implement an additional
entry point to the lock, the lock will refuse the state change because it
has built in logic.
Threads
The threads are set on constant listeners, looping through until a trigger
is met. Once the trigger is met, if the method requires a write, it waits
for the requested resource to become available.
Some things I don't like about my design
1. When you put the thread on wait, it literally stops the thread so you have
to set a listener for when the value changes. It would be better if the
notify method could notify a particular wait.