3 ms·
Many people will ask "why not do this in user space?" The article answers this: Unlike Linux user space, the Linux kernel space has support for interrupts. The
by sgt 11y ago
Many people will ask "why not do this in user space?" The article answers this:
Unlike Linux user space, the Linux kernel space has support for interrupts. The first example in this article demonstrates how you can write an LKM that uses GPIOs and interrupts to achieve a faster response time than is possible in user space.
- OrangeTux 11y agoBut what if you've a complex app which interacts with GPIOs? You don't want to write the whole app a LMK and run in in kernel space, do you? I've written a JSON-RPC API which can be used to interact with GPIOs. Currently I set/get a GPIO using sysfs. During handling of a request the operations on sysfs take most of the response time, far more time than parsing the request and writing the result to the client. How could I speed up the GPIO interaction with a LKM?
- sgt 11y agoAs much as it's fun to create kernel modules and experiment with kernel space, I'll have to agree with this. If you can keep things simple and use existing facilities, that should generally be the goal.
- gardarh 11y agoYou'd want to separate that complexity from your kernel modules by using some intermediate, e.g. mqueues, named pipes or shared memory.