11. Given:
Which of the following pairs of method invocations could NEVER be executing at the same time?
(Choose all that apply.)
A. x.a() in thread1, and x.a() in thread2
B. x.a() in thread1, and x.b() in thread2
C. x.a() in thread1, and y.a() in thread2
D. x.a() in thread1, and y.b() in thread2
E. x.b() in thread1, and x.a() in thread2
F. x.b() in thread1, and x.b() in thread2
G. x.b() in thread1, and y.a() in thread2
H. x.b() in thread1, and y.b() in thread2
Answer:
✓ A, F, and H. A is a right answer because when synchronized instance methods are called
on the same instance, they block each other. F and H can't happen because synchronized
static methods in the same class block each other, regardless of which instance was used
to call the methods. (An instance is not required to call static methods; only the class.)
X C could happen because synchronized instance methods called on different instances
do not block each other. B, D, E, and G could all happen because instance methods and
static methods lock on different objects, and do not block each other. (Objective 4.3)
Não entendi o porquê de acessos simultâneos bloquearem um ao outro, através do que estudei, quando isso
acontecia elas deveriam fazer fila conforme liberação do lock.
Talvez tenha entendido erro, alguém pode me ajudar ?
Obrigado !