Shared semaphore between user and kernel spaces

前端 未结 8 1123
死守一世寂寞
死守一世寂寞 2020-12-24 07:29

Short version

Is it possible to share a semaphore (or any other synchronization lock) between user space and kernel space? Named POSIX semaphores have kernel persi

相关标签:
8条回答
  • 2020-12-24 08:03

    One solution I can think of is to have a /proc (or /sys or whatever) file on a main kernel module where writing 0/1 to it (or read from/write to it) would cause it to issue an up/down on a semaphore. Exporting that semaphore allows other kernel modules to directly access it while user applications would go through the /proc file system.

    I'd still wait to see if the original question has an answer.

    0 讨论(0)
  • 2020-12-24 08:15

    I was thinking about ways that kernel and user land share things directly i.e. without syscall/copyin-out cost. One thing I remembered was the RDMA model where the kernel writes/reads directly from user space, with synchronization of course. You may want to explore that model and see if it works for your purpose.

    0 讨论(0)
提交回复
热议问题