Возможно, стоит пояснить разницу между синхронизацией из thread/process-safe и синхронизацией с помощью Lock🤔
Наша задача — заставить разные процессы и потоки обращаться к базе данных (или любым другим ресурсам) последовательно. Чтобы не случилось так называемого race condition, то есть состояние гонки. Это когда разные потоки или процессы пытаются одновременно что-то сделать с одним и тем же ресурсом.
В этом случае нам нужна какая-то логика ограничения. Пока один процесс не завершил своё действие, другие не могут получить доступ к ресурсу.
Так вот, thread-safe и process-safe означает что отдельно взятые операции записи в БД гарантированно будут последовательны. Запросы из разных процессов или потоков выстроятся в очередь и не будут мешать друг другу. Лучше всего когда этот блок реализован на уровне БД в виде атомарных операций или ещё как-то.
Но зачем нам тогда еще дополнительный Lock?
Этот способ синхронизации используется когда процесс никак не укладывается в одно действие и должен сделать множество операций прежде чем дать доступ следующему. В этом случае процесс ставит некий глобальный Lock на ресурс и никто другой, даже получив законное право на доступ, не может ничего сделать. Все ждут пока этот Lock не будет снят.
Это решается на уровне приложения и правильность реализации полностью в вашей ответственности. Например, если забыли разблокировать или сделали перекрёстный Lock (Deadlock как на картинке), то всё зависнет в бесконечном ожидании.
#basic
➡️New build available for Xiaomi Redmi 9 Prime / Poco M2 (lava)
👤 by Sakthivel Nadar
ℹ️ Version: 13
📆 Build date: November 14, 2022 05:22
📂 File size: 1.62 GB
⬇️ Download now
#lava#pixelexperience
🪐 The exoplanet 55 Cancri e, orbiting a star about 41 light-years away in the constellation Cancer, is known for its fiery dayside, reaching temperatures above 2,400°C—hot enough to melt metal. This rocky world is likely covered by a massive ocean of molten lava, and some scientists think its carbon-rich composition could even mean parts of the planet’s interior are made of diamond. ✨
#exoplanets⚡#extremes⚡#lava⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space
👉subscribe Universe Mysteries
🪐 Far from Earth, the exoplanet COROT-7b endures some of the most extreme conditions known: it orbits its star so closely that its surface reaches about 2,000°C, hot enough to melt rock. Scientists believe this heat turns the planet’s rocky crust into a vast, bubbling “lava ocean,” creating a world where rock vaporizes into the atmosphere and rains down as pebbles. ✨
#exoplanet⚡#extremes⚡#lava⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space
👉subscribe Universe Mysteries
Lava in Spain's La Palma engulfs more houses
Lava engulfed more buildings on the Spanish island of La Palma, destroying everything in its path about three weeks after the volcano began to erupt
#News#Reuters#LaPalma#Spain#Lava
Subscribe: http://smarturl.it/reuterssubscribe
Reuters brings you the latest business, finance and breaking news video from around the globe. Our reputation for accuracy and impartiality is unparalleled.
Get the latest news on: http://reuters.com/
Follow Reuters on Facebook: https://www.facebook.com/Reuters
Follow Reuters on Twitter: https://twitter.com/Reuters
Follow Reuters on Instagram: https://www.instagram.com/reuters/?hl=en
➖@reutersworldchannel➖
Spain's volcano is still erupting, no end in sight
There's no end in sight to the volcanic eruption that has caused chaos and destruction on the Canary island of La Palma since it began about a month ago
#News#Reuters#LaPalma#Spain#Lava#Volcano
Subscribe: http://smarturl.it/reuterssubscribe
Reuters brings you the latest business, finance and breaking news video from around the globe. Our reputation for accuracy and impartiality is unparalleled.
Get the latest news on: http://reuters.com/
Follow Reuters on Facebook: https://www.facebook.com/Reuters
Follow Reuters on Twitter: https://twitter.com/Reuters
Follow Reuters on Instagram: https://www.instagram.com/reuters/?hl=en
➖@reutersworldchannel➖
LIVE: Building-sized lava blocks fall from volcano on Spain's island La Palma
Blocks of molten lava as large as three-story buildings rolled down a hillside on the Spanish island of La Palma on Sunday while a series of tremors shook the ground three weeks after the volcano erupted.
#News#Reuters#Live#volcano#lava#LaPalma#Spain
Subscribe: http://smarturl.it/reuterssubscribe
Reuters brings you the latest business, finance and breaking news video from around the globe. Our reputation for accuracy and impartiality is unparalleled.
Get the latest news on: http://reuters.com/
Follow Reuters on Facebook: https://www.facebook.com/Reuters
Follow Reuters on Twitter: https://twitter.com/Reuters
Follow Reuters on Instagram: https://www.instagram.com/reuters/?hl=en
➖@reutersworldchannel➖
LIVE: Lava spreads on Spain's La Palma with no end in sight to volcanic eruption
Flows of molten rock pour from the Cumbre Vieja volcano — in its fourth week of eruption — threatening to engulf another area on the Spanish island of La Palma.
#News#Reuters#Live#volcano#lava#LaPalma#Spain#environment
Subscribe: http://smarturl.it/reuterssubscribe
Reuters brings you the latest business, finance and breaking news video from around the globe. Our reputation for accuracy and impartiality is unparalleled.
Get the latest news on: http://reuters.com/
Follow Reuters on Facebook: https://www.facebook.com/Reuters
Follow Reuters on Twitter: https://twitter.com/Reuters
Follow Reuters on Instagram: https://www.instagram.com/reuters/?hl=en
➖@reutersworldchannel➖
LIVE: Drone captures view of La Palma's Cumbre Vieja volcano
Drone footage shows the impact of the Cumbre Vieja volcano on La Palma, Spain.
#News#Reuters#Live#volcano#lava#LaPalma#Spain#environment
Subscribe: http://smarturl.it/reuterssubscribe
Reuters brings you the latest business, finance and breaking news video from around the globe. Our reputation for accuracy and impartiality is unparalleled.
Get the latest news on: http://reuters.com/
Follow Reuters on Facebook: https://www.facebook.com/Reuters
Follow Reuters on Twitter: https://twitter.com/Reuters
Follow Reuters on Instagram: https://www.instagram.com/reuters/?hl=en
➖@reutersworldchannel➖
Lava spews from La Palma volcano
The Cumbre Vieja volcano on Spain's La Palma island continues to spew lava and smoke.
#Volcano#LaPalma#Spain#Lava#CanaryIslands#CumbreVieja#News#Reuters
Subscribe: http://smarturl.it/reuterssubscribe
Reuters brings you the latest business, finance and breaking news video from around the globe. Our reputation for accuracy and impartiality is unparalleled.
Get the latest news on: http://reuters.com/
Follow Reuters on Facebook: https://www.facebook.com/Reuters
Follow Reuters on Twitter: https://twitter.com/Reuters
Follow Reuters on Instagram: https://www.instagram.com/reuters/?hl=en
➖@reutersworldchannel➖