*2.3.3. Device buffers, temporal acceleration and multi-threading*

px distance from these two points (5 px, because a selection inside the disc—the minimum length being 5 px—would represent the selection of the device and not of the connection, and another 15 px to compensate with the unselectable area around the device, as previously mentioned). By being 'somewhere' between points *A* and *B*, it is understood that the angles

Proceedings of the International Conference on Interdisciplinary Studies (ICIS 2016) - Interdisciplinarity and Creativity

It can be easily proved that ∢AeB must be obtuse, by using the cosine theorem and the restrictions given by the problem. In a similar fashion, it can be proved that ∢AeB is obtuse,

In order to calculate the distance *h* between *e* and the segment *[AB]*, by only knowing the

. .1 | . . 1| . .1

Math. surface e, A, B <= PointDistance Abs( ( )) (A, B \*5 ) (3)

where the surface method is defined by the Sarrus formula for the calculation of 3 × 3 deter‐ minants. Note that the division from the formula was not done in the code because when working with int-type variables (integer numbers), there are some precision issues in the event

*AX AY BX BY eX eY*

*AB* <sup>=</sup>

coordinates of the *A,e,B* points, with simple surface formulae, it can be obtained that

2 22 *AB Ae eB* > + (1)

(2)

∢*eAB* and ∢*eBA* must be acute angles (see Figure 4).

if and only if

in the Knowledge Society

62

**Figure 4.** If ∢*eAB* is obtuse, then clearly the selection was outside of the [*AB*] segment.

*h*

Thus, we obtain the following selection management algorithm:

which gives the following evaluation statement:

of division with remainder.

Each device has a series of buffers, which, during one second of the simulator, receive data packages coming from the directly connected devices. These data packages are processed at the end of the said second. These buffers, although existent even in real devices, have had their processing time increased from possibly several milliseconds to one full second, in order to allow a more clear observation of the changes that occur in the routing tables. As a consequence, although in reality, the routing tables of the routers of a mediocre size network reach converge in several milliseconds, here the convergence is slower. This duration can be modified quite quickly because all this temporal discussion really depends just on the interpretation of the trigger duration of an internal time counter. In the HypeRSimRIP program, it has already implemented a facility of time acceleration so that a second in reality can mean that only one second in the simulator has passed (the convergence being slow) or can be up to 30 sec in the simulator. This limit can be increased even higher, but keeping in mind the fact that we can simulate multiple accelerated devices on a single computer, the ratio 1:30 is to be considered as already large enough.

In terms of programming, these buffers are a series of list of objects that have a clear creation timestamp. These objects can be of the following types:


At the end of each second, after the data packages transmissions, the simulator's second pass function will call the second pass function of every device, every time on another thread (hence multi-threading programming).

The second pass function of every device starts by processing every above-mentioned object, depending on their respective creation timestamp, as follows:

	- **•** If the creation time is from a future point than the current time, the object will be ignored, and the user will be announced about this exception. Again, similar to the first exception, it has failed to occur yet.

Because each device processes its buffers on another thread, the main program will not wait for it to finish processing, as well all the other devices will not wait for each other. Thus, the execution order is non-deterministic, as in real life.

For didactical purposes, for a clearer observation of the simulation, the multi-threading facility can be disabled from the Settings windows of the program (see Figure 5).
