Recent Articles

How to interface your kernel module via the sysfs

In my previous blog, The first ever driver that I wrote | Ups and Downs (rajatasthana.com), I had created a very simple misc char device driver. It interacted with the user space using the simple_read_from_buffer() and simple_write_to_buffer() APIs. That is one way to interact with the user space processes, but there are other and much better ways to do this. In this blog, lets explore how can we interface a kernel module using the sys filesystem!

Continue reading ⟶

The first ever driver that I wrote

The first ever driver that I wrote was a misc char driver. It supported read and write functions and showed up in dev/rastonit. When the device node was written to, the data sent was checked and if it didn’t match with my name, it returned an error. I had written it out of kernel source tree, as a loadable kernel module, so the device was was registered when the module was loaded and the device was unregistered when the module was unloaded.

Continue reading ⟶

Whatever Little I know about the Linux Device Model!

I know very little about the Linux Device Model, but whatever I am writing in this blog is whatever I kept in my mind and anyway got started writing my first device driver, a very very simple misc char device driver! I hope this helps anyone who is starting out… With that disclaimer, lets get started!! What is a device driver? A device driver is the interface between the OS and a hardware device.

Continue reading ⟶

Physical memory organization and memory allocation and deallocation!

One of the best that has ever happened to me was that I got an opportunity to take part in the Eudyptula challenge! In that challenge, there are problems around memory allocation and deallocation, which made to explore how the kernel manages the physical memory, and the algorithms and APIs involved in the allocation and deallocation of memory. Lets get started! Physical Memory Organization Lets begin by understanding some terms:

Continue reading ⟶

Whatever I know about Memory Management!

So, remember that when a printf function call happens, we eventually make a write system call to write to the stdout. When a system call happens, we move from the user space to the kernel space — and as we know, for every thread alive there are two stacks for it, a user space and a kernel space. But, following is the process we have seen till now: and this uses all the memory available.

Continue reading ⟶