1

Tilera プラットフォームで pthreads を使用して並列プログラムを開発しようとしています。プログラムは問題なくコンパイルされますが、実行するとエラーが発生します。

pthread_create.c:389: start_thread: Assertion `freesize < pd->stackblock_size' failed.

それはどういう意味ですか、どうすれば修正できますか?

プログラムを段階的に実行すると、スレッドが を呼び出そうとすると、このエラーが表示されることがわかりました'pthread_exit(NULL);'。なにか提案を?

スレッドのソースコードは次のとおりです。

void *Consumer(void *threadargs){
// Initialize structure
rtP_Consumer_Controll rtp_lfe;
Init_Consumer(&rtp_lfe);

// Receiving the set of CPUs and thread id
thread_data *th_data = (thread_data *) threadargs;
int th_id = th_data->thread_id;

// Binding this thread to a CPU
if (tmc_cpus_set_my_cpu(th_id) < 0)
    tmc_task_die("THREAD Consumer: 'tmc_cpus_set_my_cpu' has failed");

// Activating network communication
if (tmc_udn_activate() < 0)
    tmc_task_die("THREAD Consumer: Failure in ’tmc_udn_activate()’.");

// Declaring necessary vars
FOP_data r_data;
real_T result;

// Loop over receiving, processing and sending
while (!terminate)
{
    if (tmc_udn0_available_count() == 0) continue;

    // Receiving data to process
    tmc_udn0_receive_buffer((FOP_data*)&r_data,sizeof(r_data));

    // Computing a function
    Consumer_Func(r_data.pA,r_data.pB,&rtp_lfe,&result);

    printf("THREAD Consumer: result %lf ... \n",result);
}

printf("THREAD Consumer: Finalizing the thread ... \n");
// Exiting the thread
pthread_exit(NULL);
}

Terminate は、メイン スレッドによって変更されるグローバル変数です。

ulimit -a を実行すると、次の出力が得られました。

core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 8022
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 8022
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited
4

1 に答える 1

0

正確な答えは見つかりませんでしたが、デバッガーで少し遊んだり、技術サポートに連絡したりして、問題が明らかになりました。UDN 通信はスタックを使用して編成されているようです。さらに、このスタックは、UDN のすべての demux キューで同じです。したがって、問題は pthread_exit スタックを使用するとまだ存在するが巻き戻されているという事実から来ているようです。そのようなスタックにもう 1 つのパケットを追加すると、スタックがクラッシュします。

この問題の解決策は、UDN の代わりに TMC_QUEUE を使用することです。TMC_QUEUE は、共有メモリ内の特定のパケット タイプの FIFO タイプを作成します。その後、すべてがうまく機能します。

于 2013-10-24T06:11:58.110 に答える