Background/Phantom process overview

A phantom process is a process that is initiated at a terminal and detaches itself from that terminal for execution independent of that terminal. It is processed as a background task and the results display on the initiating terminal when the process is complete.

The phantom process scheduler is the background process that handles the phantom jobs submitted using the z command from TCL. This process is usually started in the system-coldstart macro by the start.ss program.

Phantom jobs are started using the z command from TCL.

A phantom job runs if there is an available phantom port or line. If there is no phantom port or line available, the phantom job is enqueued until one becomes available.

For UNIX: If the first available line does not have a PID, and a line number was not specified with the x command, the next available line is used.

The scheduler process sleeps until a running job completes or until a new job enters the queue. When a phantom job completes, it wakes the scheduler and logs itself off. The process is now available for other phantom tasks.

When a phantom job is executed:

  • PCB frame is fetched from overflow for the phantom job.

  • Item is written to the dm,jobs, file that indicates that the request is waiting in the queue.

  • Item-ID of the jobs file item is attached to the end of the queue.

  • Scheduler process is awakened if it is asleep.

  • Scheduler checks the queue and reads the item from the jobs file that corresponds to the next item-ID in the queue. If a port is available, the scheduler:

  • Updates the status of the item in the jobs file to running.

  • Adds an item to the jobs file using the port number as the item-ID.

  • Logs the phantom job on to the port.

When a phantom process has finished, the status in the jobs file is updated to logged off. Next, the phantom is awakened and workspace is returned to overflow.

When the scheduler releases a phantom job back to overflow, the item whose port number is the item-ID of the job is deleted from the jobs file.

The p option in the users file terminates phantom processes, rather than forcing a sleep when a BASIC input, a file inconsistency, or any other error that prompts for input is encountered.