When multiple thread try to acquire the lock on synchronized when lock is already acquired by one thread. My understanding was that lock will be given in order of acquire lock request.
But as per the book O'Reilly Java threads lock will be given that is best for platform. Thats very abstract statement.I think platform mainly meant OS here. My question what is the criteria based on which JVM decides what is best for platform and how developer accounts it while doing programming?
Update:- i know i can use Lock object with fairness argument. But just want to know how does it work with synchronized locks?