Welcome to my blog!

Meet the Author

A Student at National Institute of Science And Technology,an avid blogger and tech geek

Looking for something?

Subscribe to this blog!

Receive the latest posts by email. Just enter your email below if you want to subscribe!

Sitemap

Friday, 10 October 2014

Malala Yousafzai addresses in United Nations Youth Assembly


Malala YousafzaiThe girl stood up for what she believed in and was shot by the Taliban,call it a miracle or a game of fate – she survived the shooting. She lived and she tells her story in her book, “I am Malala”.


                                    


What she spoke would serve as a surge of inspiration for many youth's.
           Here are some parts of her speech which really needs an appreciation.



1) 
"So here I stand one girl among many.
            I speak – not for myself, but for all girls and boys.
            I raise up my voice – not so that I can shout, but so that those without a voice can be heard.
            Those who have fought for their rights:
            Their right to live in peace.
            Their right to be treated with dignity.
            Their right to equality of opportunity.
  Their right to be educated."
2)
"Dear Friends, on the 9th of October 2012, the Taliban shot me on the left side of my forehead. They shot my friends too. They thought that the bullets would silence us. But they failed. And then, out of that silence came, thousands of voices. The terrorists thought that they would change our aims and stop our ambitions but nothing changed in my life except this: Weakness, fear and hopelessness died. Strength, power and courage was born.  I am the same Malala. My ambitions are the same. My hopes are the same. My dreams are the same."
3)
"The wise saying, “The pen is mightier than sword” was true. The extremists are afraid of books and pens. The power of education frightens them. They are afraid of women. The power of the voice of women frightens them. And that is why they killed 14 innocent medical students in the recent attack in Quetta. And that is why they killed many female teachers and polio workers in Khyber Pukhtoon Khwa and FATA. That is why they are blasting schools every day.  Because they were and they are afraid of change, afraid of the equality that we will bring into our society.
4)
Dear brothers and sisters, we must not forget that millions of people are suffering from poverty, injustice and ignorance. We must not forget that millions of children are out of schools. We must not forget that our sisters and brothers are waiting for a bright peaceful future.So let us wage a global struggle against illiteracy, poverty and terrorism and let us pick up our books and pens. They are our most powerful weapons.
         "One child, one teacher, one pen and one book can change the world."
One child, one teacher, one pen and one book can change the world. 
Education is the only solution. Education First. 

Friday, 19 September 2014

You are a Simulation & Physics Can Prove It: George Smoot at TEDxSalford

                                        



Astrophysicist, cosmologist and Nobel Prize winner George Smoot studies the cosmic microwave background radiation — the afterglow of the Big Bang. His pioneering research into deep space and time is uncovering the structure of the universe itself. He has also made a cameo appearance (as himself) in an episode of the 'Big Bang Theory.'

George Smoot looks into the farthest reaches of space to the oldest objects in the known universe: fluctuations in the remnants of creation. Using data collected from satellites such as COBE and WMAP, scanning the cosmic microwave background radiation (a relic of the heat unleashed after the Big Bang), he probes the shape of the universe. In 1992 he and his Berkeley team discovered that the universe, once thought to be smooth and uniform at the largest scale, is actually anisotropic — or varied and lumpy. Smoot continues to investigate of the structure of the universe at the University of California at Berkeley, mapping billions of galaxies and filaments of dark matter in hope of uncovering the secrets of the universe's origins.

Monday, 9 June 2014

Time-A mystery that continued from Newton To Einstein


We live in a world which is governed by time,where every tick of the clock takes us into a newer world of uncertainties,where our experiences teach us that our past is different from the future,future seems to present us with a wealth of possibilities and opportunities while our past is bound of things that has already occurred and are immutable.

The Mystery of time 
If I would have asked you to define TIME then I would have got an answer somewhat similar to the above paragraph.But is it all the concept of time???Definitely it's not.Time in itself is a Million Dollar question because everyone of us experience it but only a handful of us can actually say what it is.

Time is among such things which we are most familiar with yet it is the least understood concept which humanity has ever encountered. Time is an illusion,it is not that what it appears.And the reasons why it appears an illusion are Misconceptions.We live in a world full of misconceptions and illusions yet we take all these things as real without trying to find an reason behind it.





              The Major Misconceptions About Time


 1st misconception:


Most of us think that we live in a world of three dimensions (3-D) but there exists an extra dimension other than these three. In reality we live in a world of four dimensions (4-D) i.e. three dimensions of space and one dimension of time. So in a general perspective it is difficult for us to perceive an extra-dimension like time. The very reason for this  is our brain which has the capability of sensing these three dimensions (3-D) i.e. Length, Breadth and Height.

This is what we think we live in Three Dimensions i.e Length,Breadth and Height.





In Reality we live in a world of Four Dimension 
Three Dimensions of Space 
And 
One Dimension of Time



