appeared the first classic issues. The program with
interrupt handling facility can be considered in such
a way, that two processes are started at the begin-
ning. The main program (the ”core process”) works
as usual, the other process (the interrupt service rou-
tine) is blocked until the triggering signal from the
interrupting device appears. Following that the sig-
nal arrives, the interrupt servicing process takes over
(gets unblocked) and runs until it terminates. After
that, the control returns to the core process, exactly
to the place and state, where and how the interrupt
occurred.
The two processes need to solve their joint task
together, i.e. they need to communicate (to some de-
gree) with each other. This can be realized through
making changes in the state of their shared resources,
typically making changes in the memory. Since both
of these processes use the same resources, special
care must be taken to avoid changes exceeding this
intended communication. This means, that both the
hardware and the interrupt servicing process must
save and properly restore the temporary changes they
caused, in order to make unnoticeable for the core
process when the control is returned to the main pro-
cess after servicing the interrupt, that an interrupt oc-
curred.
The operating principle of the computer assures
only that the single machine instructions are com-
pleted, but in case of operations requiring more than
one machine instructions special care must be taken
to make sure that the execution of a closely related
group of instructions will not be interrupted. In case
of the interrupt service routine the hardware assures
that the control is not returned to the core process
until the servicing process terminates. This means,
that making non-atomic operations within the inter-
rupt control routine needs no special care or action.
On the opposite, in the core task one has to protect
atomic operations (for example, in an easy but not el-
egant way) through disabling/enabling interrupts. No-
tice the asymmetry of the roles of the two tasks.
2.2 The Problem of Communication
In multitasking operating systems there are several
”core” processes and all those processes can be inter-
rupted by the scheduling clock, so resources shared by
two (or more) such processes can be safely used only
through accepting a kind of agreement between tasks,
since (in contrast with the case in previous section)
there is no hardware support for protecting atomic
operations. Namely, the first process reaching the
state in which it wants to use a resource, for the pe-
riod of executing the so called critical section, mo-
nopolizes its usage. It does so through changing some
area, visible also for other tasks, of the memory, des-
ignating that right now it is using the corresponding
resource. After finishing the critical activity, it makes
the resource free again through resetting the changed
memory location. For the other processes needing the
same resource, the resource will only be available af-
ter the first process makes the resource free again,
even if the scheduler would run some other process
meanwhile.
Of course, this mechanism is viable only if both
processes keep the agreement (they communicate
with each other before they begin the action), i.e. be-
fore using the resource, the process checks whether
it is available, reserves the resource (changes the re-
spective memory) and uses the resource only if the re-
source is free (otherwise waits for the resource), and
after using it, releases the resource (resets the mem-
ory).
2.3 Communication in Operating
Systems
Implementing this kind of communication of pro-
cesses under an operating system is not really sim-
ple. One of the basic tasks of the operating system
is to protect the processes from each other, including
the memory they use extensively. This also means,
that the changed memory belonging to one task surely
must not even be ”seen” by any other task. If in-
dependent processes want to communicate with each
other, they need the help of a ”reliable third party”.
The obvious available solution is the OS itself,
mainly because the processes of course must be able
to communicate with OS in other businesses as well.
Those processes that need to change (in cooperation
with the OS) the memory content in a region belong-
ing to the OS, and of course in cooperation with the
OS they can also have information on the content of
that memory. Technically it means that before and
after every single usage of the semaphores the pro-
cesses must contact the OS, changing operation mode
and passing parameters there and back. This hap-
pens using software interrupts, which means complete
context switching there and back, and means execut-
ing up to hundreds of machine instructions (according
to (Bryant and O’Hallaron, 2014), the complete con-
text switching might take up to 20,000 clock cycles!).
The so called multitasking operating systems use this
kind of synchronization extensively (sometimes even
recursively (C. A. Thekkath and H. M. Levy, 1994)),
which means a considerable administrative load for
the processor, especially if the implemented payload
functionality is as simple as in case of handling a bi-
AnAlternativeImplementationforAcceleratingSomeFunctionsofOperatingSystem
495