hewlettpackard / nvthreads Goto Github PK
View Code? Open in Web Editor NEWLicense: GNU General Public License v2.0
License: GNU General Public License v2.0
Hello Project Contributors:
Can this github repo be made world readable?
We need to have fewer private repos in the github.com/HewlettPackard org account.
Please contact me directly at [email protected]
Thank you
While I am delighted to see others building on our work, you really should acknowledge that Tongping Liu and I are the authors of significant portions of the code in this repo in the AUTHORS / README files; an ack of the Dthreads and Heap Layers papers would also be appreciated. In addition, that code (Heap Layers and Dthreads) was GPL v2.0 licensed; you can't re-license it with GPL v3.0 without consent, which you haven't requested and which has not been granted. Thanks.
Dear Author,
I am trying to implement a simple self-referential structure using NVThreads unable to access(dereference) the pointer member variable of the structure.
Say,
struct MyStruct{
int myint;
struct MyStruct * next
}
My code :
struct MyStruct* st1 = nvmalloc(size of struct, (char )''c'');
st1->myint = 1;
struct MyStruct st2 = nvmalloc(size of struct, (char *)''c'');
st2->myint = 2;
st1->next = st2;
.
.
abort here
now during recovery code is
allocate mem to st1 ;
nvrecover(st1, size of struct, (char*)"c" );
print st1->myint; --------------------->is recovered correctly;
print st1->next->myint; --------------------->gives me map error;
Please note that I dont want to nvmalloc() st2 with a new name. Because then I guess I have to maintain a list of all such nvmallocs to recover all the structures.
Please let me know if I am doing something wrong.
Executing the code below has significant probability of not completing.
Code gets stuck in xrun.h
, waiting for the token, with threads burning 100% CPU.
Code TL;DR: Spawn N threads. Each thread will read a counter, print its value, and increment it -- all inside a critical section.
#define NUM_THREADS 3
struct thread_args {
int id;
}
pthread_mutex_t m;
int *counter;
void *thread_start(void *arg) {
struct thread_args *args = (struct thread_args *) arg;
int id = args->id;
sleep(id);
pthread_mutex_lock(&m);
lprintf(">> thread %d read counter: %d\n", id, *counter);
*counter[i]++;
pthread_mutex_unlock(&m);
return 0;
}
int main() {
pthread_t tid[NUM_THREADS];
struct thread_args args[NUM_THREADS];
counter = (int*) nvmalloc(sizeof(int), (char*)"counter");
if(isCrashed()) {
nvrecover(counter, sizeof(int), (char*)"counter");
} else {
*counter = 0;
}
pthread_mutex_init(&m, NULL);
for(int i=0; i<NUM_THREADS; i++) {
args[i].id = i;
pthread_create(&tid[i], NULL, thread_start, &args[i]);
}
for(int i=0; i<NUM_THREADS; i++) {
pthread_join(&tid[i], NULL);
}
return 0;
}
I have build nvthreads on kernel 4.13.0-37. And tried to run the test code.
and I am getting this error. I haven't installed dummy_nvmfs, So is the reason for it.
Error:
0 : map error with addr 0xffffffffffffffff!
Aborted (core dumped)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.