Space and time are interwoven in such a way that they cannot be separated from each other. So, they are combined to form space time. Everyone measures his or her experience on it and everything in our life occurs at a particular moment of time in the three dimensional space. And hence we cannot rule out the importance of time as a dimension. 

2nd misconception :

A common notion of understanding among people is that TIME ticks at a same rate throughout the world but this statement is not true. Time is not absolute in nature. Rather it is relative which means someone moving through space and time will experience it differently.



Let us visualize a scenario where you are travelling by a train to visit your friend’s house for summer vacations. Now if I would ask you a question whether the time on your watch and your friend’s watch is  the same?




An obvious answer would be 'YES' but let me tell you it will not be the same, your watch will tick at a slower rate as compared to the watch of your friend. It sounds a bit odd but it is the reality. So let us understand the reason for such a peculiar behavior, how does time slow down???


Now the answer to this riddle is 'MOTION' ,"motion affects Time". When we are in motion, our clock will tick at a slower rate as compared to a clock which is at rest. Motion causes the time inside the on board of the train to flow at a slower rate than for those people who are waiting at the station.

To visualize this let’s take a 'Light Clock’ which bounces a beam of light from one mirror to another mirror and one cycle makes one tick of the clock.

Lets analyse the light clock in two frame of references
  • Firstly from the frame of reference of someone inside a moving vehicle.i.e.inside a moving train
            -For someone inside the running train it will appear as if the light beam is bouncing vertically up and  down.

Light beam bouncing vertically up and down
                                                       

  • Secondly from the frame of reference of someone who is standing outside on embankment and watching that 'Light clock' which is inside the moving train.
             -For someone outside on the embankment it will appear as if the light beam traces a V shaped path  due to the vertical moment of light beam along with the horizontal movement of train. 


Light beam follows a V shaped path covering some extra distance



So both these observers, one who is inside the train and the one outside the train will experience time at different rates which infers one thing that both clocks are not ticking at a same rate. This means any one of the clock is running slower, now if we see we will find that clock in motion ticks slower because it has to cover a greater distance to complete one tick of the clock as compared to a clock which is at rest. As a result we find that TIME doesn't tick at the same rate throughout the world.


The whole concept has been explained in this documentary "A journey Through Space & Time"







Wednesday, 5 March 2014

Banker Algorithm

                              Banker Algorithm


The resource-allocation graph algorithm is suitable to a resource allocation system with single instances of each resource type. It is not suitable for multiple instance of each resource type. Banker’s algorithm is suitable to a resource allocation system with multiple instances of each resource type. The banker’s algorithm makes decisions on granting a resource based on whether or not granting the request will put the system into an unsafe state. Several data structures must be maintained to implement the banker’s algorithm. Let n be the number processes in the system and m be the number of resource types. We need the following data structures:
(1) Available (2) Max (3) Allocation (4) Need
1) Available: A vector of length m indicates the number of available resources of each type. If available [j] = k, there are k instances of resource type R available.
2)    Max: An n x m matrix defines the maximum demand of each process. If Max [i, j] = k, then process P. may request at most k instances of resource type Rr3)   Allocation: An n x m matrix defines the number of resources of each type currently allocated to each process. If allocation [i, j] = k, then P. is currently allocated k instances of resource type R
4)  Need: An n x m matrix indicates the remaining resource need of each process. If Need |i, j] = k, then process P. may need k more instances of resource type R, to complete its task. Need [i, j] – Allocation [i, j].
Safety algorithm: Safety algorithm is used to find the state of the system: That is, system may be safe state or unsafe state. Method for this is as follows:
1)   Let work and finish be vector of length m and n respectively. Initialize work = Available and Finish [i] = False for i = 1, 2, 3, 4, … n.
2)   Find an i such that both
a) Finish [i] = False b) Need fj] < work
If no such i exist, go to step 4.
3)    Work : = Work + Allocation i
Finish [i] = true to step 2
4)    If Finish [i] = true for all i, then the system is in a safe state. Resource-request algorithm: Let request, be the request vector for process P. If Request, fj] = k, then process P. wants k instances of resource type R.. When a request for resources is made by process P, the following actions are taken.
1)     If Request. < Need(, then go to step 2. Otherwise, raise an eitor condition since the process has exceeded its maximum claim.
2)    If Request < Available, then go to step 3. Otherwise, P. must wait since the resources are not available.
3)        Available : = Available – Request.; Allocation : = Allocation + Request.; Need; : = Needt – Request.;
If the resulting resource allocation stale is safe, the transaction is completed and process P. is allocated its resources. If the new state is unsafe, then P. must wait to the Request, and the old resource allocation state is restored.



Coding

