eecheng87 / ESCA

Effective System Call Aggregation
https://eecheng87.github.io/ESCA/
MIT License
38 stars 5 forks source link

Support multi-threaded applications #21

Open eecheng87 opened 2 years ago

eecheng87 commented 2 years ago

In current ESCA, it is only available in single-thread application. It is time to extend ESCA to support multi-thread applications. The expected implementation would be similar with SAIO. Following is proposed changes:

  1. init_esca should allocate a table and pin to a proper physical page by customized system call. (refer to init_worker in SAIO)
  2. sys_register should take responsible for the task mentioned in step 1. Also, kernel need to maintain a global table which contain all the allocated table from user processes. (refer to sys_esca_register in SAIO)
  3. The table indexing of sys_batch should be changed.

To verify the correctness, a unit test program is also needed. The proposed testing program would like (simplified):

void worker() {
    batch_start();
    write(1, "foo", 3);
    write(1, "bar", 3);
    batch_flush();
}
int main() {
    ...
    pthread_create(..., &worker, ...);
    ...
    return 0;
}