Hub Of Geekz

  • Home
  • About Me
  • Contact Us
  • Home
  • Languages
    • C++
    • Java
    • Perl
    • Prolog
    • Bootstrap
  • Database
    • SQL
    • PL/SQL
  • Study
    • Java
      • Java Collection
      • Java Concurrency
      • Java Interview Questions
      • Java Networking
    • Number System
  • Kavita
  • Entertainment
    • Hinglish Cafe
    • Videos
    • Jokes
  • Windows Tricks
  • How To

Thursday, 20 September 2012

Basics of C++

 Earthcare Foundation NGO     07:21     C Plus Plus     No comments   

1)What are the different storage classes in C?
Ans=>C has three types of storage: automatic, static and allocated.
          Variable having block scope and without static specifier have
           automatic storage duration.
          Variables with block scope, and with static specifier have static scope.
          Global variables (i.e, file scope) with or without the static specifier also
           have static scope.
2) How are pointer variables initialized?
Ans=>Pointer variable are initialized by one of the following two ways
          Static memory allocation
          Dynamic memory allocation
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Worst Fit Memory Management Scheme

 Earthcare Foundation NGO     06:30     C Plus Plus     No comments   

worst fit memory management program in c++
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
class WFMM
{ int a[50],c,par,i,j,n,p[50],d[50],r,s,b,m,min,g;
 public:   
        void input();
        void output();
}X;
void WFMM::input()
{
 c=1000;
 r=c;
 cout<<"Total memory Available = 1000";
 cout<<"\nEnter the number of partition that you want in memory\t";
 cin>>par;
 cout<<"\nEnter the size of remaining partitions";
 cout<<"\n\nRemaining Memory=\t1000";
 for(i=0;i<par;i++)
 {
   if(r!=0)
   {
    cout<<"\n Partition "<<i+1<<"\t";
    cin>>s;
    r=r-s;
    a[i]=s;
    cout<<"\n Remaining Memory="<<r;
   }
 }
 cout<<"\n\nEnter the number of processes\t";
 cin>>n;
 cout<<"\nEnter the size of processes\n";
 for(i=0;i<n;i++)
 {
  cout<<"\nP["<<i+1<<"] =\t";
  cin>>p[i];
 }
}
void WFMM::output()
{
 for(i=0;i<n;i++)
 {min=0;
  for(j=0;j<n;j++)
  {
   if(p[i]<=a[j])
   {m=a[j]-p[i];
    if(m>min)
    {min=m;
     d[i]=j+1;
    }
   }
  }
  g=d[i]-1;
  a[g]=a[g]-p[i];
 }
 cout<<"\n\nThe Process allocation are as Follows\n";
 cout<<"\nProcess\tPartition";
 for(i=0;i<n;i++)
  cout<<"\n P["<<i+1<<"]\t "<<d[i];
}
  main()
{

 X.input();
 X.output();
 getch();
}
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Best Fit Memory Management Scheme

 Earthcare Foundation NGO     06:28     C Plus Plus     No comments   

We can also allocate memory locations to dofferent processes using best fit memory management scheme.Here is the code in C++
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
class BFMM
{ int a[50],c,par,i,j,n,p[50],d[50],r,s,b,m,min,g;
 public:   
        void input();
        void output();
}X;
void BFMM::input()
{
 c=1000;
 r=c;
 cout<<"Total memory Available = 1000";
 cout<<"\nEnter the number of partition that you want in memory\t";
 cin>>par;
 cout<<"\nEnter the size of remaining partitions";
 cout<<"\n\nRemaining Memory=\t1000";
 for(i=0;i<par;i++)
 {
   if(r!=0)
   {
    cout<<"\n Partition "<<i+1<<"\t";
    cin>>s;
    r=r-s;
    a[i]=s;
    cout<<"\n Remaining Memory="<<r;
   }
 }
 cout<<"\n\nEnter the number of processes\t";
 cin>>n;
 cout<<"\nEnter the size of processes\n";
 for(i=0;i<n;i++)
 {
  cout<<"\nP["<<i+1<<"] =\t";
  cin>>p[i];
 }
}
void BFMM::output()
{
 for(i=0;i<n;i++)
 {min=1000;
  for(j=0;j<n;j++)
  {
   if(p[i]<=a[j])
   {m=a[j]-p[i];
    if(m<min)
    {min=m;
     d[i]=j+1;
    }
   }
  }
  g=d[i]-1;
  a[g]=a[g]-p[i];
 }
 cout<<"\n\nThe Process allocation are as Follows\n";
 cout<<"\nProcess\tPartition";
 for(i=0;i<n;i++)
  cout<<"\n P["<<i+1<<"]\t "<<d[i];
}
  main()
{

 X.input();
 X.output();
 getch();
}
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

