With the advent of multi-core architectures, it is becoming increasingly important to build scalable data structures that support the basic operations (insert, search) without taking coarse grained locks. Coarse grained locks are usually taken on the entire data structure and prevent any other concurrent thread(s) from operating even on other disjoint/orthogonal parts of the data... Continue Reading →
Pointer World !!
In this post, I will just give a brief overview of using pointers in several ways in our C/C++ programs. Pointer is sort of a known concept. Hence, the post will be focusing on the usage in various scenarios like arrays, strings, structs, functions along with code examples. Pointer to Pointer Pointers and Arrays Array... Continue Reading →
Logical and Physical Addresses
In this post, I am going to talk about logical and physical addressing of main memory (DRAM) in computer systems. Logical addresses are also known as virtual addresses. In fact, I would refer to them logical aka virtual aka unreal addresses. Yes, as the name suggests, logical addresses are unreal addresses. These are not the... Continue Reading →
Fenwick Trees
In this post I will talk about Fenwick Trees aka Binary Indexed Trees. I got to use them recently while solving a problem in a coding challenge. Problem: Let's say we have an array of N positive integers. We need to be able to serve the following two operations efficiently: GetPrefixSum(i) - Gets the cumulative... Continue Reading →
Call Stack Internals (Part 1)
In this post, I will be discussing the internal working of a function call stack. The content will be divided into multiple posts for better understanding. Major focus will be on the following: Creation of stack frames, Saving/restoring registers to/from the stack. Saving function local variables, arguments, and return address on the stack. Usage and... Continue Reading →
Pre/Post Increment Operators and Performance Differences
Let's say we want to print the numbers from 0 to 9. How do we do that ? int i=0; for (i=0; i<10; i++) { printf("%d \t", i); } How about writing the same for loop as below ? int i=0; for (i=0; i<10; ++i) { printf("%d \t", i); } Is there any difference between... Continue Reading →