[Autogenerated] By now, you should be convinced.
That data races, are not a Good idea.
And we want to avoid them.
And Of course, the question, is How so the first way,
we can avoid certain types of data races,
is by using a certain set of instructions or
functions called interlocked something.
They start with the word interlock, and then have some other suffixes,
and So the idea here,
is that these set of functions can perform certain simple operations
on numbers of 124 an eight bytes in size in a way,
that is thread, safe, and multiprocessor safe,
essentially atomic, atomic means,
that Anyone looking at these memory locations being manipulated.
Can only see what was there before the change or after the change.
But never anything in between and the point of these instructions,
they are always performed by the hardware.
So they utilize the power of the processor.
To perform these things in a multiprocessor,
andre safe way without us having to provide any software related solution.
Technically, these are not real functions, but are known as compiler intrinsics.
They translate to a particular instruction or instructions,
to the processor instead of us having to know exactly
which processor we're dealing with,
we use the functions themselves or these intrinsics,
and the appropriate compiler being invoked,
is going to translate that into the correct instructions.
To provide to the processor.
So here, are examples of these kinds of functions inter increment.
For instance, does the plus plus in a thread,
and multiprocessor, safe way, same, go for inter inter decrement,
inter, ad exchange, and there, are more variants,
and all these variants, also are available,
4 32 64 68 bits, the default ones, the ones,
that don't have any number attached, to them work on 32-bit entities,
but you have something like inter increment,
64 inter increment, 60 an inter increment,
eight in order to work with these other data sizes,
and So if you can solve your potential database using these functions,
these are always best to use.
That's because they have the best possible performance as
they are performed by the hardware,
the C P U itself rather than doing something on the software side,
which will have to do later on for other more complex cases.
Let's see the result of that When we apply that
to the Previous example of a database