Internet protocol is a set of rules for the transfer of data/communication on the internet.IPv4 is the 4th version of the Internet Protocol.

The IPv4 uses 32-bit addresses and has 4.3 billion addresses. It uses the dotted-decimal representation, for e.g: 192.168.0.2.

The IPv4 address format is: 8bit.8bit.8bit.8bit (adds up to 32bit)

Now, there are two types of IPv4 addresses — Classful and Classless.

We will see the classful addressing method here.

Classful Addressing:

Basically, there are 5 classes of addresses — A, B, C, D, E.

Let us now have a look at each of them one by one:

Class A:-


Like humans, the operating system needs to plan its activities. These activities are the various processes that need to be executed by the OS. The OS needs to schedule all its processes properly to ensure that they get executed without any problems and in minimal time.

For this purpose, there are many scheduling algorithms like the First Come First Serve (FCFS) algorithm, Shortest Job First (SJF) algorithm, etc. We will be discussing these algorithms in detail but before that, we need to understand some terms.

  1. Arrival Time: The time at which the process arrives in the processor for execution.
  2. Waiting…

What is DFA?

Does DFA stand for Dog Food Association?

😂Nope, not at all. DFA has nothing to do with any dog or association. In fact, it is a very sophisticated machine.

DFA in fact is the acronym for — Deterministic Finite Automata.

What is Deterministic Finite Automata?

Firstly, automata is a mathematical model or abstract model which is used to determine if a string is accepted by a language or not.

The DFA is an automata that has finite states and accepts or rejects a given string by running through several states.

Oof! That’s too much of bookish language.

To make things simpler, let's…


The dining philosophers problem is a very famous and interesting problem used to demonstrate the concept of deadlock.

To understand what the dining philosophers problem actually is, you can refer this blog:

Here, I am going to explain the solution to this problem using the concept of semaphores in C. Here’s the program:

#include<stdio.h>
#include<stdlib.h>
#include<pthread.h>
#include<semaphore.h>
#include<unistd.h>

sem_t room;
sem_t chopstick[5];

void * philosopher(void *);
void eat(int);
int main()
{
int i,a[5];
pthread_t tid[5];

sem_init(&room,0,4);

for(i=0;i<5;i++)
sem_init(&chopstick[i],0,1);

for(i=0;i<5;i++){
a[i]=i;
pthread_create(&tid[i],NULL,philosopher,(void *)&a[i]);
}
for(i=0;i<5;i++)
pthread_join(tid[i],NULL);
}

void * philosopher(void * num)
{
int phil=*(int *)num;

sem_wait(&room);
printf("\nPhilosopher %d has entered room",phil);
sem_wait(&chopstick[phil]);
sem_wait(&chopstick[(phil+1)%5]);

eat(phil);
sleep(2)…


The dining philosopher’s problem is a very well known resource sharing problem in the world of computers.

The problem says:

Digital Anna

Technology enthusiast, coder, designer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store