int main (int
argc, char ** argv, char
** envp) { Initialization
initialization; // synchronize iostream with stdio
ios::sync_with_stdio(); // Initialize program
application.init(argc, argv, envp); // this while{} would allow for re-initialization // WITH restarting the threads. while (true) { // Initialize threads
initialization.run(); // if REINITIALIZE, we could remain in this while{}, // completely restarting the threads and all init()
routines. if (application.InitializationState_ == TERMINATE) { return 0; } // end if (application... } // end while (true... } |
Example Assuming Eight (8)
Threads:
|
Global Data |
|||||||
|
Global Pool |
|||||||
|
Action Queue |
Action Queue |
Action Queue |
Action Queue |
Action Queue |
Action Queue |
Action Queue |
Action Queue |
|
Thread, Global |
Thread, Global |
Thread, Global |
Thread, Global |
Thread, Global |
Thread, Global |
Thread, Global |
Thread, Global |
|
|
|||||||
|
Each Thread waits on
the Action Queue for instructions. As all eight (8) threads then proceed with
their portion of the Global Data to process, they then wait on the Synchronizer
in the Global Pool (or many other locations) for the other threads and at least
one, but perhaps many more times as desired. You can then write to another
Action Queue for another set of threads to continually process your workflow, or even accross a Socket to another Cluster.
And, the Global Pool (or many other locations) provides a Read/Write Lock for thread-safe
multi-threaded variable modifications. |
|||||||
|
|
|||||||
|
All eight (8) Threads
can act together or they could be split at any time into smaller groupings (or
Pools), with one thread per group being the Leader. Multiple ‘Global Data’ (managed
by a Queue) can be created to continually fill with information while working
on any one at any given time. All Global Objects are placed permanently on the Heap
(Shared Memory) during Initialization while all Copy Queues and Threads are
placed in (or copied to) Stack Memory for greater speed. All memory is locked
down local (as available) to any CPU for greater speed. And as this library is obviously optimized
specifically too for speed, time is measure in nanoseconds. |
|||||||
|
|
|||||||
|
Note that this library
is being used by the United States Department of Defense for the National Missile Defense program
towards stopping Global Thermal Nuclear War. |
|||||||
Email: Dennis Kennedy