Topic: APLX Help : Multi-tasking support : Using 'delta' properties to share data
[ Previous | Next | Contents | Index | APL Home ]

Using 'delta' properties to share data between tasks

Any property name which starts with the delta character can be used to store your own data in an object. Subject to available memory, you can have as many such properties as you like, and you can store any simple or nested array, or overlay, in each property.

This feature works in a special way for child task objects. A delta property for the System object of a child task is the same as the delta property of the same name in the parent task's child task object. Thus the parent task can assign arbitrary data to a delta property, and the child task can access it through its own System object. If the child task writes to a delta property of its System object, the parent can see the data which has been assigned in the child task object.

For example:

      Task1←'⎕' ⎕NEW 'APL' 
      Task1.wssize←200000 ⋄ Task1.background←1
      Task1.Execute "'⎕' ⎕WI '∆MESSAGE' 'OK'"

This technique can be used in a number of ways. When starting a task, it can be used to pass an overlay containing all the functions and variables which the child task will need to run. When the task is running, delta properties can be used to share state information, parameters and results between the parent and the child.

The delta property persists for as long as the child task object exists in the parent task. This means that a child task can write to a delta property, and then terminate. The data will still be available to the parent.

Special considerations for Client-Server versions of APLX

If you are running a Client-Server implementation of APLX, your APL tasks may not all be running on the same machine. However, you can still use delta properties to share data between them. The actual data is held (in memory) on the Client machine, and will be sent over the network to/from the APL task as required. All of this is transparent - you do not need to do anything special for this to work.

The only issue to be aware of is that delta variables (like other ⎕WI properties) are always held in 32-bit format. Data written from a 64-bit task will be converted to 32-bit form. This means that delta variables cannot be bigger than 2GB, and must not have more than 2147483647 elements. If an integer array contains numbers whose magnitude is bigger than 2*31, the array will be converted to floating-point form. Precision may be lost for integers whose magnitude is greater than 2*53.

Topic: APLX Help : Multi-tasking support : Using 'delta' properties to share data
[ Previous | Next | Contents | Index | APL Home ]