-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Merge] pthreads early exit #100
Comments
@cesarjp Is the output you posted based on starting execution on node 0 or node 1? |
@bxatnarf, I should have been more clear. I was testing multiple combinations of the test. One version launched from the x86 host (which is node 0) and another version that launched from the arm node (node 1). Here's the code that corresponds to this output: #include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include "migrate.h"
#define N 50
#define NUM_THREADS 2
int data[NUM_THREADS];
void *do_it(void *t)
{
int ret = 0;
int i = (int)t;
data[i] = 10;
pthread_exit (&ret);
}
int
main (int argc, char *argv[])
{
int i;
pthread_t threads[NUM_THREADS];
migrate(1, NULL, NULL);
for (i = 0; i < NUM_THREADS; i++)
{
pthread_create(&threads[i], NULL, do_it, (void *)i);
}
for (i = 0; i < NUM_THREADS; i++)
{
int status = 0;
pthread_join (threads[i], &status);
}
migrate(0, NULL, NULL);
printf ("%d\n", data[0]);
return data[0];
} |
If the first example starts execution from host 0, then we should not expect to see it to printf anything since printf is called after it migrates to host 1. If we execute the code in #100 (comment) from host 0 then we should see the printf since it migrates to 0 before the printf. |
The following pthread test exits early. It should print out the number '10'. Based on the output, the process never migrates back to node 0.
Here is the output:
The text was updated successfully, but these errors were encountered: