|
theLink 10.0
|
HOWTO configure and use a thread in the Programming-Language-Micro-Kernel (PLMK).
A thread in Programming-Language-Micro-Kernel (PLMK) is very simple:
In PLMK a server-instance always runs in an isolated environment, which means it doesn't matter whether a new process or a separate thread is used.
!on remote host! !on local host!
server1---------x x----------server2
| | | |
| child-context-1 child-context-2 |
| | | | server
parent-context-1-----x x-----parent-context-2
| |
(MqConfigS::server) (example: MqConfigS::server --fork --uds … --file …)
| |
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| |
(--tcp) (--pipe, --uds, --tcp)
| |
parent-context-1-----x x-----parent-context-2
| | | | client
| child-context-1 child-context-2 |
| | | |
x------------x--------client-------x-------------x
!on local host!
A thread in Programming-Language-Micro-Kernel (PLMK) is created via pIoStartServer, whereby all types of instances (pipe, spawn, fork, thread, etc.) can be created in the function.
MqSysServerThread using the value of MqLalS::MqSysServerThreadCB.sSysServerThread : The primary memory for a multi-threaded application is the thread-local-storage.
The initial implementation of the Programming-Language-Micro-Kernel (PLMK) thread was without thread-pool.
The biggest difference between a single pthread-thread and an already used thread-pool-thread is:
The biggest difference between a single-threaded application (process) and a multi-threaded application is:
The biggest difference between a multi-thread-once and a multi-thread-pool application is:
A weak reference is a reference that is controlled by Target-Programming-Language (TPL), and a strong reference is a reference that is controlled by Programming-Language-Micro-Kernel (PLMK).
The difference lies in the lifetime of the object:
With the switch to thread pool in C# and Java, the reference-technology was also switched from strong to weak because there is always a memory problem in a multi-threaded application and a language like C# and Java is better equipped with the sophisticated garbage-collection than Programming-Language-Micro-Kernel (PLMK).