Virtual Memory in FreeBSD - Part 1

| Comments

In computing, virtual memory is a memory management technique that is implemented using both hardware and software. It maps memory addresses used by a program, called virtual addresses, into physical addresses in computer memory but it lacks code details.

Read More

Recently, I have come across a very good blog post about virtual memory which explains in theory what is virtual memory and talk a bit about code

The Design and Implementation of the FreeBSD Operating System is an excellent book and this is the book I am reading, following and learning.

Signal Code in FreeBSD

| Comments

Signals are a limited form of inter-process communication used in Unix, Unix-like, and other POSIX-compliant operating systems. A signal is an asynchronous notification sent to a process or to a specific thread within the same process in order to notify it of an event that occurred. Signals have been around since the 1970s Bell Labs Unix and have been more recently specified in the POSIX standard.

Read More

Fork Code in FreeBSD

| Comments

In computing, particularly in the context of the Unix operating system and its workalikes, fork is an operation whereby a process creates a copy of itself. It is usually a system call, implemented in the kernel. Fork is the primary (and historically, only) method of process creation on Unix-like operating systems.

Read More

Dynamic Programming

| Comments

dynamic programming

In mathematics, computer science, economics, and bioinformatics, dynamic programming is a method for solving complex problems by breaking them down into simpler subproblems. It is applicable to problems exhibiting the properties of overlapping subproblems and optimal substructure (described below). When applicable, the method takes far less time than naive methods that don’t take advantage of the subproblem overlap (like depth-first search).

Read more

Debug FreeBSD - Open

| Comments

Open System Call

For most file systems, a program initializes access to a file in a filesystem using the open system call. This allocates resources associated to the file (the file descriptor), and returns a handle that the process will use to refer to that file. In some cases the open is performed by the first access.

More information can be found at wikipedia article or Linux manual page.

Boot FreeBSD

| Comments

This post is about the sequence and the amount of work happens under the hood when computer is switched on and the login prompt appears on the screen.

Bird Eye View

  1. Boot Command starts by initializing
    • CPU
    • Virtual address translations is turned off
    • Disable hardware interrupts
  2. Boot command loads FreeBSD kernel

  3. FreeBSD kernel now goes through different stages of hardware and software initialization
    • Set up initial stages of CPU
    • Setup run time stack
    • Setup virtual memory
    • Machine dependent initialization
      • Setting up mutexes
      • Setting virtual memory page tables
      • Configure I/O devices
    • Machine independent initialization
      • Mounting root file system
      • Initializing myriad system data structures.
  4. System processes are created and executed
  5. User level programs are brought in to execute
  6. System is now ready to run normal applications

Curious Case of Recursion

| Comments

Recursion has always been imaginative to me. How do I write the recursive function so that it solve the problem, what all cases it would uncover as recursion progress. As input value increases things gets complex and I am lost.

To understand it better I was looking around internet and I found very ordinary yet powerful statement.

Functions can call other functions – this is a fact that most programmers know. Recursion is simply a special case where instead of calling another function, a function calls itself.

Singleton - Design Pattern

| Comments

Problem Statement

We create a class, and we know the classes can be instantiated once or twice or a thousand times, but what if you only want one object of that class.

Solution

Before we dive into solution lets understand what actually is design pattern.

Design Patterns are well-tested solutions to common problems and issues we run into in software development. Think of them as best practices, suggestions for how you might arrange your own classes and objects to accomplish a result.

OOPS - Object Oriented

| Comments

Recently I have been trying to learn the approach to design an application in object oriented manner. Coming from C or systems background I was little struggling to think in terms of Oops. So, I stepped back a bit and tried to understand the whole concept with different angle. It’s like unlearn the existing stuff and look it with fresh perspective. Although, I knew the core concepts of Oops but how to apply them was little troubling.

I found this video series and it’s teaching exactly with what I am struggling with. It takes step by step approach and help you design an application based on Oops concepts.

I am loving it!!!

Follow Vaibhav Gautam’s board Object Oriented Design on Pinterest.

The whole video series can be watched at youtube