Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/multicore_en/user_guide/quickstart.html on line 1
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/multicore_en/user_guide/quickstart.html on line 1
Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/multicore_en/user_guide/quickstart.html on line 8
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/multicore_en/user_guide/quickstart.html on line 8
This chapter gives you a quick hands-on introduction to multicore processing.
The main steps are as follows:
- Log in as root.
- Go to the directory that holds the buildfile for your system's boot
image (e.g. /boot/build).
- Create a copy of the buildfile:
cp qnxbasedma.build qnxbasedma_multicore.build
- Edit the copy (e.g. qnxbasedma_multicore.build).
- 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 \
procnto-instr
|
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.
|
- 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 \
procnto-smp-instr
|
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.
|
- Save your changes to the buildfile.
- Generate a new boot image:
mkifs qnxbasedma_multicore.build qnxbasedma_multicore.ifs
- Put the new image in place.
In order to ensure you can still boot your system if an error occurs,
we recommend the following:
- Reboot your system.
- Log in as a normal user.
- Start some processes that run indefinitely.
For example, use the
hogs
utility to display which processes are using the most CPU:
hogs -n -%10
- 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.
- Create a program called greedy.c that simply loops forever:
#include <stdlib.h>
int main( void )
{
while (1) {
}
return EXIT_SUCCESS;
}
- 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.
- Use pidin sched to see which processor your other processes are
running on.
They're likely running on different processors from greedy.
- 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
- Start some new processes from this shell.
Note that they run only on the first processor.
- 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.
- 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.
Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/multicore_en/user_guide/quickstart.html on line 278
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/multicore_en/user_guide/quickstart.html on line 278