Topic: APLX Help : Multi-tasking support : Introduction to APLX multi-tasking
[ Next | Contents | Index | APL Home ]

Introduction to APLX multi-tasking

APLX includes built-in support for multi-tasking. This means that a single instance of the APLX program can simultaneously run multiple APL tasks, each with its own workspace and optionally its own session window. (Technically, APLX runs as a single process, with multiple threads. One thread controls the user-interface, and each APL task has its own thread.)

APLX tasks are of two types, 'top-level' or 'parent' tasks, and 'child' tasks. When APLX starts up, it creates the first top-level task automatically. Further top-level tasks are created using the File menu on the APLX session window, and each has its own session window in which you can enter APL expressions. A top-level task keeps running until one of the following occurs:

  • You type )OFF in the task's session window, or your program executes )OFF
  • You select 'Close Session' from the File menu
  • You close the session window

When a top-level task ends, other top-level tasks are not affected. When all top-level tasks have finished, the APLX program terminates. If you select 'Exit APLX' from the File menu, all tasks terminate.

Child tasks are created under program control using ⎕WI. They can either be background tasks (with no session window), or alternatively they can be ordinary tasks with their own session windows, although these might be hidden. Child tasks may be terminated in the same ways as top-level tasks, but in addition they can be terminated under program control by the parent task. They will also terminate automatically if their parent task terminates. Child tasks can themselves create further child tasks.

Each task has its own separate memory allocation for the workspace, of a size which you can specify. The tasks execute independently, but you can use signals to allow parent and child tasks to communicate with one another. In addition, variables can be shared between tasks. The niladic system function ⎕UL returns the number of APLX tasks which are currently running.

Special considerations for Client-Server versions of APLX

If you are running a Client-Server implementation of APLX, it is possible for your various APLX tasks to run on different machines. This is true both for tasks created using the File menu, and for Child tasks. In the former case, you can specify where the task should be created using the dialog which appears when you select the New Session menu item. In the latter case, you select the Server on which the task should run using the host property of the APL Child Task object.

If you are running APLX64, your APL sessions can comprise a mixture of 32-bit and 64-bit tasks.

Topic: APLX Help : Multi-tasking support : Introduction to APLX multi-tasking
[ Next | Contents | Index | APL Home ]