Возможно, стоит пояснить разницу между синхронизацией из thread/process-safe и синхронизацией с помощью Lock🤔
Наша задача — заставить разные процессы и потоки обращаться к базе данных (или любым другим ресурсам) последовательно. Чтобы не случилось так называемого race condition, то есть состояние гонки. Это когда разные потоки или процессы пытаются одновременно что-то сделать с одним и тем же ресурсом.
В этом случае нам нужна какая-то логика ограничения. Пока один процесс не завершил своё действие, другие не могут получить доступ к ресурсу.
Так вот, thread-safe и process-safe означает что отдельно взятые операции записи в БД гарантированно будут последовательны. Запросы из разных процессов или потоков выстроятся в очередь и не будут мешать друг другу. Лучше всего когда этот блок реализован на уровне БД в виде атомарных операций или ещё как-то.
Но зачем нам тогда еще дополнительный Lock?
Этот способ синхронизации используется когда процесс никак не укладывается в одно действие и должен сделать множество операций прежде чем дать доступ следующему. В этом случае процесс ставит некий глобальный Lock на ресурс и никто другой, даже получив законное право на доступ, не может ничего сделать. Все ждут пока этот Lock не будет снят.
Это решается на уровне приложения и правильность реализации полностью в вашей ответственности. Например, если забыли разблокировать или сделали перекрёстный Lock (Deadlock как на картинке), то всё зависнет в бесконечном ожидании.
#basic
⚡️PRO THUNDER V12: THE ELITE TRADING STANDARD⚡️
Stop settling for repainting tools and local scripts. Pro Thunder V12 is the culmination of 5 years of development by SS7Trader Ltd.
Why the pros choose V12:
🚫100% Non-Repaint: Signals are fixed. What you see is what you get.
🧠Neural Network AI: Powered by advanced AI to filter market noise.
✅Registered Authority: Built by a verified company, not an anonymous team.
⏳5-Year Legacy: Continuous evolution and optimization since 2021.
🎯 Pure Simplicity: Clear Buy/Sell signals with a fixed 5-minute expiry.
🌍 Universal: Works on any broker, any chart, and any timeframe.
━━━━━━━━━━━━━━━━
🚀 JOIN THE ELITE. STOP GUESSING.
🔗https://ss7trader.com/product/pro-thunder-v12/
✈️ Contact: https://t.me/SSsevenTrader
#SS7Trader#ProThunderV12#TradingAI#NonRepaint#BinaryOptions
⚡️PRO THUNDER V12: THE ELITE TRADING STANDARD⚡️
Stop settling for repainting tools and local scripts. Pro Thunder V12 is the culmination of 5 years of development by SS7Trader Ltd.
Why the pros choose V12:
🚫100% Non-Repaint: Signals are fixed. What you see is what you get.
🧠Neural Network AI: Powered by advanced AI to filter market noise.
✅Registered Authority: Built by a verified company, not an anonymous team.
⏳5-Year Legacy: Continuous evolution and optimization since 2021.
🎯 Pure Simplicity: Clear Buy/Sell signals with a fixed 5-minute expiry.
🌍 Universal: Works on any broker, any chart, and any timeframe.
━━━━━━━━━━━━━━━━
🚀 JOIN THE ELITE. STOP GUESSING.
🔗https://ss7trader.com/product/pro-thunder-v12/
✈️ Contact: https://t.me/SSsevenTrader
#SS7Trader#ProThunderV12#TradingAI#NonRepaint#BinaryOptions
⚡️PRO THUNDER V12: THE ELITE TRADING STANDARD⚡️
Stop settling for repainting tools and local scripts. Pro Thunder V12 is the culmination of 5 years of development by SS7Trader Ltd.
Why the pros choose V12:
🚫100% Non-Repaint: Signals are fixed. What you see is what you get.
🧠Neural Network AI: Powered by advanced AI to filter market noise.
✅Registered Authority: Built by a verified company, not an anonymous team.
⏳5-Year Legacy: Continuous evolution and optimization since 2021.
🎯 Pure Simplicity: Clear Buy/Sell signals with a fixed 5-minute expiry.
🌍 Universal: Works on any broker, any chart, and any timeframe.
━━━━━━━━━━━━━━━━
🚀 JOIN THE ELITE. STOP GUESSING.
🔗https://ss7trader.com/product/pro-thunder-v12/
✈️ Contact: https://t.me/SSsevenTrader
#SS7Trader#ProThunderV12#TradingAI#NonRepaint#BinaryOptions
⚡️PRO THUNDER V12: THE ELITE TRADING STANDARD⚡️
Stop settling for repainting tools and local scripts. Pro Thunder V12 is the culmination of 5 years of development by SS7Trader Ltd.
Why the pros choose V12:
🚫100% Non-Repaint: Signals are fixed. What you see is what you get.
🧠Neural Network AI: Powered by advanced AI to filter market noise.
✅Registered Authority: Built by a verified company, not an anonymous team.
⏳5-Year Legacy: Continuous evolution and optimization since 2021.
🎯 Pure Simplicity: Clear Buy/Sell signals with a fixed 5-minute expiry.
🌍 Universal: Works on any broker, any chart, and any timeframe.
━━━━━━━━━━━━━━━━
🚀 JOIN THE ELITE. STOP GUESSING.
🔗https://ss7trader.com/product/pro-thunder-v12/
✈️ Contact: https://t.me/SSsevenTrader
#SS7Trader#ProThunderV12#TradingAI#NonRepaint#BinaryOptions