Tuesday, February 28, 2017

Linux: Difference between livelocks and deadlocks

Everyone knows what a deadlock [2] is!

Wait for graph as described on wikipedia
Defn Deadlock:
Two or more entities vying to get two or more locks in out of order. This leads to each entity waiting for the other entity to release the lock. Since no one releases their held lock the system is stuck and there is no easy recovery.

What is a livelock then?

Monday, February 20, 2017

What datastructure does the CFS use and why

CFS is the Linux kernels completely fair scheduler. It uses red black (RB) trees. 

Red Black trees - datastructure
Nice notes on understanding red-black trees are here [1] and [2].

Why and How is it used in the scheduler?

Wednesday, February 1, 2017

Code snippet to maintain moving averages

I want to maintain moving averages over a window without keeping individual elements in that window. A simple way to do it?

double approxRunningAverage (double avgres, double new_measurement) {

    avgres -= avgres / N;
    avgres += new_measurement / N;

    return avgres;
}

Sunday, January 29, 2017

To Pin or not to Pin on Symmetric Multiprocessor Systems


This is a nice interview questions as it helps to determine if the candidate is capable of discerning the tradeoffs in SMP system design. The question is pretty simple, consider a system where you have two cores 1 and 2 and two tasks e.g. timer tasks A and B. How would you design the scheduling in the system?


Citation information:
G. Bhanage, "To Pin or not to Pin on Symmetric Multiprocessor Systems", Tech Report GDB2017-003, bhanage.com, January 2017.

Bibtex:
@misc{bhanage2017pin,
  title={To Pin or not to Pin on Symmetric Multiprocessor Systems},
  author={Bhanage, Gautam},
  journal={http://www.bhanage.com/p/publications.html},
  number={Tech Report GDB2017-003},
  year={2017}
}

Saturday, January 21, 2017

Introduction to WiFi Packet Captures

If you are a beginner who is just starting to use WiFi with wireshark and want some sample captures to look at here are a few from the wireshark site:

Simple wireless join:
File: Network_Join_Nokia_Mobile.pcap Description: 802.11 capture of a new client joining the network, authenticating and activating WPA ciphering

File: wpa-Induction.pcap Description: 802.11 capture with WPA data encrypted using the password "Induction".