Launching a process in a partition

You can use options in your buildfile to launch applications at boot time. In general, you need to launch only the command that starts a multiprocess application, since child processes of your initial command—including shells and commands run from those shells—run in the same partition.

You can also launch a process into a partition at the command line. The interface defined in <sys/sched_aps.h> lets you launch individual threads into a partition and move currently running threads into another partition.

Using a buildfile

To launch a command into a partition, use the [sched_aps=partition_name] attribute in your buildfile's startup script. For example:

[+session pri=35 sched_aps=DebugReserve] ksh &

launches a high-priority shell in the DebugReserve partition.

The statements you use to start a command in a partition may appear anywhere in the startup script after you've created the partition.

Using the command line

To launch a program in a partition from the command line, use the -Xaps=partition_name option of the on command. (The X refers to an external scheduler, the thread scheduler in this case.) For example:

on -Xaps=DebugReserve ksh

launches a shell into the DebugReserve partition.

Using a program

To launch a program into a partition from a program, start the program (e.g., by calling spawn()), and then use the SCHED_APS_JOIN_PARTITION command to SchedCtl() to make the program run in the appropriate partition. For example, this code makes the current process join a given partition:

sched_aps_join_parms join_data;

memset(&join_data, 0, sizeof(join_data)); = partition_ID; = 0;
join_data.tid = 0;

ret = SchedCtl( SCHED_APS_JOIN_PARTITION, &join_data,
if (ret != EOK) {
   printf("Couldn't join partition %d: %s (%d).\n",
  , strerror(errno), errno);
} else {
   printf ("Process is now in partition %d.\n",;