Caution: This version of this document is no longer maintained. For the latest documentation, see

A Quick Introduction to Multicore Processing

This chapter gives you a quick hands-on introduction to multicore processing. The main steps are as follows:

Setting up the OS image

  1. Log in as root.
  2. Go to the directory that holds the buildfile for your system's boot image (e.g. /boot/build).
  3. Create a copy of the buildfile:
  4. Edit the copy (e.g.
  5. Search for procnto. The line might look like this:
        PATH=/proc/boot:/bin:/usr/bin:/opt/bin \
    LD_LIBRARY_PATH=/proc/boot:/lib:/usr/lib:/lib/dll:/opt/lib \

    Note: In a real buildfile, you can't use a backslash (\) to break a long line into shorter pieces, but we've done that here, just to make the command easier to read.

  6. Change procnto to the appropriate multicore version; see /proc/boot to see which uniprocessor version you're using, and then add -smp to it. For more information, see procnto in the Utilities Reference. For example:
        PATH=/proc/boot:/bin:/usr/bin:/opt/bin \
    LD_LIBRARY_PATH=/proc/boot:/lib:/usr/lib:/lib/dll:/opt/lib \

    Note: Although the multiprocessing version of procnto has “SMP” in its name, it also supports BMP. You can even use bound and symmetric multiprocessing simultaneously on the same system.

  7. Save your changes to the buildfile.
  8. Generate a new boot image:
    mkifs qnxbasedma_multicore.ifs
  9. Put the new image in place. In order to ensure you can still boot your system if an error occurs, we recommend the following:
  10. Reboot your system.

Trying symmetric multiprocessing

  1. Log in as a normal user.
  2. Start some processes that run indefinitely. For example, use the hogs utility to display which processes are using the most CPU:
    hogs -n -%10
  3. Use pidin sched to see which processor your processes are running on.

    If you're using the IDE, you can use the System Information perspective to watch the threads migrate.

  4. Create a program called greedy.c that simply loops forever:
    #include <stdlib.h>
    int main( void )
        while (1) {
        return EXIT_SUCCESS;
  5. Compile it, and then run it:
    qcc -o greedy greedy.c
    ./greedy &

    On a uniprocessor system, this would consume all the processing time (unless you're using adaptive partitioning). On a multicore system, it consumes all the time on one processor.

  6. Use pidin sched to see which processor your other processes are running on. They're likely running on different processors from greedy.

Trying bound multiprocessing

  1. Use the -C or -R option (or both) to the on utility to start a shell on a specific set of processors:
      on -C 0 ksh
  2. Start some new processes from this shell. Note that they run only on the first processor.
  3. Use the -C or -R option (or both) to slay to change the runmask for one of these processes. Note that the process runs only on the processors that you just specified, while any children run on the processors you specified for the shell.
  4. Use the -C or -R option (or both) and the -i option to slay to change the runmask and inherit mask for one of these processes. Note that the process and its children run only on the newly specified processors.