remotethread - A lightweight way to do distributed processing Copyright 2011 Janne Kulmala <janne.t.kulmala@iki.fi> Program code is licensed with GNU LGPL 2.1. See COPYING.LGPL file. USAGE ----- 1) Modify your program to create threads with remotethread API. The thread callback function should be of the following form: typedef void *(*remotethread_func_t)(const void *param, size_t param_len, size_t *reply_len); Where "param" and "param_len" specifies the input data to the thread and "reply_len" and the returned pointer are used to return data to the caller. To share data structures with a remote thread, use remotethread_malloc() and remotethread_free(). All allocated data is copied to over the network when a thread is created. All pointers within the data allocated with these functions are also valid at the remote site. The allocator can be directly hooked to glibc's malloc as follows. #include <malloc.h> ... __malloc_hook = remotethread_malloc; __free_hook = remotethread_free; __realloc_hook = remotethread_realloc; You can create new threads by calling call_remotethread() with input data. To wait for specific thread to finish, use wait_remotethread(). To check the status of a thread without blocking, use poll_remotethread(). The function will return RT_EAGAIN if the thread is still running. Finally, add call to init_remotethread(&argc, &argv) to the beginning of main(). 2) Start one or more server processes by running ./remotethread-server. The servers should be of the same architecture and run the same operating system as the machine where the main program is running. 3) Run the program and give the IP addresses of the machines running the server processes as command line arguments (--remotethread [ip]). Work is automatically distributed to the servers.