uz
Feedback
JusticeTech System

JusticeTech System

Kanalga Telegram’da o‘tish

Learn to learn before you teach

Ko'proq ko'rsatish
Mamlakat belgilanmaganToif belgilanmagan
227
Obunachilar
Ma'lumot yo'q24 soatlar
-17 kun
+230 kun
Postlar arxiv
I will touch one more point and show you how to prevent this as programmer or developer depending on the field you fall into and i am done on this topic

So base on the program this can happen: Program A: Read ₦10,000 Program B: Read ₦10,000 Program A: Calculate ₦3,000 Program B: Calculate ₦3,000 Program A: Write ₦3,000 Program B: Write ₦3,000 Final balance: ₦3,000 But two withdrawals happened. That's wrong.

The above operation looks like one operation, but internally it can be thought of as: 1. Read balance 2. Calculate balance - 7000 3. Write the new balance

Now imagine two programs are running this at the same time, let's call them: Program A Program B Both want to withdraw ₦7,000. The operation will be like this balance = balance - 7000

Now Let's See Programming Imagine this Python program: balance = 10000 balance = balance - 7000 That's simple right? Follow me

I am going to dive deep now with programming so follow me gently

Now let's continue from here https://t.me/justicetechsystem/2163

1. Locks A lock is basically a mechanism that says "Someone is currently using this resource. Please wait." 2. Mutex A mutex is a specific type of locking mechanism. Mutex = Mutual Exclusion Don't let the name scare you. It basically means "Only ONE participant can enter this protected area at a time." 3. Semaphores A semaphore is different. A semaphore can allow more than one participant into a resource. 4. Synchronization Synchronization is the big umbrella concept. It means coordinating multiple things so they work together correctly. NB: Locks can provide synchronization. Mutexes can provide synchronization. Semaphores can provide synchronization. Barriers, condition variables, message queues, etc. can also help with synchronization. Synchronization doesn't necessarily mean "Only one thing can run." It means that "Make sure multiple things interact in the correct way." That's a very important distinction. 5. Atomic Operations This one is particularly important. Atomic basically means "It happens as one indivisible operation from the perspective of other threads."

Imagine a school has one computer that 10 students want to use now if everyone tries to use it simultaneously it will lead to chaos So we need rules for who can access what, when, and how. That's where locks, mutexes, semaphores, synchronization, and atomic operations come in.

Programming has similar mechanisms. They're called things like: Locks Mutexes Semaphores Synchronization Atomic operations I will not want to touch any of these but let me try

Let's proceed

So the JusticeTech System teams came together to create a simple solution which is Only one person can use the bathroom at a time. Lol

Imagine your house has one bathroom and you and your friend want to enter without any set rule: Person A >> checks bathroom Person B >> checks bathroom Person A >> enters Person B >> enters That's obviously a problem already right?

Let me further break this down with an example

For example, Bank balance Database record File Variable Memory Counter Inventory User account The thing is who gets there first can change the result.

They're touching the same thing.........

There are three important words in our definition which are Multiple operations More than one thing is happening. Shared resource What do you notice?

Let me break this down into pieces

What is a RACE CONDITION A race condition occurs when multiple operations access shared data at the same time, and the result depends on the order in which those operations happen. Remember this and keep it

Let's go