This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Overhead due to use of SYS/BIOS on C6678



Hi,

We are implementing an algorithm on C6678 on all 8 cores (1 master, 7slaves). Initially the algorithm was implemented on a single core without using a task. The processing time using 8 cores was almost double that of single core.

Specifically,  the time taken for a piece code inside a task, on single core was 123ms. The time taken for the same code executed without a task, on a single core was 7ms. Is this the OS overhead? Are there any methods to kill this overhead? The code profiled above includes calling the rand() function, if that is in any way relevant.

Thanks,

Harini

  • rand() is the culprit.

    The rand() function uses a static variable to track the seed value.   In order to keep rand() thread-safe, the RTS library calls _lock() and _unlock() functions to provide a critical region.   In a non-OS environment, these functions are noops.   In a SYS/BIOS environment, _lock() and _unlock() call an OS mutex API to acquire a mutex and release the mutex.

    The source for rand() is included in the rts.zip file in the compiler's lib directory.   You can unzip it, copy rand.c to your project and remove the _lock/_unlock calls.   And make sure you don't call it from multiple contexts. 

    -Karl-

  • Karl,

    Is there a way to know in advance when this problem will happen? Looking at source files and editing them may not be a practical approach.

    Thanks