[Autogenerated] We know that threads, are independent paths of execution.
And normally they don't need to Know about one another.
For example,
if I have a thread running with the Notepad doesn't need to Know
about the thread running with an explorer.
And They don't need to communicate in any particular way.
Definitely don't need to synchronize anything.
However, this is not always the case,
sometimes you do need to synchronize threads because for example,
they might be accessing some shared data So suppose they have
something like a linked list being managing some process.
And I have multiple threads running within that process,
that are doing various things However, from time,
to time they need to access these linked list,
perhaps by adding or removing items.
So if this is happening at the same time,
all ____ will break loose because any time you access a link list,
it's not an atomic operation.
You have to manipulate, let's say four pointers, and things could get messy.
And what?
That is referred to as a database a database is officially
defined as having two or more threads,
accessing the same memory location where at least one of them is writing.
So let's focus on that for a moment.
If we have multiple threads accessing different
memory locations at the same time, that's never a problem.
Another thing, is that If all the threats,
are accessing the same location, but they're only reading.
That's not a problem either when there's at least one thread,
writing, that that is changing the data,
then We have a database on our hands.
And When a data raise occurs all bets, are off,
anything can happen, you can _____, you can corrupt data Essentially,
if you look at the co oc plus plus standards,
they do say something like undefined,
behavior which means essentially anything can happen.
And this is true in cases of data races.
So obviously, we'd like to prevent data races.
Otherwise things will go wrong.
And the way to do that in general, is by synchronizing threads.
So one thread or multiple threads might be waiting on some condition.
To occur while another thread, is for example, accessing the shared data.
This is the classic synchronization.
But there are other types of synchronization,
which we also discuss and Obviously,
we're focusing on Windows in the these core So we look at
various kernel primitives or kernel objects,
that are provided for this particular purpose of synchronization.
In fact, we've seen some of these examples already.
But in the this module, we will be a bit,
more explicit as to Why we need to synchronize threats,
and how we can do that