12.18.2011

I hate mutual exclusion

Ok, fuck it, I can't this done because is theoretically and practically impossible. The system will ALWAYS result in a deadlock because in this degree of freedom will lead the tasker to lock the list mutex first, then the mutex of the executing task (this one would guarantee consistency) while the other threads wanting to edit the task and the list would lock it in different order, thus always resulting in a deadlock. I turned the system dozens of times, went trough around 6 different variations and all lead to deadlock mutual exclusion. It simply won't work. I wanted to it work, that's I tried so many to revive it. I simply hate mutual exclusion. It makes so many things impossible, yet it is the reason why there are standoffs between persons. Without the user-induced repriorization, there wouldn't be a deadlock! So the only way out off this is to either drop priorization in total or move towards the tasker again, giving it another try with more careful thinking.

I'm exhausted right now. This stuff ripped off every motivation of myself to even think about good. Maybe I can find another solution. Maybe I can solve it by keeping two tasks - one for the low priority list which will switched to "do nothing" if the priority changes and another one to insert when a higher priority is necessary. All in all there no way to re-priorize a single task without creating a deadlock. I'm through with it and a lot more experienced now. I learned my lesson but I still won't be able to easily detect such complicated deadlock situations without figuring out the whole system. It's somehow embarassing. Simple facts seem not to lead to instant success in this area. However, I bet noone working on stuff like that will always create a new approach but rely on existing ones that ran through the sweat and blood of many hard-working programmers. So I shouldn't blame myself but accept the fact that multithreading brings a exponentially higher degree of complexity. I never experienced it before at this degree. Made me feel like exploring World of Goo for the first time, again - physics games are beyond my perception of fun.

No comments: