Can the PV450 / PV750 "Multi-thread"?

This forum contains common answers to questions and tutorials produced for the community.
jpurdum
Enovation Controls Development
Enovation Controls Development
Posts: 153
Joined: Mon Jun 21, 2010 11:19 am

Can the PV450 / PV750 "Multi-thread"?

Post by jpurdum » Wed Aug 04, 2010 5:21 am

From a customer question: Can the PV450 / PV750 "Multi-thread" ?
jpurdum
Enovation Controls Development
Enovation Controls Development
Posts: 153
Joined: Mon Jun 21, 2010 11:19 am

Re: Can the PV450 / PV750 "Multi-thread"?

Post by jpurdum » Wed Aug 04, 2010 5:29 am

Answer:

Yes – all the processes running in the system are multi-process / multi-threaded. At the configuration level, the state machines all run in “parallel” (see my definition of Multi-thread below). So, if two state machines cause modification to the same variable, then you should program the state machines with that in mind. For instance, avoid two state machines trying to write to the same variable on a single event. Synchronize your state machines so that they write and read at different times. Reading is not an issue, but two or more machines writing at the same time or one writing and others trying to read at the same time could produce indeterminate results.

If you are using the Software Development Kit (SDK) and running under QNX, QNX is a full operating system with both multi-process and multi-threading capability.

Multi-thread: the ability to run more than one software program or more specifically, more than one "thread" of software in pseudo-parallel. True parallel processing requires multiple CPUs - but almost every modern software application has multi-processing or multi-thread capability. In multi-threading, each "thread" of code gets either a certain amount of time to run, or may be allowed to run until it's finished with a current task. A thread that is done or has used its time allotment is interrupted by the operating system, which then selects another thread to run for its share of CPU time. From a human's standpoint, this usually happens in such a way that it appears that the multiple threads of software are running in parallel. When programming for multi-thread applications, the software developer assumes not only that the software threads are running in parallel, but that a particular thread may get interrupted at any time. This can affect shared resources such as a variable - if both threads can modify a variable, then they have to be written with that in mind.