wasm-micro-runtime icon indicating copy to clipboard operation
wasm-micro-runtime copied to clipboard

Spawning new threads with real time priority from a non real time master thread

Open chhokrad opened this issue 2 years ago • 1 comments

Hi

I am investigating the real time performance of WAMR and planning to translate a very famous real time test-bench, cycletest. In this test a non real time master thread, creates a number of measuring threads with real time priorities. The measuring threads are woken up periodically with a defined interval by an expiring timer (cyclic alarm). Subsequently, the difference between the programmed and the effective wake-up time is calculated and handed over to the master thread via shared memory. Do you think its possible to do that with the current implementation of WAMR as I found passed scheduling attributes to the pthread_create function wrapper are ignored as shown in the following snippet

static int
pthread_create_wrapper(wasm_exec_env_t exec_env,
                       uint32 *thread,      /* thread_handle */
                       const void *attr,    /* not supported */
                       uint32 elem_index,   /* entry function */
                       uint32 arg)          /* arguments buffer */

Please correct me if me I am wrong and I would really appreciate if you can suggest a workaround if indeed that is the case.

chhokrad avatar Nov 14 '21 15:11 chhokrad

Hi, currently the attr parameter of pthread_create is ignored, not sure what the scheduling attributes are, could you provide more details? Normally it should be feasible to define structure pthread_attr_t and add some simple pthread_attr_xxx related APIs to support POXIS like platforms. Note that WAMR provides the pthread.h for wasm app at wamr-sdk/app/libc-builtin-sysroot/include/pthread.h, we need add new structure and API definitions in it.

wenyongh avatar Nov 15 '21 07:11 wenyongh