---
name: "cpujob"
section: "1"
platform: "linux"
package: "mosix"
version: "1.5.7-2"
release: "Debian 3.0 (Woody)"
platforms: ["linux"]
url: "https://new.carta.tech/cpujob"
---

# cpujob(1)

run a command with particular node-allocation preferences

## NAME

**mosrun** – run a command with particular node-allocation preferences

## SYNOPSIS

**mosrun** \[*-{h* \| *MOSIX\_ID* \| *jID1-ID2* \[*,ID3-ID4*\] *...* *}* \[**-F**\]\] \[**-{l\|L\|k}**\] \[*-{c\|i\|n\|s\|f\|* \[*-t* *tt*\] \[*-d* *dec*\] *}* \[*-{e\|E}*\] \[*-{r\|R}*\]\] \[**-z**\]\
 *command* \[ *arg* *...* \]

**nomig** \[**-z**\] *command* \[ *arg* *...* \]

**runhome** \[**-z**\] *command* \[ *arg* *...* \]

**runon** *MOSIX\_ID* \[**-z**\] *command* \[ *arg* *...* \]

**cpujob** \[**-{h\|MOSIX\_id}**\] \[**-z**\] *command* \[ *arg* *...* \]

**iojob** \[**-{h\|MOSIX\_id}**\] \[**-z**\] *command* \[ *arg* *...* \]

**nodecay** \[**-{h\|MOSIX\_id}**\] \[**-z**\] *command* \[ *arg* *...* \]

**slowdecay** \[**-{h\|MOSIX\_id}**\] \[**-z**\] *command* \[ *arg* *...* \]

**fastdecay** \[**-{h\|MOSIX\_id}**\] \[**-z**\] *command* \[ *arg* *...* \]

## DESCRIPTION

**mosrun** runs a *command* while advising MOSIX about the placement, node-lock status and the best method of decaying its MOSIX per-process statistics to suit the program's behaviour.

The *-h* option (h for "home") requests that the *command* be run on the home node.  Similarly, a numeric option (*-MOSIX\_ID*) requests that the process be run on a particular MOSIX node. *mosrun* will fail should that node be unavailable, unless the *-F* option is specified, in which case, the program could run anywhere. The *-jID-LIST* option selects a random node from among the supplied list of nodes. the list should be comma-separated and may contain any combination of either single MOSIX node numbers, or dash-separated range of MOSIX nodes. Again, *mosrun* will fail should the selected random node be unavailable (unless the *-F* option is specified).

The node-lock, preventing automatic process-migrations (except in emergencies, such as when a node is being shut-down, in which case the processes will migrate to their home-node), can be controlled via one of the *-l* (unlock), *-L* (lock) or *-k* (keep) flags.\
 The default is to lock whenever either *-h*, *-MOSIX\_ID* or *-j* are specified or when no decay options are specified and to otherwise keep the status as per the calling shell/program.

The *-c* option advises MOSIX that the program is heavy user-mode computational and should therefore ignore the statistics of any I/O or other system-calls.

The *-i* option advises MOSIX that the program uses heavy I/O or other system calls and should therefore ignore the statistics of any user-mode CPU usage.

The *-n* option advises MOSIX that the program runs an irregular pattern of mixed CPU and I/O (or other system-calls), thus decaying should not be applied.

The *-s* option advises MOSIX to apply slow decaying over the program's statistics (this is also MOSIX's default).

The *-f* option advises MOSIX to apply fast decaying over the program's statistics, indicating a program that alternates between large-granularity chunks of CPU and I/O (or other system-calls).

The *-d* option and/or the *-t* option specifies explicitly how often to decay the statistics for the program and what portion of the statistics should remain after decaying: *tt* specifies the interval between decays in seconds and *dec* specifies the (integer) portion to keep out of 1000 units. If only one of *-d* or *-t* is specified, the other is obtained from\
 the current decaying policy (or if the current policy is either *-c* or *-i*,\
 from the current default settings, eg. of a slow decay).

The *-e* argument specifies that the new decaying preferences will cease to apply for any of the generated processes that performs a successful *[exec(3)](/exec/3.md)* system call. *-E* (the default) specifies that the decaying preferences be kept even across an *[exec(3)](/exec/3.md)*.

The *-r* argument specifies that the new decaying preferences will not be inherited to the program's child processes (and further descendants), while *-R* (the default) specifies that the decaying preferences be inherited.

The **-z** argument specifies that the argument-list begins with argument number zero (which is normally identical to the **command**), rather than the usual argument number one.

Without any options, *'mosrun* *command* *arg* *...'* is equivalent to\
 *'mosrun* *-L* *command* *arg* *...'*.

On a plain, non-MOSIX Linux operating system, *mosrun* will simply spawn the *command* with no side-effects.

The following scripts operate as simple front-ends to *mosrun*:

*Nomig* runs a *command* with a node-lock.

*Runhome* runs a *command* locked at the home node.

*runon* runs a *command* locked on a particular MOSIX node.

*cpujob* runs a *command*, advising MOSIX that it is a computation intensive program.

*iojob* runs a *command*, advising MOSIX that it is an I/O intensive program.

*nodecay* runs a *command*, advising MOSIX to not decay the program's statistics.

*slowdecay* runs a *command*, advising MOSIX to apply slow statistics-decaying.

*fastdecay* runs a *command* advising MOSIX to apply fast statistics-decaying.

## EXAMPLES

*mosrun* *-7* *-F* *-c* *program*

runs a computation-intensive *program* on MOSIX node #7, if available.

*mosrun* *-j2-5,7,10-16* *program* *arg*

runs a program on a random node among node numbers 2-5, 7 or 10-16.

*mosrun* *-h* *-l* *-i* *-r* *job\_manager* *file-name*

runs a program (job\_manager) initially on the home-node, but allowing it to subsequently migrate.  MOSIX is informed that the main process, a manager is heavily I/O bound, but that its children are not so necessarily.

*mosrun* *-t* *1* *-d* *700* *two\_phases*

runs a program that alternates between a relatively long I/O phase and a computational phase.  MOSIX is advised to decay the statistics very quickly - leaving only 70% every second, so that the program is migrated away quickly between the home node and a most available/fast node whenever it switches between stages.

## SEE ALSO

[mosix(7)](/mosix/7.md).

## HISTORY

*mosrun* is a MOSIX utility.