#include<stdio.h>
#include<stdlib.h>
struct bank
{
 int alloc[10];
 int max[10];
 int need[10];
 int c;
 }p[10];

 int av[10];
 int m,n;
 char res[5]={'D','E','B','A','S'};
 int safe[20];
 int grant[10];
 int g=0;


void read()
{
 printf("\nEnter the number of processes--");
 scanf("%d",&n);
 int i,j;
 printf("\nEnter the number of resorces--");
 scanf("%d",&m);
 for(i=0;i<n;i++)
 {
   p[i].c=0;
   printf("\n\nEnter the details of the process %d--\n",i+1);
   for(j=0;j<m;j++)
    {
      printf("\nEnter the instances of %c allocated--",res[j]);
      scanf("%d",&p[i].alloc[j]);
    }
   for(j=0;j<m;j++)
    {
      printf("\nEnter the instances of %c maximum",res[j]);
      scanf("%d",&p[i].max[j]);
      p[i].need[j]=p[i].max[j]-p[i].alloc[j];
    }

 }


 printf("\nEnter the total instances of available resources--\n");
 for(i=0;i<m;i++)
 {
 printf("%c\t",res[i]);
 scanf("%d",&av[i]);
 }
}


void display()
{
 int i,j;
 printf(" \t Alloc \t Max \t Need \t Avail \n");
 printf(" \t ");
 for(j=0;j<4;j++,printf("\t "))
 for(i=0;i<m;i++)
 printf("%c",res[j]);
 printf("\n");
 for(i=0;i<n;i++)
 {
   printf("P%d\t",i);
   for(j=0;j<m;j++)
   printf("%d",p[i].alloc[j]);
   printf("\t");
   for(j=0;j<m;j++)
   printf("%d",p[i].max[j]);
   printf("\t");
   //printf("dev test 1");
   for(j=0;j<m;j++)
   printf("%d",p[i].need[j]);
   printf("\t");
   if(i==0)
   {
   for(j=0;j<m;j++)
   printf("%d\t",av[j]);
   }
   printf("\n");
   }
   }


int over()
{
  int i,j;
  for(i=0;i<n;i++)
  for(j=0;j<m;j++)
  if(p[i].need[j]!=0)
  return 1;
  return 0;
  }
void banker()
{
  int i,j,k,l;
  for(i=0,l=0;;i++,l++,i=i%n)
  {
   if(over()==0)
    {
     printf("\nAll processes complete\n\nNo Deadlock");
     printf("\n\nSafe state<");
     for(i=0;i<g;i++)
     printf("P%d",safe[i]);
     printf(">");
     break;
  }
  //printf("debasis");
  else
  {
    if(p[i].c==0)
    {
      for(j=0;j<m;j++)
      if(p[i].need[j]>av[j])
      break;
      if(j==m)
      {
        safe[g]=i;
        g++;
        p[i].c=1;
        for(j=0;j<m;j++)
         {
           av[j]=av[j]-p[i].need[j];
           p[i].need[j]=0;
           p[i].alloc[j]=p[i].max[j];
         }
        printf("\n\nProcess P%d is executing---\n\n",i);
        display();
        for(j=0;j<m;j++)
        {
         av[j]=av[j]+p[i].alloc[j];
         p[i].alloc[j]=0;
         p[i].max[j]=0;
        }
        printf("\n\nProcess P%d is completed---\n\n",i);
        display();
        }
 }
 }
 if(l==25)
 {
  printf("---Deadlock---");
  break;
  }
  }
  }


void req()
{
  int i,j,k=0;
  printf("\nEnter the process number--");
  scanf("%d",&i);
  for(j=0;j<m;j++)
  {
   printf("\nEnter the number of instances of resource %c--",res[j]);
   scanf("%d",&grant[j]);
  }
 for(j=0;j<m;j++)
 if(p[i].need[j]<grant[j])
 k=1;
 for(j=0;j<m;j++)
 if(av[j]<grant[j])
 k=2;
 if(k==1)
 {
  printf("Need is less than request cannt be allocated--");
  }
 if(k==2)
 {
  printf("Available is less than reuest cannot be allocated");
 }
 if(k==0)
 {
  for(j=0;j<m;j++)
  {
   p[i].alloc[j]+=grant[j];
   p[i].need[j]-=grant[j];
   av[j]-=grant[j];
   }
   }
   banker();
 }

  main()
  {
   int ch;
   do
   {
    printf("\n\nDEVS TEST BANKERS ALGORITHM");
    printf("\n1.Read devs input data file \n2.Display devs Input data file\n3.Generate devs Safe sequence\n4.Request for resource\n5.Exit\nEnter you choice dev :-)");
    scanf("%d",&ch);
    switch(ch)
    {
     case 1:read();break;
     case 2:display();break;
     case 3:banker();break;
     case 4:req();break;
     case 5:break;
    }
  }while(ch!=5);
 }

UA-55614096-1