21.01.2015 Views

INtime® 3.1 Software - tenAsys

INtime® 3.1 Software - tenAsys

INtime® 3.1 Software - tenAsys

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

INtime <strong>3.1</strong> <strong>Software</strong><br />

If a distinct thread drives each client, an efficient transaction system requires that<br />

threads share access to database data. When threads run concurrently, this situation<br />

ocasionally arises:<br />

Figure 4-6. Multithreading and mutual exclusion<br />

B<br />

<br />

<br />

A<br />

Thread A, the running thread, reads data from the database and performs computations based<br />

on the data.<br />

Thread B tries to preempt thread A and update the data while thread A works on it. Mutual<br />

exclusion, provided by a region, prevents two threads from accessing the same data concurrently.<br />

Unless thread B is prevented from modifying the data until after thread A has finished,<br />

thread A may unknowingly use some old data and some new data, resulting in an<br />

invalid computation. It should, however, read and compute the new data after thread B<br />

updates it.<br />

Memory pools and memory sharing<br />

Memory pools are the basis of INtime software’s memory management. Two types of<br />

memory pools exist:<br />

• Initial memory pool: All the memory available to the RT kernel (that is, free space<br />

memory). Managed by the RT kernel, the initial memory pool belongs to the root<br />

process and is allocated to INtime applications on request. Any amount of memory<br />

you allocate to the RT kernel is not available to Windows for that session. There is<br />

a practical maximum for the amount of memory allocated to INtime software. This<br />

value depends on the number and size of INtime applications that run on the<br />

RT kernel.<br />

• Process memory pools: A portion of the initial memory pool assigned to an INtime<br />

application process when that process is created. Each process memory pool has a<br />

minimum and a maximum size. Once the minimum memory is allocated to a<br />

process, that memory is not available to other processes. When you delete a<br />

process, its memory returns to the initial memory pool.<br />

As threads in a process create and delete objects, the process memory pool’s size<br />

increases and decreases as needed, provided minimum and maximum values<br />

are not yet encountered. This provides dynamic memory allocation of the<br />

memory pool.<br />

48

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!