lockpid -- lock a process onto a specific processor


lockpid -l cpu pid

lockpid -u pid


lockpid is a utility which allows a process to be run entirely on a specified processor. This can be used if performance can be improved by restricting certain applications to specific processors. A process cannot be locked to a processor that has been inactivated using cpuonoff(ADM).

root permission is required to run lockpid.

To assign a process to a processor lockpid requires both the CPU number, the base processor being CPU1, and the process identifier. The process identifier or PID can be found using ps(C) or by running the process in the background.

The options are as follows:

-l cpu pid
locks process pid to the processor given by cpu where both cpu and pid are integer values

-u pid
unlocks the previously locked process pid
The -u option has no effect if a locked process has finished executing or terminates abnormally.

Exit values

lockpid exits with 0 upon successful completion. It exits with 1 if an error occurs.


pid process_id locked on cpu num
Confirmation that process process_id was locked to processor number num.

pid process_id unlocked
Confirmation that the process process_id has been unlocked from the processor.

lockpid: invalid CPU specified
The argument specifying a processor must be numeric.

lockpid: invalid pid specified
The argument specifying a process id must be numeric.

lockpid: cannot specify negative CPU
The argument specifying a processor must be a positive integer.

lockpid: CPU specified exceeds number of CPUs installed
The specified processor does not exist or has not been serialized.

lockpid: cannot lock pid process_id
The process process_id could not be locked to the specified processor. This can occur if the process has already used floating point different from that used by the processor specified.

lockpid: cannot unlock pid process_id
The process process_id could not be unlocked.

lockpid: can't open device
The required device node device is missing. Run idmknod(ADM) to recreate any missing device nodes.

lockpid: cannot determine number of processors
The kernel cannot determine the number of processors installed and serialized.

lockpid: malloc for procdata failed
lockpid could not malloc required memory for its internal work area.

lockpid: cannot determine processor_data
lockpid could not read the relevant processor data from the kernel


Using the PID returned as a result of running a process in the background, lockpid is used, in the following example, to lock process 22852 to CPU2:
   $ cpusar -Q -P2 1 1
   $ program &
   [1]     22852
   $ lockpid -l 2 22852
   $ cpusar -Q -P2 1 1


Note the following warnings:



See also

cpu(HW), cpusar(ADM), cpuonoff(ADM), mpsar(ADM), mpstat(ADM)

Standards conformance

lockpid is not part of any currently supported standard; it is an extension of AT&T System V provided by the Santa Cruz Operation, Inc.
© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003