Understanding ARP (Address Resolution Protocol) basics

The MAC address is how machines on a subnet communicate. When machine A sends packets to another machine on its subnet, it sends it using the MAC address. When sending a packet to a machine on the public Internet, the packet is sent to the MAC address of the router interface that is the default … Read more

Linux Initscript Example to start and stop process during booting

The below shell script uses start-stop-daemon from “/sbin/start-stop-daemon” to execute the program during booting so that the process is started boottime. In the below example, DAEMON=$PWD/helloworld.bin shows that our program is helloworld.bin and is located in current directory from where the script is executed. The above script can be executed as “bash start_daemon.sh start” to … Read more

How to identify and kill zombie process in Linux ?

If you already knows whats zombie process and wanted to identify all zombie process’s in you system, you can directly proceed ahead but if you don’t know, we may suggest you first read the article, “What is Zombie process and How to create zombie process in Linux ?” Lets consider, now you have created the … Read more

Wi-Fi Initial Communication between device and access point

Following diagram shows the initial handshaking between the device ( like mobile ) and wireless access-point ( AP ) in open access mode and secured ( e.g. WPA ) mode, Authentication frame ( in open access ): 802.11 authentication is a process whereby the access point either accepts or rejects the identity of a radio … Read more

What is the Difference between Process and Thread ?

Creating a new thread is very similar to forking a new process, but there are differences. When a new process is forked, it shares relatively little data with the parent process which created it, when a new thread is created, it shares much more information (such as all the global variables and static local variables, … Read more

C program to check total and free RAM memory in Linux

Following C program helps you to identify what is the total and free memory / RAM available in your Linux machine. $ vim checkfreemem.c [bash] #include <stdio.h> #include <sys/sysinfo.h> void printmemsize(char *str, unsigned long ramsize) { printf("%s: %ld in bytes / %ld in KB / %ld in MB / %ld in GB\n",str, ramsize, ramsize/1024, (ramsize/1024)/1024, … Read more

C program to read mac address using WiFi interface name

If you need to get the mac address of certain wifi interface using C program, you can use the below program. This program should work on any Linux as well as Android platforms. $ vim read_wifi_mac.c [c] #include <stdio.h> #include <stdlib.h> #include <string.h> // here our wifi interface was shown as wlp3s0, in your case … Read more

Difference between Spinlock and Semaphore

Spinlocks Spinlocks assume the data you are protecting is accessed in both interrupt-handlers and normal kernel code. If you know your data is unique to user-context kernel code (e.g., a system call), you can use the basic spin_lock() and spin_unlock() methods that acquire and release the specified lock without any interaction with interrupts. Spinlocks should … Read more

Difference between Mutex and Semaphore

Besides the better readability, the code for mutex is smaller and slightly faster than the semaphore implementation. Further, since a mutex can only be acquired by a single entity, a lot of debugging features could be added, which is otherwise not possible with the generic semaphores. And finally, the mutex semantics is less error prone … Read more