????? ??? 3?? ?? ?? ?????!
- 1???? ???? ???? ?? ???????.
- 2???? ???? ??????.
?? ????? ??????? Deadlock? ????? ???????. ??, ??? ??? ???? ??? ?? ???? ?? ??? ? ?? ?? ? ?? ??? ?????. ??????? ?? ?? ?? ?? ???? ???? ???? ???? ???? ??? ????.
???? ??? ?? ??
?? ??? ???? ? ??? ??? ?? ??? ?? ??? ?? ?? ????? ???? ????.
? ??? ?? ??? ????? ???? ?? ??? ? ?? ??? ? ?? ?? ??? ?????. ? ??????? ????? ?? ????? ?? ? ??? ?? ??? ?? ??? ?? ???? ?? ? ??? ??? ? ?? ?? ??? ??? ?? ??? ??? ?????.
? ?? ??? ???(?: ??)? ???(?? ??)? ????? ?? ???? ??? ??? ????? ?? ?? ??? ? ?? ?????? ???? ?? ??? ?????. ??????? ??? ??? ?? ??? ????? ?? ???? ?? ??? ??? ???? ??? ?? ??? ???? ?? ???? ??? ? ???? ??? ??? ???? ???.
1. ????? ?????
?? ??? ???(?? ????)? ??? ???? ?? ???? ??? ???? ???? ?????. ? ????? ?? ???? ??? ? ?? ??? ? ?? ??? ???? ?????. ??, ?? ? ?? ??? ???? ?? ?? ??? ??? ???? ?? ??????.
2. ????? ??
?? ??? ????? Coffman ???? ??? ? ?? ??? ??? ????? ???.
?? ??: ??? ??? ???? ?? ??? ??? ????? ???. ?, ? ?? ??? ???? ??? ? ????.
?? ? ??: ???? ??? ???? ???? ?? ???? ???? ?? ???? ??? ??? ???? ???.
?? ??: ????? ???? ??? ??? ? ????. ????? ????? ???.
?? ??: ?? ??? ??? ???? ? ???? ??? ?? ???? ??? ???? ?? ?? ?????.
??? ??????? ????
? ???????
- ??? A? ??? 1? ???? ??? 2? ?????
- ??? B? ??? 2? ???? ??? 1? ???? ??
??? ??? ?? ??? 4?? ??? ?? ????? ??? ??? ?????. ? ? ???? ?? ????? ??? ? ????.
3. ???? ??/????
?? ??? ????????? ?? ??? ???? ?? ??? ? ????. ??? ?? ?? ??? ?? ??? ???? ? ??? ? ? ????
- ??: Java? JConsole, VisualVM ? IDE? ??? ???? ????? ?? ??? ??? ? ????.
- ??? ?? ? ??: ??? ??? ???? ?? ?? ???? ?? ???? ???? ?? ???? ??? ? ????.
?? ?? ???/???? ??? ???? ??? ??? VisualVM ? jstack? ???? ?? ?? ??? ? ????? ?????.
4. ???? ?? ??
Wait-Die ? Wound-Wait ?? ??
Wait-Die Scheme: ???? ?? ???? ??? ??? ???? ??????? ????? ? ???? ?????? ???? ??? ????? ?????. ?? ???? ????? ? ??? ?????. ??? ??? ?????(?? ??).
Wound-Wait ??: ?? ???? ????? ? ?? ?? ??? ??? ???? ????? ?? ???? Wound(??)???.?? ??? ?? ?? ??
????? ?? ??? ???? ??????. ?? ??? ??? ? ???? ?? ???? ??? ???? ????. ?? ?? ??? ??? ??? ??????.?? ??? ?? ?? ??? ?? tryLock ??: ?? ??? ??? ?? ReentrantLock? ???? tryLock(timeout, ??)? ???? ??? ?? ?? ?? ??? ??? ? ????. ?? ?? ?? ??? ???? ??? ???? ???? ??? ??? ?????.
ReentrantLock lock1 = new ReentrantLock(); ReentrantLock lock2 = new ReentrantLock(); public void acquireLocks() { try { if (lock1.tryLock(100, TimeUnit.MILLISECONDS)) { try { if (lock2.tryLock(100, TimeUnit.MILLISECONDS)) { // Critical section } } finally { lock2.unlock(); } } } catch (InterruptedException e) { Thread.currentThread().interrupt(); } finally { lock1.unlock(); } }
- ?? ?? ? ?? ?? ??? ?? ??? ?? ??? ?????. ?? ???? ??? ??? ??? ???? ?? ???? ??? ???? ??? ?? ??? ?????. ?? ??, ????? ???? ?? lock2?? ?? lock1? ?????. ? ??? ??? ????????? ??? ? ??? ?? ?? ??? ??? ?? ?? ??????.
import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; public class LockOrderingExample { private static final Lock lock1 = new ReentrantLock(); private static final Lock lock2 = new ReentrantLock(); public static void main(String[] args) { Thread thread1 = new Thread(() -> { acquireLocksInOrder(lock1, lock2); }); Thread thread2 = new Thread(() -> { acquireLocksInOrder(lock1, lock2); }); thread1.start(); thread2.start(); } private static void acquireLocksInOrder(Lock firstLock, Lock secondLock) { try { firstLock.lock(); System.out.println(Thread.currentThread().getName() + " acquired lock1"); secondLock.lock(); System.out.println(Thread.currentThread().getName() + " acquired lock2"); // Perform some operations } finally { secondLock.unlock(); System.out.println(Thread.currentThread().getName() + " released lock2"); firstLock.unlock(); System.out.println(Thread.currentThread().getName() + " released lock1"); } } }
??? ??/?? ??? ??: Java? java.util.concurrent ???? ????? ???? ???? ?? ??? ??(ConcurrentHashMap, CopyOnWriteArrayList ?)? ??? ?? ??? ?????. ???? ??? ?????. ??? ???? ?? ????? ?? ??? ???? ???? ??? ???? ??? ??????? ?? ??? ??????.
??? ?? ??
?? ???? ????? ??? ?? ??? ?? ?? ??? ??????. ??? ??? ??? ?? ??? ?? ??? ?????
????? ????? ?? ?? ??
- ??? ??? ???? ?? ??? ?? ??? ??? ???? ????.
- ?? ??? ???? ?? ??? ???? ?? ???? ?? ?????. ? ????? ?? ????? ??? ???? ???? ?? ??? ?? ????? ??? ? ??? ??? ??? ??? ?? ????.
- ?? ??? ?? ????? ??? ???? ??? ?? ?? ?? ??? ?? ??? ?? ?????.
- ?? ??? ?? ?? ? ?? ??? ?? ???? ??? ? ????. ?, ??? ?? ?? ??? ????? ???? ?????. (?, ?????? ? ?? ??? ????.)
- ??? ???? ?? ?? ??? ???? ????. ?? ????? ???? ???? ??? ?????? ?? ????? ?? ?????. ???? ?????? ???? ??? ?? ????? ??? ??? ???? ?? ??? ???? ?? ?????.
????
????? ??? ????? ?? ????? ???? ???? ??? ????? ?? ??? ???? ?? ?????. ?? ???? ????? ????, ? ??? ????? ??? ? ?? ???? ??? ???????. ???? ??? ?? ??? ????, ?? ???? ????, ??? ?? ? ?? ?? ?? ??? ?? ??? ?????? ???? ?? ?? ??? ????? ??? ???? ?? ??? ???? ? ????.
?????? ?? ??? ???? ????? ? ???? ?? ??? ?? ??? ??? ????. ?? ??? ?? ??? ???? ?? ????? ?? ???? ???? ???? ??? ?????. ?? ???? ?? ??? ?? ??? ? ?? ??? ??? ??? ? ?? ???? ??? ??? ?? ??? ??? ???? ??? ????.
? ??? ?? ??????? ?????? ???? ????? ??? ?? ??? ??? ?? ? ?? ???? ?? ? ????. ? ?? ??? ??? ?????? ????? ????? ??? ??? ?? ?????!
????
- ???????
- ?????
- ?? ??? ???? ???? ??
? ??? ????? ?? ?? ?? ??? ?? ?????. ??? ??? PHP ??? ????? ?? ?? ??? ?????!

? AI ??

Undress AI Tool
??? ???? ??

Undresser.AI Undress
???? ?? ??? ??? ?? AI ?? ?

AI Clothes Remover
???? ?? ???? ??? AI ?????.

Clothoff.io
AI ? ???

Video Face Swap
??? ??? AI ?? ?? ??? ???? ?? ???? ??? ?? ????!

?? ??

??? ??

???++7.3.1
???? ?? ?? ?? ???

SublimeText3 ??? ??
??? ??, ???? ?? ????.

???? 13.0.1 ???
??? PHP ?? ?? ??

???? CS6
??? ? ?? ??

SublimeText3 Mac ??
? ??? ?? ?? ?????(SublimeText3)

??? ??











Java? ?? ??? ??? ?? ??? ??? ?? ??? ??? ?? ??? ?? ?? ??? ???? ??? ?? ???? ?????. 1. ??? ???? ??? ?? ?? ? ???? ?? ??? ???? ?? ?? ??? ? ????. 2. ???? ?? ??? ???? ??? ?? ???? ?? ?? ??? ???????. 3. ?? ???? ?? ?? ?? ? ???? ???? ?? NULL ?? ??? ? ????. 4. ?? ???? ??? ?? ?? ? ??? ?????? ?? ??? ??? ?? ?? ??? ????? ??? ??? ??? ??????? ?? ???? ??????.

?? ?? ?? ??? ??? ?? ??? ??, ? ? ?? ? ??? ?????. 1. ??? ?? ???? ?? ???? ???-????, ? ??? ??? ??? ? ????, Hashmap? ???-??? ?? ??? ??? ???? ????. 2. NULL ? ?? ???? HashMap? ??? NULL ?? ?? ? ?? ???? ?? HashTable? NULL ?? ?? ???? ??? NullPointerException? ?????. 3. ????? ??? ????? ?? ??? ?? ?? ? ????? HashTable? ? ??? ?? ?? ??? ????. ?? ConcurrenTashMap? ???? ?? ????.

JIT ????? ??? ???, ??? ?? ? ???, ?? ?? ? ???? ? ? ?? ?? ??? ? ?? ??? ?? ??? ??????. 1. ??? ???? ?? ?? ??? ??? ?? ?? ???? ??? ?? ?????. 2. ??? ?? ? ??? ?? ?? ? ??? ???? ?? ?? ???; 3. ?? ??? ??? ?? ??? ???? ???? ???? ? ?? ?? ??? ?????. 4. ?? ??? ?? ??? ??? ???? ???? ?? ? ??? ???? ?? ??? ?????.

staticmethodsininterfaceswereIntRectionSelffacesswithinteffaceswithinteffaceswithintintinjava8toallowutilityFunctionswithinterfaceitswithinteffaceswithinterfaceffaces

???? ??? ??? Java?? ??? ?? ???? ??? ?? ? ? ??? ??? ???? ? ?????. ?? ???? ??? ??, ??? ?? ??? ?? ?? ??? ??? ????? ???? ????? ?????. ?? ??? ??? ??, ????? ? ??? ????, ?? ??? ??? ?????? ? ?? ? ?? ?????.

injava, thefinalkeywordpreventsavariable'svalue'svalueffrombeingchangedafterassignment, butitsbehaviordiffersforprimitivesandobjectreences.forprimitivevariables, asinfinalintmax_speed = 100; wherereassoncesanerror.forobjectref

??? ? ?? ??? ???? : ????? ?? ?. 1. int? ???? ???? ?? ?? ?? ? ??? ???? ?????. 2. ?? ? ???? (int) myDouble ??? ?? ?? ??? ?????. ?? ??? ??? ?? ??? ?? ??, ?? ?? ?? ???? ?? ??? ?? ???? ?? ?????. ???? ? ??? ??? ????. ?? ??? ??? ??? ??? ??? ?? ??? ??? ? ??? ?? ???? ??? ??? ??? ??? ? ??? ?? ??? ?? ??? ?? ?? ? ? ????. ?? ?? ??? ?? ??? ??? ??? ??? ? ??????.

??? ??? ?? ?? ??? ????? ? ???? ????? ???? ?? ???? ?? ???? ?????. ?? ??? ??? ????. ?? ?? ?? ??? ???? ???? ?? ?? ??? ??? ?? ?? ??? ??? ?????. ?? ??? ??? ????. ?? ??? ?? ??? ?? ?? ??? ?? ?? ??? ???? NewClass ()? ??? ?? ???? ????. ?? ??? ?? ??? ???? ?? ??? ?? ? ? ??? ?? ?? ??? ????? ????? ?????. ?? ??, ?? ?????? ?????, ??? ? ?? ????? ??? ?? ?????. ???? ?? ?? ??? ???? ?? ???? ?? ? ??? ???? ?? ??? ?? ?????? ?????. ???? ???? ??? ??, ?? ?? ? ?? ??? ????, ?? ?? ???? ?????.
