I was creating a thread for a philosopher. Here is the pseudocode:
while(true)
think
get left chopstick
get right chopstick
eat
putdown left chopstick
putdown right chopstick
Intuitive, i don't think the order of relieving the chopstick will matter. So instad of putting down the left chopstick first, can i put the right chopstick down first? will this cause any error? I doubt it will. If this causes a deadlock, how? if not, but left first is recommended, then why?
Thank you!