[Company Logo Image]    

Home Feedback Contents Search

4.12 Last-Only
4.1 Structure 4.2 Compiling 4.3 Example 4.4 Socket 4.5 OOP 4.6 Competing 4.7 Optimization 4.8 Connector 4.9 Merging 4.10 Emulation 4.11 Ordered Calls 4.12 Last-Only 4.13 Group Inputs 4.14 Complex Sys. 4.15 Prior Art... 4.16 Redundant SW 4.17 Visual SW 

Back Home Up Next

4.12 Last-Only Stress-Flow Calls

Often we are interested in just most recent information, or a most recent set of data. Consider a program that redraws complex shape in response to mouse movements. There is not enough time and it would not make sense to redraw the shape every one pixel movement of the mouse, especially if the computer has its resources used up by something more important. On the other hand, sampling it arbitrarily, say every predetermined amount of time, will limit responsiveness. Similar issue exists in instrumentation and signal processing application. Our FIG. 12 example most likely would be a candidate for something like that as well. Suppose the output device is much slower compared to the input. In such a case, if lots of data was fed into the system, a queue of values to output would build up and it would grow, which would mean that after a while, we would be outputting extremely old data while building up backlog of new data waiting at stress atom locks. Even if such a problem could not usually occur by guaranteeing proper speed characteristics of inputs and outputs, it is a good practice to make sure in software that something like that cannot happen. In the particular case of instrumentation signal processing application, letting the most recent data through ASAP is generally much more desirable than trying to process and output all data samples. In particular, if the output is for human eyes, the last value is all that is desired.

 

struct calc_inst

{  detach  void dsqrt (type s)  { return; !?result(sqrt(s));   };

   collect void add_a (type aa)

                add_b (type bb) { return; !?dsqrt(aa+bb);      };

   detach  void sq1   (type a)  { return; !?add_a(a*a);        };          

   detach  void sq2   (type b)  { return; !?add_b(b*b);        };       

   detach  void go    (type a,type b)

                                { return; !?sq1(a); !?sq2(b);  };

} aa;

//---

aa.go(10,12);  // example of invocation

FIG. 17: Code from FIG. 13 using last-only stress flow atoms

Suppose we were to modify the “ordered” stress-flow atom mechanisms in a way that would discard all older scheduled requests to a specific stress-flow atom the moment the completed (not just reserved) newer call has arrived. This is very easy to accomplish, and pretty much the only thing to do is create a new definition designator for such type of an atom. As before, rather that reserve another keyword, we can just use the question mark instead of the exclamation mark in the listing of atoms to be called in ordered fashion. See FIG. 17.  From now on, this new type of stress-flow atom call will be referred to as “last-only” call. 

Back Home Up Next
Send mail to info@stressflow.com with questions or comments.
Copyright © 2005-2010. All Rights Reserved. Patents Pending in Multiple Jurisdictions.
First published 03/29/06. Last modified: 06/25/10