If two threads try to access the synchronized method at the VERY exact same time with exact milli-second or (whatever minimum CPU unit is).. What will happen? How JVM/System will resolve this issue if they have same priority as well. Will it create deadlock? Also, where this information about locks is stored?
That's the whole point of threading. The operating system's job scheduler will allow one to go before the other. No deadlock will occur.
Actually, the job scheduler is for heavyweight forking of processes. The JVM handles which Threads have a turn to execute or enter a synchronized block.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With