Internet protocol is a set of rules for transfer of data /communication on the internet .IPv4 is the 4th version of the Internet Protocol.
The IPv4 uses 32-bit addressing and has 4.3 billion addresses. It uses the dotted-decimal representation, for e.g: 192.168.0.2.
The IPv4 address format is like: 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.
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:
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 these 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.
What is DFA?
Does DFA stand for Dumb Faced Aunty?
😂Nope, not at all. DFA has nothing to do with any aunty. In fact, it is a very sophisticated machine.
DFA in fact is the acronym for — 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 which has finite states and accepts or rejects a given string by running through a number of states.
Oof! That’s too much of bookish language.
To make things simpler, lets…
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…
Technology enthusiast, coder, designer