First Fit Memory Management

 Earthcare Foundation NGO     06:24     C Plus Plus     No comments   

we can use first fit memory management scheme to allocate memory space to different processes.Here is the program in c++
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
class FFMM
{ int a[50],c,par,i,j,n,p[50],d[50],e[50],r,s,b;
 public:   
        void input();
        void output();
}X;
void FFMM::input()
{
 c=1000;
 r=c;
 cout<<"Total memory Available = 1000";
 cout<<"\nEnter the number of partition that you want in memory\t";
 cin>>par;
 cout<<"\nEnter the size of remaining partitions";
 cout<<"\n\nRemaining Memory=\t1000";
 for(i=0;i<par;i++)
 {
   if(r!=0)
   {
    cout<<"\n Partition "<<i+1<<"\t";
    cin>>s;
    r=r-s;
    a[i]=s;
    cout<<"\n Remaining Memory=\t"<<r;
   }
 }
 cout<<"\n\nEnter the number of processes\t";
 cin>>n;
 cout<<"\nEnter the size of processes\n";
 for(i=0;i<n;i++)
 {
  cout<<"\nP["<<i+1<<"] =\t";
  cin>>p[i];
 }
}
void FFMM::output()
{
 for(i=0;i<n;i++)
 {
  for(j=0;j<n;j++)
  {
   if(p[i]<=a[j])
   {
    d[i]=j+1;
    a[j]=a[j]-p[i];
    break;
   }
  }
 }
 cout<<"\n\nThe Process allocation are as Follows\n";
 cout<<"\nProcess\tPartition";
 for(i=0;i<n;i++)
  cout<<"\n P["<<i+1<<"]\t "<<d[i];
}
  main()
{

 X.input();
 X.output();
 getch();
}
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg
Newer Posts Home

Ad


Jobsmag.inIndian Education BlogThingsGuide

Subscribe

Do you want fresh and hot updates about us? Then subscribe to our Feeds.

Total Pageviews

Popular Posts

  • Write a program in PL/SQL to print the factorial of a number.
    In this post I will explain how to get the factorial of any given number. For that first you need to know what is the procedure to find ...
  • To find the GCD of two numbers in PROLOG.
    gcd(X,Y):-X=Y,write('GCD of two numbers is '),write(X); X=0,write('GCD of two numbers is '),write(Y); Y=0,write('G...
  • Write a PL/SQL code to get the Fibonacci Sequence
    First, I will explain what is Fibonacci Sequence and how to get this series. So, Fibonacci Sequence is a series of numbers 0,1,1,2,3,5,8,1...

Label

All Articles Best Resources Blogging Boost Traffic Bootstrap C Plus Plus Collection Comedy Comedy Posts Comedy Videos Concurrency creative commons website Education Employee Entertainment Fibonacci Sequence free images GirlFriend Hinglish Cafe How To Image Websites Inspirational Java Java Interview Questions Java Networking Kavita Sangrah Life Lock Sreen Love Number System Patterns Perl Picture PL/SQL Plastic Engineering Programming Prolog public domain SEO Servlet Short Story Shortcut Keys Social Media Social Services SQL SuVichar Thread Traffic True Events Ultimate Guide Windows Tricks Windows8.1 WordPress

Blog Archive

  • ►  2020 (43)
    • ►  September (41)
    • ►  August (2)
  • ►  2019 (1)
    • ►  July (1)
  • ►  2018 (9)
    • ►  September (7)
    • ►  July (1)
    • ►  May (1)
  • ►  2017 (8)
    • ►  June (3)
    • ►  May (3)
    • ►  March (1)
    • ►  January (1)
  • ►  2016 (2)
    • ►  September (1)
    • ►  January (1)
  • ►  2015 (91)
    • ►  December (1)
    • ►  November (1)
    • ►  October (6)
    • ►  May (10)
    • ►  March (20)
    • ►  February (50)
    • ►  January (3)
  • ►  2014 (339)
    • ►  December (1)
    • ►  October (55)
    • ►  September (58)
    • ►  August (94)
    • ►  July (64)
    • ►  June (67)
  • ►  2013 (34)
    • ►  August (5)
    • ►  April (29)
  • ▼  2012 (20)
    • ►  November (1)
    • ►  October (15)
    • ▼  September (4)
      • Basics of C++
      • Worst Fit Memory Management Scheme
      • Best Fit Memory Management Scheme
      • First Fit Memory Management

Author

  • Earthcare Foundation NGO
  • Kavita house
  • Unknown
  • Unknown

Info

Copyright © Hub Of Geekz | Powered by Blogger
Design by Hardeep Asrani | Blogger Theme by NewBloggerThemes.com | Distributed By Gooyaabi Templates