Consider two major abstractions of the operating
system that describe the
execution of the program code - processes and flows - features of their
implementation in the operating system, the states in which they may
reside, basic mechanisms for working with them (means of creation,
completion, and termination, etc.).
Basic concepts of processes and flows
Processes and flows in modern OS
In today's operating system, the kernel code (which belongs to its various
subsystems) and the code of the user programs are executed at the same
time. There are different actions: some programs and subsystems follow the
instructions of the processor. Others are busy with I / O, some still wait for
requests from the user or other applications. To simplify the management of
these actions in the system, it is advisable to allocate a set of elementary
active elements and to define the interface of OS interaction with these
elements.
The
process means the abstraction of the OS, which combines everything
necessary to execute one program at a certain point in time. The program is
some sequence of machine
commands stored on disk, and if necessary, is
loaded into memory and executed. It can be said that at run time, the
program represents a process.
A one-to-one correspondence between a program and a process is
established only at a specific point in time: one process at a time can
execute the code of several programs, the code of one program can execute
several processes at the same time.
Successful programs require some resources. They include:
❖
Resources required for sequential
execution of program code
(primarily CPU time)
❖
Resources that allow storing information that ensures the execution
of the program code (CPU registers, RAM, etc.); these resource
groups identify two components of the process
❖
The sequence of executable commands of the processor
❖
Set addresses memory ' memory (
address space ), which are these
commands
and data for them
The selection of these parts is also justified by the fact that within the same
address space may be several sequentially executed sequences of
commands that share the same data. The need to distinguish between the
sequence of commands and the address space leads to the concept of flow .
A thread (control thread) is called a set of sequentially executed processor
commands that use the shared process space. Since there can be many
threads at a time, the OS's task is to organize the switching of the processor
between them and to plan their execution. In multiprocessor systems, the
code for individual threads can be executed on separate processors.
Thus, the
process is called the set of one or more threads and the protected
address space in which these threads are executed.
The security of the
process address space is its most important characteristic. The process code
and data cannot be directly read or overwritten by another process; thus
protecting themselves from the rich bugs and unauthorized access
attempts. Naturally, only
direct access is inadmissible (for example, writing
to memory using a simple data transfer instruction); the exchange of data
between
processes is, in principle, possible, but for this purpose special
means, which are called means of
interprocess interaction, should be used
.
Such tools are more difficult than direct access and run slower, but provide
protection against accidental errors when accessing data.
Unlike the process
flows managing total memory, stream data is not secured
against access to other streams provided that they are all executed in the
address space of the same process. This provides additional application
development capabilities but complicates programming .
The protected alert process space sets the abstraction of code execution on a
single machine, and the thread provides an abstraction of sequential
command execution on a single dedicated processor. The address space of
the process does not always correspond to RAM addresses. For example, it
may display files or registers of the I / O controllers, so writing to a specific
address in this space will either write to a file or perform an I / O
operation.
This technology is called the reflection in memory
( memory mapping ).