Lets deal with question a bit differently.
Suppose in a house there are 5 members. Grand father , Father , Mother , Elder Brother(B) , Youngest Sister(S). There is only one tv in the house.
Now the rule in the house is : 1)If any younger family member is watching tv and an elder member joins then elder member will watch tv and younger had to leave.
2)If elder member is watching tv and any younger member joins , then younger member will keep waiting till older member is watching tv.
3)Every member watches tv only once(this we have taken because an older process will keep its execution continue till the end as it will kill all the younger process in the meantime to get resources.This means older process will stop only after complete execution)
4) Only younger members can join the family in future like if a new member joins after S then it needs to be younger ( This rule is applied because process with younger time stamps will join . Process with older timestamps are already present. Whatever new process comes it will have a younger timestamp)
Deadlock: will there be deadlock?
No
Explanation: If mother is watching tv and B joins then B will wait .Suppose B is already waiting and S also joins in then she will also wait.
Now mother was about to leave and B was happy that he will get the chance but in the meantime Father joins in.
So as per the rule: As mother left , father is the eldest so he gets the chance to watch tv and B and S keeps on waiting.
But but but
Father was watching and grandfather joins so father gives the remote to grand father and waits for his chance.
Eventually grandfather leaves then father watches tv then he leaves then son watches and then sister.
So there can never be a deadlock.
PS : There was chance of deadlock if elder member comes back to watch tv even after watching it one time but this will not happen as per our rules
Starvation: Will it happen?
No
Explanation: It's clear now that if older member joins the younger members will wait for there chance and they will get it eventually. What if more younger members join ?
Suppose B is watching tv and S is waiting and one more member joins who is younger, say Q .
If this happens still there is no problem because Q is younger and younger members keep waiting till elder members finish watching tv .
So no deadlock and no starvation