Возможно, стоит пояснить разницу между синхронизацией из thread/process-safe и синхронизацией с помощью Lock🤔
Наша задача — заставить разные процессы и потоки обращаться к базе данных (или любым другим ресурсам) последовательно. Чтобы не случилось так называемого race condition, то есть состояние гонки. Это когда разные потоки или процессы пытаются одновременно что-то сделать с одним и тем же ресурсом.
В этом случае нам нужна какая-то логика ограничения. Пока один процесс не завершил своё действие, другие не могут получить доступ к ресурсу.
Так вот, thread-safe и process-safe означает что отдельно взятые операции записи в БД гарантированно будут последовательны. Запросы из разных процессов или потоков выстроятся в очередь и не будут мешать друг другу. Лучше всего когда этот блок реализован на уровне БД в виде атомарных операций или ещё как-то.
Но зачем нам тогда еще дополнительный Lock?
Этот способ синхронизации используется когда процесс никак не укладывается в одно действие и должен сделать множество операций прежде чем дать доступ следующему. В этом случае процесс ставит некий глобальный Lock на ресурс и никто другой, даже получив законное право на доступ, не может ничего сделать. Все ждут пока этот Lock не будет снят.
Это решается на уровне приложения и правильность реализации полностью в вашей ответственности. Например, если забыли разблокировать или сделали перекрёстный Lock (Deadlock как на картинке), то всё зависнет в бесконечном ожидании.
#basic
🔥NEW RELEASE🔥
😁Half Guard by Nicholas Meregali😁
➡️Master the Half-Guard with 4 hours of step-by-step instruction designed to give you real control and understanding of this essential position. Learn to dominate in three key stages, Legs, Hips, and Shoulders, using each to solve specific problems and create clear, strategic progress.
➡️We start with the core concept of Camping, teaching you how to stabilize your position, manage pressure, and control posture through precise body placement over your opponent’s shields, hips, and frames, making your base extremely hard to off-balance.
$197😍$19.99😍
❗️Channel Info and FAQ (MUST CHECK BEFORE BUY)❗️
📱Payment: 📱📱📱
💰Submeta FOR FREE
🌈UFC Picks
👑MasterClass
✈️@bjjfanaticsinstructionals
#NicholasMeregali#NewWave#Gi#HalfGuard
💁♀️Buy
💁♀️
🔥NEW RELEASE🔥
😁Top Half Guard By Neil Melanson😁
➡️Unlock a powerful, high-pressure top game with Top Half Guard by legendary coach Neil Melanson. As a master of catch wrestling and MMA grappling, Neil’s unique approach to half guard will completely transform the way you dominate from top position.
➡️Whether you're new to half guard or looking to refine your existing skills, this series gives you the tools to overwhelm your opponent, control the position, and finish the fight with devastating submissions
➡️Learn from one of the most innovative grappling minds in the sport and elevate your game to new heights.
$127😍$11.99😍
❗️Channel Info and FAQ (MUST CHECK BEFORE BUY)❗️
📱Payment: 📱📱📱
💰Submeta FOR FREE
🌈UFC Picks
👑MasterClass
✈️@bjjfanaticsinstructionals
#NeilMelanson#BJJFanatics#HalfGuard
💁♀️Buy
💁♀️
😁Precision Attacks and Sweeps From Butterfly Half and Knee Shield by Shawn Melanson😁
➡️Shawn Melanson returns with his fifth installment for BJJ Fanatics, and this time he’s pulling back the curtain on the sneaky, frustrating, and relentlessly effective guard system that’s been quietly dismantling opponents at every level.
➡️Melanson's method breaks away from flashy tricks and focuses on the real structure behind guard retention, off-balancing, and transitioning from defense to decisive offense
̶$̶7̶9̶😍$9.99😍
❗️Channel Info and FAQ (MUST CHECK BEFORE BUY)❗️
📱Payment: 📱📱📱
💰Submeta FOR FREE
🌈UFC Picks
👑MasterClass
✈️@bjjfanaticsinstructionals
#ShawnMelanson#HalfGuard#NoGi#Butterfly
💁♀️Buy
💁♀️