aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2016-05-06add initial cocci instrumentation demoHEADmasterLuis R. Rodriguez3-0/+224
This doesn't yet fix anything, but adds enough basics to show what is intended. Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>
2016-05-06add pthread_mutex_protects_3() -- semantic helperLuis R. Rodriguez1-0/+6
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>
2016-05-06try to fix eatingLuis R. Rodriguez1-0/+2
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>
2016-05-06change rulesLuis R. Rodriguez1-8/+39
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>
2016-05-06remove mutex locksLuis R. Rodriguez1-2/+0
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>
2016-05-06add initial demo pthread partyLuis R. Rodriguez6-0/+424
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>