Возможно, стоит пояснить разницу между синхронизацией из thread/process-safe и синхронизацией с помощью Lock🤔
Наша задача — заставить разные процессы и потоки обращаться к базе данных (или любым другим ресурсам) последовательно. Чтобы не случилось так называемого race condition, то есть состояние гонки. Это когда разные потоки или процессы пытаются одновременно что-то сделать с одним и тем же ресурсом.
В этом случае нам нужна какая-то логика ограничения. Пока один процесс не завершил своё действие, другие не могут получить доступ к ресурсу.
Так вот, thread-safe и process-safe означает что отдельно взятые операции записи в БД гарантированно будут последовательны. Запросы из разных процессов или потоков выстроятся в очередь и не будут мешать друг другу. Лучше всего когда этот блок реализован на уровне БД в виде атомарных операций или ещё как-то.
Но зачем нам тогда еще дополнительный Lock?
Этот способ синхронизации используется когда процесс никак не укладывается в одно действие и должен сделать множество операций прежде чем дать доступ следующему. В этом случае процесс ставит некий глобальный Lock на ресурс и никто другой, даже получив законное право на доступ, не может ничего сделать. Все ждут пока этот Lock не будет снят.
Это решается на уровне приложения и правильность реализации полностью в вашей ответственности. Например, если забыли разблокировать или сделали перекрёстный Lock (Deadlock как на картинке), то всё зависнет в бесконечном ожидании.
#basic
🇲🇿#Mozambique: IS-Mozambique (ISMP, Islamic State in Mozambique) released a video today claiming responsibility for an attack last Sunday targeting Mozambican military bases in the Katuba and Namapo areas of Cabo Delgado in the northern part of the country.
As a result of the attacks, it is reported that nine Mozambican soldiers were killed. The militants also posted footage showing weapon caches and equipment they captured from the bases.
(via @BrantPhilip_ on X)
⚡️Russia's EMERCOM:
On March 19, a special flight of Russia's EMERCOM delivered humanitarian aid to the Republic of #Mozambique.
By decision of Russia's President Vladimir Putin, following instructions from the Government of Russia and on the orders of EMERCOM Head Alexander Kurenkov, around 29 tonnes of humanitarian cargo were transported from Moscow.
🛬 An Il-76 aircraft delivered food, essential supplies, as well as tents and blankets for flood-affected communities in the African republic.
#RussiaHelps
The struggle for water in Mozambique's unstable north
Aid agencies warn that a shortage of safe water, poor sanitation and inadequate medical services are a looming threat for the communities in Mozambique's Cabo Delgado province
#News#Reuters#Mozambique#RedCross
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➖
#RussiaHelps
💬Maria Zakharova: OnDecember 17 inMaputo (#Mozambique) and December 18 inLusaka (#Zambia), official ceremonies marking the delivery of Russian food assistance were held, attended by the Russian Ambassadors to these countries.
🇲🇿 Mozambique received 70 tonnes of vitamin-fortified sunflower oil for those in need.
🇿🇲 Zambia received a similar shipment of 93 tonnes, as well as 648 tonnes of yellow split peas.
These humanitarian deliveries were carried out through the UN World Food Programme, funded by Russia’s voluntary contribution for African countries, which amounts to USD 10 million annually.
Humanitarian assistance is an integral part of Russia’s support for its partners on the African continent, primarily aimed at helping the most vulnerable groups.
🇷🇺 Russia will continue to contribute to addressing Africa’s socio-economic challenges, using both bilateral assistance mechanisms and the potential of relevant international organizations.
(Excerpt from Russian MFA Spokeswoman Maria Zakharova's weekly briefing on December 26)
#Italia y su desarrollo imperialista a cuenta del #gas en #África. Ahora #Mozambique
https://www.eleconomista.es/energia/noticias/12492596/10/23/los-planes-de-italia-para-el-gas-natural-pasan-por-coral-field-un-nuevo-yacimiento-en-mozambique.html
Russia and Mozambique may expand energy cooperation
During a visit to Moscow, Mozambique Foreign Minister Maria Manuela dos Santos Lucas said that the country views Russia as a strategic partner in the development of the oil and gas sector.
For Mozambique, which has the sixth largest natural gas reserves in Africa (about 100 trillion cubic feet), partnership with Russia is indeed of strategic value.
Russian companies offer not only investments, but also unique competencies in the development of offshore fields, construction of gas transportation infrastructure and training of qualified personnel. Today, about 40% of Mozambican students in the Russian Federation are studying in specialties needed in the oil and gas sector.
Despite Rosneft's withdrawal from the Mozambique LNG project in 2022, Russian companies remain interested in the region. In particular, Gazprom continues to explore the possibility of working on the Mozambican shelf.
According to experts, there are several key vectors of cooperation between the parties. This could be the creation of an LNG cluster using Russian technologies, joint projects for gasification of Mozambique regions, as well as the development of educational programs for training personnel.
#AREA#Africa#Russia#RussiaAfrica#energy#Mozambique