KERNEL customization steps and DEVICE DRIVERS
pseudo char dev driver
Semaphore VS Mutex VS Spinlock
Similarity
– All of these are used for synchronization
Difference
Mutex provides one person to access a single resource at a time, others must wait in a queue. Once this person is done, the guy next in the queue acquire the resource.
So access is serial, one guy after other. Too aggressive.
So access is serial, one guy after other. Too aggressive.
Semaphore are useful if multiple instances (N) of a resource is to be shared among a set of users. As soon as all N resources are acquired, any new requester has to wait. Since there is no single lock to hold, there is as such no ownership of a semaphore.
Spinlock is an aggressive mutex. In mutex, if you find that resource is locked by someone else, you (the thread/process) switch the context and start to wait (non-blocking).
Whereas spinlocks do not switch context and keep spinning. As soon as resource is free, they go and grab it. In this process of spinning, they consume many CPU cycles. Also, on a uni-processor machine they are useless and perform very badly (do I need to explain that?).
Did you know how to customize the linux kernel(3.18)?
- Download Kernel Source code from : www.kernel.org
- extract into HOME/linux & cd to that directory from terminal
- Configure the Kernel: make menuconfig
- after that one window is displayed select what you want to install by Y or N selections
- save it load it and exit
- Build Kernel modules: make modules
- Install modules into /lib/modules: sudo make modules_install
- Install kernel into /boot & update bootloader : sudo make install
- Reboot & select new kernel while booting
- thank you
Comments
Post a Comment