Current Page:
NeXtMidas Training
Getting Started - Part 2
Threads in NeXtMidas
Threads vs Processes
|
|
- Threads vs Processes
- Threads
- Wikipedia Definition: "Threads are a way for a program to split
itself into two or more simultaneously (or pseudo-simultaneously) running tasks."
- Interaction between threads in an application is comparatively easy.
- Processes
- Wikipedia Definition: "A process is a running instance of a
program, including all variables and other state."
- Interaction between different processes is comparatively difficult.
- Threads and Processes in NeXtMidas
- An easy way to remember the difference: "A thread is like a worker
in a company, and a process is like a company. Workers in a company can perform separate
tasks simultaneously, yet they can easily share resources. Different companies
can perform separate tasks; however, if two companies want to share resources, it
is a lot more difficult.
- With NeXtMidas there is a single process, the Java Virtual Machine (JVM) which is
running the shell.
- The JVM is started by running
nm
- NeXtMidas has the option of using multiple threads to allow it to do multiple
tasks simultaneously (all of which run inside a single JVM).
- Threads in NeXtMidas can easily interact with one another and share resources.
X-Midas Users Take Note: |
In general, everything in X-Midas runs in a single thread per process. When X-Midas wants to
perform multiple tasks simultaneously, it starts a new processes for each task.
This is why it is comparatively difficult for X-Midas to share resources between
different primitives and necessitates the use of "shared memory sections" and
Inter-Process Communication (IPC).
|
|
|
|