Posts

Implementation of Dining Philosopher Problem using Semaphor in C Programming

Image
In this problem, there are five philosophers who can think or eat. There is a circular table with five chairs, each chair belonging
to one philosopher. In the center of the table, there is a bowl of rice, and the table is laid with five single chopsticks.
Initially, all philosophers are thinking. From time to time, a philosopher gets hungry and tries to pick up the two chopsticks that are closest to him (left and right). A philosopher may pick up only one chopstick at a time. Obviously, he cannot pick up a chopstick that is already in the hand of a neighbor and if he finds only one chopstick he has to drop it so that other philosopher can eat. When a hungry philosopher has both his chopsticks (left and right) at the same time, he eats without releasing the chopsticks. When he is finished eating, he puts down both chopsticks and starts thinking again and other philosophers get time to eat.
At once maximum, two philosophers can eat. For example, consider five philosophers are P0, P1, P2, P…

How to Fetch as Google in Search Console New Version

Image
Step 1: Just go to your Search Console and put your URL into the text field on the top with place holding message "Inspect any URL" and hit Enter. Step 2: After step 1, Google will test if the URL is already present or not. If not then click on Test Live URL button. Step 3: After testing the URL will be available to Google. Now you just has to Request indexing as shown in the screenshot. Hope this will work for yours. If you have any problem please comment I will try my best to solve your problem.

Implementation of Banker’s Algorithm in JAVA

The program will read a data file. The name of the data file will be provided as a command line argument. The data file will have the following structure:
First row will represent the maximum units of each resource. There can be any number of resources. 
Second row will contain new request by a process. The first number will be PID i.e process ID of the process making the request and subsequent numbers will be the amount/number of units of each resource the process is requesting. 
Subsequent rows will contain Allocation & Max information about each process. An example file is as follows:
10   5    7 1  1  0  2
0 1 0 7 5 3
2 0 0 3 2 2
3 0 2 9 0 2
2 1 1 2 2 2 
0 0 2 4 3 3
In the above file, the first line tells us that there are 10 units of resource R1, 5 units of R2 and 7 units of R3 in the system. 
The second line tells that process P1 has requested 1 unit of resource R1, 0 units of R2 and 2 units of R3.
The third line tells that process P0 has been allocated 0 units of R1, 1 unit of R2 and 0 …

Matrix Multiplication (Square of a Matrix) using Threads in JAVA

Image
This program will take a text file as a command line argument. The text file will have the first row indicating the total number of rows and columns which will be equal as this program is programmed to read a square matrix from a file and calculate its square using threads.

Content of the text file to be given as an argument

14
0 1 0 7 5 3 1 0 1 0 7 5 3 1
2 0 0 3 2 2 2 3 0 2 9 0 2 3
2 1 1 2 2 2 4 0 0 2 4 3 3 5
3 0 2 9 0 2 6 1 2 3 4 5 6 7
2 0 0 3 2 2 2 3 0 2 9 0 2 3
2 1 1 2 2 2 4 0 0 2 4 3 3 5
3 0 2 9 0 2 6 1 2 3 4 5 6 7
0 1 0 7 5 3 1 2 0 0 3 2 2 2
3 0 2 9 0 2 3 2 1 1 2 2 2 4
0 0 2 4 3 3 5 3 0 2 9 0 2 6
1 2 3 4 5 6 7 0 1 0 7 5 3 1
2 0 0 3 2 2 2 3 0 2 9 0 2 3
2 1 1 2 2 2 4 0 0 2 4 3 3 5
3 0 2 9 0 2 6 1 2 3 4 5 6 7

The first row indicates the total number of rows and columns, in this case, rows=cloumns=14.
And the next rows will be the actual matrix which we want to multiply with itself. The program will calculate the square of the matrix written in your file.

import java.util.*;
import java.io.*; 

class MMT…

Simpletron Complete Program in C [Solved]

Image
The Simpletron runs programs written in the only language it directly understands that is, Simpletron Machine Language, or SML for short. All information in the Simpletron is handled in terms of words. A word is a signed four-digit decimal number such as +1009 +1010 +2009 +3110 and so on. The Simpletron is equipped with a 100- word memory, and these words are referenced by their location numbers 00, 01, …, 99. Before running an SML program, we must load or place the program into memory or the array of the program considered it as the RAM of the computer. The first instruction of every SML program is always placed in location 00. 

Each instruction written in SML occupies one word of the Simpletron’s memory, so instructions are four-digit decimal numbers. Each location in the Simpletron’s memory may contain either an instruction, a data value used by a program or an unused (and hence undefined) area of memory.

For more details you can read the section 7.27 Building your own computer of De…

11 Things that can Ruin Your Blog || You Should Avoid

Image
The competition in blogging is increasing day by day and to rank better on SERP (Search Engine Result Page) many bloggers find quick ways.  For example, they make spammy backlinks, they just copy others content rewrite it by using tools to grow faster but Search Engines hate these techniques to grow faster.

Google sometimes penalize your blog and sometimes even banned you from getting the approval of Adsense. And if you get banned you have to start your struggle again from zero or you just left blogging.

In this blog, I will cover each and everything that can ruin your blog or the things you should avoid.
1. Vain Backlinks:Many new bloggers consider greater the number of backlinks means more ranking and they start making backlinks even on spammy websites.  But remember after the new updates of Google, blogs with fewer backlinks are getting ranking over the blogs with a higher number of backlinks.

I have searched for one keyword by selecting the country India. You can see the result that f…

5 Steps to Write an Efficient Blog

Image
When it comes to blogging, every newbie has tons of questions in mind i.e how to write an effective blog? How to grab audience attention? How to create backlinks and rank on Google? etc.

A lot of time of beginners is spent on searching such type of content on the internet. To be honest, blogging is just like swimming. If you want to learn swimming, every expert around you can tell how to get into the water and how you can survive by following the instructions but you cannot become expert to it by just having familiar to the rules, you have to dive into the water to get experience. These experiences will make you to get familiar to the obstacles and to improve your skills, same applies in case of blogging.

Following some simple and important principles like selecting a topic and targeted audience, you have to write high-quality related content in order to get the targeted result. Besides the high-quality content, well-structured presentation of content is also an important ingredient to …