contact contact

Eloquence TASKID usage explained


Title: Eloquence TASKID usage explained
Document: 963238719
Author: Michael Marxmeier (mike@marxmeier.com)

Q: What is a TASKID
Q: What is a primary and secondary task

A TASKID is a unique identifier for each Eloquence process.

This goes back to the dark ages (HP250/HP260) when tasks (the functional equivalent of a eloqcore process) were created statically during the boot process and only a few of them existed.

Each TASK was either associated permanently with a terminal device (in this case it was a primary task) or it could be allocated and associated temporarily with a terminal device (so it was a secondary task).

This concept does not make too much sense these days but unfortunately it was necessary to support it in Eloquence since a lot of software used to depend on specific TASKID values or required TASKIDs to be in a specific range.

How does Eloquence make use of TASKID

The pool of available TASKID values is defined in the eloq.config (for A.05.xx) or eloqsd.cfg (A.06.xx) configuration file.

configuration file /etc/opt/elolquence/eloq.config
 NUSERS  - maximum number of simultaneous sessions
           that can access the shared memory
           limits:  1 .. 400
           default: 30
 NTASKS  - maximum number of available secondary tasks
           limits:  0 .. NUSERS - 1
           default: 10

configuration file /etc/opt/eloquence6/eloqsd.cfg

MaxUsers      Maximum number of eloqcore processes on the local
              system. The default value is 40.

MaxTasks      Maximum number of TASKIDs to reserve for "secondary"
              eloqcore processes. If you don't know what this is good
              for, you probably don't need it :-)
              The default value is 20

The NUSERS or MaxUsers configuration value specifies the highest valid TASKID. The NTASKS or MaxTasks value specifies how much TASKIDs should be reserverd for secondary TASKS.

   <--- MaxUsers / NUSERS ------------------->
                       <-- MaxTasks/NTASKS -->
   | primary           | secondary           |
   | taskid            | taskid              |
The Eloquence daemon (either eloqd for A.05.xx or eloqsd for A.06.xx) it makes shure that TASKID values are unique. For A.06.xx, if the eloqsd server is not running, the taskid is either set to 1 or the process id (depending on platform).

Unless the taskid is specified on the command line (using the -taskid commandline option), Eloquence will allocate a taskid when either eloq or eloqcore is started.

Both eloq and eloqcore will try to allocate a primary taskid. If not primary taskid is available, eloq fails with the error message "No taskid available"

On the HP-UX platform, a primary taskid is allocated by making use of the ttyslot() function, which returns a fixed identifier for a tty device, depending on the position in /etc/utmp file (which depends on the poition in the /etc/inittab file for tty devices).
This was helpful to emulate previous behaviour when mostly terminals where used to login to the system.

The simple C program below demonstrates how Eloquence on the HP-UX platform allocates the taskid.


int main()
   int t = ttyslot() - 5;
   if(t < 1}
     t = 1;
   echo "primary taskid is %d\n", t);
   return 0;
However this aproach does not work well with network based logins (using pty devices) since the ttyslot() return could return values which exceed the range of primary TASKIDs.

On the Linux platform, the first avaiable primary TASKID is used.

If no primary taskid is available, eloqcore will try to allocate a secondary taskid instead. if no-one is available, it fails with the message "No secondary task id available" The first available secondary TASKID is used.

How TASKID is used with Eloquence

The value of the TASKID is returned by the TASKID and USRID functions.

TASKIDs are used with the TASK statements (see below) to implement foreground/background processes (virtual terminal facilities).

Starting eloq (not eloqcore) enables you to handle secondary tasks with the following commands:

REQUEST #n      request the ownership of a secondary task with
                taskid n
RELEASE #n      terminate the ownership of a secondary TASK
                with the taskid n
ATTACH  #n      operation control is passed to the TASK with
                taskid n
DETACH  #n      operation control is given back to the primary
                task that owns the secondary task with taskid n
In order to use secondary tasks, your task must be a primary task.

Suggested use of TASKID in future programs

Simple answer: Don't use it. At most assume TASKID have a unique value but don't assume a specific value range. Future Eloquence versions may return the process ID instead of the TASKID or may remove the distinction of primary and secondary TASKIDs.

Trouble shooting

eloq fails with error message "No taskid available"
Increase the NUSERS / MaxUsers value or specify the taskid on the command line

eloqcore fails with error message "No secondary task id available"
increase the NTASKS / MaxTasks value. Since this reduces the available primary tasks, you may also want to increase the NUSERS / Maxusers.

eloqcore fails with ERROR 400
you need to start eloq instead of eloqcore to make use of secondary tasks.
  Privacy | Webmaster | Terms of use | Impressum Revision:   
  Copyright © 1995-2002 Marxmeier Software AG