Age | Commit message (Collapse) | Author | Files | Lines |
|
This doesn't yet fix anything, but adds enough basics
to show what is intended.
Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>
|
|
This will be our helper for making modifications of code.
It hints as to what data items a mutex protects. It
does not hing at run time code for production and in-tree.
Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>
|
|
If we place the lock when eating we try to ensure everyone
takes food, but the state machine is all messed up still.
The trash is still not being dealt with at all.
This is still broken, we need a way to ensure so that
the mutex is held also for the trash, likewise for the
accounting which provides the simple state machine.
Run 1:
Before party:
FOOD: [ ******************************* ]
TRASH: [ ]
After party:
FOOD: [ ****************************** ]
TRASH: [ ******************************* ]
Run 2:
Before party:
FOOD: [ ******************************* ]
TRASH: [ ]
After party:
FOOD: [ * ***************************** ]
TRASH: [ ******************************* ]
Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>
|
|
Life is complex:
0. We invite more people.
1. People invited to the party can arrive different
times. In our case its up to some random time and
the scheduler.
2. People invited are shy, they will only eat if
people that are confirmed to be there are also
eating. If we don't eat we have no trash to
throw away.
3. People take random amount of time to eat food.
4. People invited are weak minded, if someone did not
throw away their trash they follow and become
messy and also do not throw away their own trash.
Now results can vary, here's some examples, but pretty
much it should be clear how buggy this is.
Run 1:
Before party:
FOOD: [ ******************************* ]
TRASH: [ ]
After party:
FOOD: [ * ***************************** ]
TRASH: [ ******************************* ]
Run 2:
Before party:
FOOD: [ ******************************* ]
TRASH: [ ]
After party:
FOOD: [ ****************************** ]
TRASH: [ ******************************* ]
Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>
|
|
Everything is still in order though, this is because
everyone is following orders:
Before party:
FOOD: [ *********** ]
TRASH: [ ]
After party:
FOOD: [ ]
TRASH: [ *********** ]
Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>
|
|
Everything in order here. Party results:
Before party:
FOOD: [ *********** ]
TRASH: [ ]
After party:
FOOD: [ ]
TRASH: [ *********** ]
Everyone ate in order and then placed their trash accordingly.
Locking is in place so this is expected.
Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>
|