diff -r ae94777fff8f -r 59758314f811 Symbian3/PDK/Source/GUID-C7B748CF-D080-5448-98AF-1634D821E713.dita --- a/Symbian3/PDK/Source/GUID-C7B748CF-D080-5448-98AF-1634D821E713.dita Fri Jun 11 12:39:03 2010 +0100 +++ b/Symbian3/PDK/Source/GUID-C7B748CF-D080-5448-98AF-1634D821E713.dita Fri Jun 11 15:24:34 2010 +0100 @@ -1,57 +1,57 @@ - - - - - - SMP -ExampleThis example demonstrates symmetric multiprocessing using multiple -threads. -

This example shows the differences between code running in a unicore environment -and in a multiprocessor environment.

-
Download

Click on the following link to download -the example: SmpExample.zip

Click: browse to view the example code.

-
Class summary
    -
  • RThread - A handle to a thread.

  • -
  • RDbStoreDatabase - DBMS Store database implementation

  • -
-
Design and implementation

The example creates two -databases named DBforSMP1.db and DBforSMP2.db and three threads:

    -
  • WriterThread1: -It creates the DBforSMP1.db database and writes integers to it. The thread -has the lowest priority amongst all the threads.

  • -
  • WriterThread2: -It creates the DBforSMP2.db database and writes some integers to it. The thread -has highest priority amongst all the threads.

  • -
  • ReaderThread: -It reads the two databases and prints the output to the console. It has normal -priority.

  • -

In a unicore enviroment, the threads are executed according to their -priorities. This means first WriterThread2, then ReaderThread and -finally WriterThread1 is executed. Hence ReaderThead can -only print the contents of the DBforSMP2.db in the console because DBforSMP1 -is empty. in an SMP environment, threads run simultaneously and ReaderThread can -print the contents of both the databases.

-
Building and configuring

To build the example:

    -
  • The example builds an -executable called smpexample.exe in the standard location.

  • -
  • You can build the example -from your IDE or the command line.

    If you use an IDE, import the bld.inf file -of the example into your IDE, and use the build command of the IDE.

    If -you use the command line, open a command prompt, and set the current directory -to the source code directory of the example. You can then build the example -with the SBSv1 build tools with the following commands:

    bldmake -bldfiles

    abld build

    How to use bldmake and How to use abld describe -how to use the SBSv1 build tools.

  • -
-
Running the example

To test the example in an SMP -environment, add crazyscheduling onin the epoc32\data\epoc.ini file. -This emulates SMP behaviour in the techview emulator. Execute the example -in both unicore and multiprocessor environment and see the difference. Run -the example following the instructions provided in the console.

+ + + + + + SMP +ExampleThis example demonstrates symmetric multiprocessing using multiple +threads. +

This example shows the differences between code running in a unicore environment +and in a multiprocessor environment.

+
Download

Click on the following link to download +the example: SmpExample.zip

Click: browse to view the example code.

+
Class summary
    +
  • RThread - A handle to a thread.

  • +
  • RDbStoreDatabase - DBMS Store database implementation

  • +
+
Design and implementation

The example creates two +databases named DBforSMP1.db and DBforSMP2.db and three threads:

    +
  • WriterThread1: +It creates the DBforSMP1.db database and writes integers to it. The thread +has the lowest priority amongst all the threads.

  • +
  • WriterThread2: +It creates the DBforSMP2.db database and writes some integers to it. The thread +has highest priority amongst all the threads.

  • +
  • ReaderThread: +It reads the two databases and prints the output to the console. It has normal +priority.

  • +

In a unicore enviroment, the threads are executed according to their +priorities. This means first WriterThread2, then ReaderThread and +finally WriterThread1 is executed. Hence ReaderThead can +only print the contents of the DBforSMP2.db in the console because DBforSMP1 +is empty. in an SMP environment, threads run simultaneously and ReaderThread can +print the contents of both the databases.

+
Building and configuring

To build the example:

    +
  • The example builds an +executable called smpexample.exe in the standard location.

  • +
  • You can build the example +from your IDE or the command line.

    If you use an IDE, import the bld.inf file +of the example into your IDE, and use the build command of the IDE.

    If +you use the command line, open a command prompt, and set the current directory +to the source code directory of the example. You can then build the example +with the SBSv1 build tools with the following commands:

    bldmake +bldfiles

    abld build

    How to use bldmake and How to use abld describe +how to use the SBSv1 build tools.

  • +
+
Running the example

To test the example in an SMP +environment, add crazyscheduling onin the epoc32\data\epoc.ini file. +This emulates SMP behaviour in the techview emulator. Execute the example +in both unicore and multiprocessor environment and see the difference. Run +the example following the instructions provided in the console.

\ No newline at end of file