[Company Logo Image]    

Home Feedback Contents Search

4.2 Compiling
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.2 Methods of Compiler Implementation

FIG. 1A: First option of implementing compilation of a stress-flow atom and of a call to it

Two methods can be used by a compiler to implement stress-flow. The first method is shown on FIG. 1A. The stress-flow atom code is translated into a sequence of instructions, with “mark for release” command being called on the atom’s lock at the boundary of the stressed and relaxed sections. The originating call to the atom is translated into four step process – reserving the atom’s lock, scheduling to run the atom as separate process, optionally waiting for lock being marked, and releasing the lock.

 

FIG. 1B: Second option of implementing compilation of a stress-flow atom and of a call to it

The second method is shown on FIG. 1B. The stress-flow atom is translated into two separately callable chunks – the “stressed” part of the atom and “relaxed” part of the atom. The originating call to the atom in this method is translated into reserving the atom’s lock, calling or in-lining the stressed part of the atom, releasing the lock, and scheduling the relaxed part of the atom to run separately. The second method may appear simpler and more efficient, but is far harder to implement. The problem lies in the fact that the whole functionality of the stress-flow requires the relaxed section being able to access both parameters passed to the stressed section and local variables declared in it. To accomplish that in the second method, the stacks must be switched or copied around and this is what makes the first method easier to implement at least in the situation where special new compiler is not written from the scratch. This problem is even more pronounced in actual multi-processor implementation of stress-flow where there actually are a large number of processors, instead of just one or two. In such a situation, the newly called stress-flow atom should be run on a separate processor. The second method always amounts to running the stressed section in the same processor/thread as the calling routine. If most of resources accessed by the stressed section are closer to the target processor (which is the outcome of good object-oriented code), running the stressed section on the calling processor would make absolutely no sense performance-wise. Furthermore, when all code is written according to spirit of stress-flow and the calling routine needed no values returned from the stress atom, the calling routine would not even have to wait for the scheduled stress atom to begin executing if the first method of implementation was used. A calling routine would only be stalled if it wanted to call an already scheduled stress-flow atom again. This would provide a performance boost especially in multi-processor/distributed systems using stress-flow and communicating through a slower medium such as network cables. However, allowing this particular optimization would require the compiler to be able to detect and warn about data accesses incompatible with this optimization method.

 For all these reasons, as the methods are logically interchangeable, choice of the method 1 or 2 is only the matter of performance optimization for specific target hardware. To the user, it absolutely makes no difference which compilation method was used as they both produce the same functional outcome. Both methods can be used and in fact were used to implement and test stress-flow on currently available microprocessors. It is however possible to develop special hardware which would implement all necessary synchronization steps of stress-flow by means of special instructions.

The stress-flow atom lock is a special critical section that allows just one execution thread to reserve it. If a stress flow atom is already reserved, an attempt to reserve it suspends the caller and places its identifier in a queue so that it can be restored when the moment the previous user releases the lock. Scheduling process of a stress atom simply means marking the atom for execution as soon as possible.

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