omron — Executing/Switching Modules

About This Application The following figure illustrates how IWS executes a generic thread (such as the Viewer ). Executing a Generic Thread Where: • Signal 1 is the Period time period (set to 50ms for this example). • Signal 2 shows when the thread is active for the operating system. • Signal 3 is the TimeSlice time period (set to 30ms for this example). • Signal 4 shows the execution of the thread itself. In this example, IWS generates a Period message every 50ms (signal 1 ). When IWS generates this message, its thread becomes active and remains active until the specified TimeSlice time period (from IWS) expires.

The thread then remains inactive until IWS generates the next Period message (signal 1 ). While the thread is active, the operating system is responsible for executing that thread. However, just because a thread is active does not mean the operating system will execute it immediately — the operating system may be executing other threads, for example. When the operating system executes the thread, the TimeSlice timer starts counting and the thread is executed for 20ms (TimeSlice from the operating system). After the 20ms period, the operating system automatically switches to the next active thread (such as the Driver), and so on.

In the above example, the TimeSlice time was set to 30ms, which means the operating system is not supposed to execute the thread more than once in each TimeSlice of IWS. However, if you specify higher values for the IWS TimeSlice time period, it is likely that the operating system will execute the same thread more than once in the same TimeSlice time period. In the next example, the Period and the TimeSlice values were changed as follows, but the default operating system TimeSlice period (20 ms) was not changed. Setting a Higher TimeSlice Where: • Signal 1 is the Period time period (set to 100ms). • Signal 2 shows when the thread is active for the operating system.

• Signal 3 is the IWS TimeSlice time period (set to 80ms). • Signal 4 shows the execution of the thread itself. Notice that the thread can be executed more than once in the same TimeSlice time period. When the IWS TimeSlice time period expires, the operating system interrupts the thread execution; however, even though the IWS Period and TimeSlice parameters are set to 100ms and 80ms respectively, the operating system InduSoft Web Studio Page 23