is used when decisions about switching the flow context are made in
the system kernel code and not in the flow code.
❖
Distinguish between long-term,
middle-term and short-term
planning. The most important here is a short-term scheduler, which is
used to decide which flow to run at a given time. Basic short-term
scheduling algorithms include circular and priority planning.
Let's consider the basic principles of interaction of flows of one
process. The focus will be on synchronizing access to the shared data of
such streams.
Basic Principles Of Flow Interaction
Threads that are executed in a parallel process
can be independent or
interact with each other. A stream is independent if it does not affect the
execution of other process threads, does not detect the impact on their part,
and has no data in common with them. Its implementation is clearly
dependent on the input data and is called deterministic.
All other threads are interacting. These threads have data shared with other
threads (they are in the address space of their process). Their
implementation depends not only on the input data but also on the
execution
of other threads, ie they
are non-deterministic (let us consider
further examples of such non-deterministic).
Independent thread execution results can always be repeated, which is not
the case with interacting threads. Data
Worms are common to several
streams, called shared data. This is the most important concept of multi-
threaded programming. Any stream can change this data at any
time. Mechanisms for ensuring correct access to shared data are called flow
synchronization mechanisms.
Working with independent streams is easier than interacting with threads. A
programmer may disregard the fact that others are running concurrently
with such threads, and ignore the state of the shared data that the thread is
working with.
However, there are several reasons why
you cannot implement thread
interaction.
❖
It is necessary to organize the sharing of information when working
with streams. For example, database or web server users may want to
request the same information at one time, and the system must ensure
that it is received concurrently by the threads that serve those users
❖
Proper implementation of this interaction and the use of appropriate
algorithms can significantly speed up the computing process on
multiprocessor systems. This task is divided into subtasks that
perform simultaneously
on different processors, and the results are
collected together for the final solution liabilities. This technology is
called
parallel computing technology
❖
In tasks requiring concurrent execution of I / O calculations, I / O
threads should be able to signal to other threads with the completion
of their operations
❖
Such an organization makes it possible to divide tasks into separate
executable modules, designed as separate threads, which, at the same
time, the output of one module can be an input for another, and also
increases
the flexibility of the system, since individual modules can be
changed without tapping others
The need for concurrent execution of interacting streams requires
mechanisms for exchanging data between them and ensuring that they are
synchronized.