Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

"How to avoid deadlocks in Java"

I'm curious, this is not something I've needed to know, but what would be Java specific to an answer?

If I was asked about deadlocks, I would say "always acquire resources in the same order".



> If I was asked about deadlocks, I would say "always acquire resources in the same order".

I don't think that's the correct solution, unfortunately - see e.g. the dining philosophers problem.

Edit: or rather, you have to be very careful what the "order" of resources is.


It was a Java job. They said that it didn't matter that I do Python most of the time, and as I say threading isn't something that has come up since university for me.

I imagine it would take half a day or reading to remember it again.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: