Tuesday, June 12, 2012
Wednesday, June 6, 2012
Tuesday, June 5, 2012
Best MCA colleges in Munbai (Selected)
Location: Mumbai | Contact college
Location: Mumbai | Contact college
Location: Mumbai | Contact college
Bankers algorithm (SYSPRO)
// Program:
Bankers algorithm
#include<stdio.h>
#include<conio.h>
#include<math.h>
int m,n;
int avl[20];
int max[20][20];
int need[20][20];
int allocat[20][20];
int finish[20];
int work[20];
int ssindex;
int safe_seq[20];
void find_need();
void get_data(int mat[20][20]);
void safety_algorithm(int p);
int chk_safe();
void resource_request();
void main()
{
int flag=0;
int r,p,i;
clrscr();
printf("\nHow
many process u want:");
scanf("%d",&n);
printf("\n
How many resources u want:");
scanf("%d",&m);
printf("\n
Enter allocation matrix");
get_data(allocat);
printf("\nEnter
max matrix");
get_data(max);
printf("\nenter
available resources:");
for(r=0;r<m;r++)
scanf("%d",&avl[r]);
find_need();
for(r=0;r<m;r++)
{
work[r]=avl[r];
finish[r]=0;
}
for(p=0;p<n;p++)
{
flag=0;
for(r=0;r<m;r++)
if(need[p][r]>work[r])
{
flag=1;
break;
}
if(flag==0)
{
safety_algorithm(p);
finish[p]=1;
safe_seq[ssindex]=p;
ssindex++;
}
}
getch();
printf("safe
sequence is:");
printf("<");
for(i=0;i<ssindex;i++)
printf("p%d
",safe_seq[i]);
printf(">\n\n");
if(chk_safe())
printf("\nEntered
sequence is safe:");
else
printf("\nEntered
sequence is not safe:");
getch();
//printf("Enter
process id for request:");
//scanf("%d",&p);
printf("\nEnter
request for %d resources",m);
//for(r=0;r<m;r++)
//for(p=0;p<n;p++)
for(r=0;r<m;r++)
scanf("%d",&max[p][r]);
resource_request();
}//main
void find_need()
{
int p,r;
for(p=0;p<n;p++)
for(r=0;r<m;r++)
need[r][p]=max[p][r]-allocat[p][r];
//need=max_requirement-currnt_allocation
}
void get_data(int mat[20][20])
{
int r,p;
for(p=0;p<n;p++)
for(r=0;r<m;r++)
scanf("%d",&mat[p][r]);
}
void safety_algorithm(int p)
{
int r=0;
for(r=0;r<m;r++)
work[r]=work[r]+allocat[p][r];
}
int chk_safe()
{
int i;
for(i=0;i<n;i++)
if(finish[i]==0)
return(0);
return(1);
}
void resource_request()
{
int r,p;
for(r=0;r<m;r++)
if(max[p][r]>need[r][p])
{
printf("\n
Process has exceeded it's max limit");
getch();
exit(0);
}//if
for(r=0;r<m;r++)
if(max[p][r]>avl[r])
{
printf("\n
Resourses are not available pricess should wait");
getch();
exit(0);
}//if
for(r=0;r<m;r++)
{
avl[r]-=max[p][r];
allocat[r][p]+=max[p][r];
need[r][p]-=max[p][r];
}//for
if(chk_safe())
{
printf("\n
Request can be imidiately granted");
//printf_safe();
getch();
}
else
{
printf("\n
Request can not be granted");
getch();
}
}
/* OUTPUT:
How many process u want:5
How many resources u want:4
Enter allocation matrix:
0 6 3 2
0 0 1 2
1 0 0 0
1 3 5 4
0 0 1 4
Enter max matrix:
0 6 5 2
0 0 1 2
1 7 5 0
2 3 5 6
0 6 5 6
Enter available resources:3 14 12 12
safe sequence is:<p0 p1 p2 p3 p4 >
Entered sequence is safe:
Enter request for 4 resources 1 2 0 1
Process has exceeded it's max limit
*/
Saturday, June 2, 2012
Best MCA Colleges in Pune University
* Audyogik Shikshan Mandal’s Institute of Business Management & Research, Pune (Pune University)
* Dr. D. Y. Patil Institute of Management & Researchi, Pimpri (Pune University)
* Peoples Education Society’s Institute of Management & Career Development, Nigdi, Pune (Pune University)
* Sinhgad Technical Education Society’s Sinhgad Institute of Management, Vadgaon (Budruk),Pune (Pune University)
* Vishwakarma Institute of Technology, Bibwewadi, Pune (Pune University)
* Jayawant Institute of Management Studies, Pune (Pune University)
* Alard Institute of Management Sciences, Pune (Pune University)
* Vidya Pratishthan Institute of Information Technology, Baramati, Pune (Pune University)
* Progressive Education Society’s Modern College of Engineering, Pune (Pune University)
* Genba Sopanrao Moze College of Engineering, Haveli, Pune (Pune University)
* Jaywantrao Sawant College of Engineering,Pune (Pune University)
* MAEER’s Maharashtra Academy of Engineering, Pune (Pune University)
* Choudhary Attar Singh Yadav Memorial Trust,Siddhant College of Engineering, Maval, Pune (Pune University)
* Zeal Education Society’s Dnyanganga Institute of Career Empowerment & Research, Pune (Pune University)
* Institute of Industrial & Computer Management & Research, Nigdi, Pune (Pune University)
* G.H.Raisoni College of Engineering & Management, Wagholi, Pune (Pune University)
* Marathwada Mitra Mandal’s College of Engineering, Karvenagar, Pune (Pune University)
* Pandit Shivdatta Shastri Education Foundation’s Asma Institute of Management, Shivane,Pune (Pune University)
* Kamla Education Society’s Pratibha Institute of Business Management, Chinchwad, Pune (Pune University)
* Abhinav Education Society’s Institute of Management and Research, Haveli, Pune (Pune University)
* Pimpri Chinchwad Education Trust, Pimpri Chinchwad College of Engineering, Pune (Pune University)
* Chanakya Education Society’s Indira College of Engineering & Management, Pune (Pune University)
* Jayawant Shikshan Prasarak Mandal, ENIAC Institute of Computer Application, Wagholi, Pune (Pune University)
* Jayawant Shikshan Prasarak Mandal, Abacus Institute of Computer Application, Hadapsar, Pune (Pune University)
* Sinhagad Technical Education Soceity, Sinhagad Institut Of Technology, Lonavala (Pune University)
* B. P. Hivale Education Society’s Institute of Management Studies Career Development Research, Ahmednagar (Pune University)
* C.H.M.E. Society’s Dr. Moonje Institute for Management & Computer Studies, Nashik (Pune University)
* K. K. Wagh Institute of Engineering Education and Research, Nashik (Pune University)
* MET Bhujbal Knowledge City MET League’s Engineering College, Adgaon, Nashik. (Pune University)
* Gokhale Education Society, College of Engineering, Nashik (Pune University)
* Padmashree Dr. Vithalrao Vikhe Patil Foundation’s Institute of Business Management & Rural Development, Ahmednagar (Pune University)
* Marathwada Mitra Mandal’s Institute of Technology, Lohgaon, Pune (Pune University)
* Dr. D.Y.Patil Pratishthan’s Pad. Dr. D.Y.Patil Institute of Master of Computer Applications, Akurdi, Pune (Pune University)
* Indira Institute of Management, Tathawade,Mulsi, Pune (Pune University)
* Maharashtra Education Society’s Institute of Management and Career Courses (IMCC), Pune (Pune University)
* J.S.P.M.’s Rajarshi Shahu College of Engineering (MCA), Pune (Pune University)
* Jayawant Institute of Computer Applications, Tathawade, Pune (Pune University)
* S. S.P Mandal ‘s Manikchand Dhariwal Institute of Management and Rural Tecnology, Shirur(Pune) (Pune University)
* Sinhgad Technical Education Society’s , Sinhgad Institute of Business Admnistration & Research, Kondhawa-Saswad Rd, Pune (Pune University)
* Sinhgad Institute of Business Administration and Computer Application (SIBACA), Lonavala (Pune University)
* Sinhgad Technical Education Society, Sinhgad Institute of Management & Computer Application, Narhe (Ambegaon), Pune (Pune University)
* Choudhary Attar Singh Yadav Memorial Education Trust’s Siddhant Institute Of Computer Application, Sudambare (Pune University)
* G.H. Raisoni Educational & Medical Foundation’s G. H. Raisoni Institute of Management & Reserch, Wagholi, Pune (Pune University)
* Dr.D.Y. Patil Institute of management, At Post Ambi, Talegaon-Dabhade Pune (Pune University)
* Audyogik Shikshan Mandals, Institute of Computer Studies, Pune (Pune University)
* Sinhgad Institute of Business Administration and Computer Application (SIBACA), Lonavala (Pune University)
Friday, June 1, 2012
Simple Mathematical Operations Program In java
class mathopr
{ public static void main(String arg[])
{ int a,b,c;
a = Integer.parseInt(arg[0]);
b = Integer.parseInt(arg[1]);
c = a+b;
System.out.println("Addition is " +c);
c = a-b;
System.out.println("Substraction is " +c);
c = a*b;
System.out.println("Multiplication is " +c);
c = a/b;
System.out.println("Division is " +c);
c = a%b;
System.out.println("Modulus is " +c);
}
}
CPU-Scheduling FCFS(First Come First Serve) - SYSPRO
#include<stdio.h>
#define MAX 3
struct job
{
int at, bt, wt, tat, index;
};
void main()
{
struct job p[MAX], temp;
int i, j, clk, idl, ttat, twt;
clrscr();
for(i=0;i<MAX;i++)
{
printf("\nEnter AT : ");
scanf("%d",&p[i].at);
printf("\nEnter BT : ");
scanf("%d",&p[i].bt);
p[i].index=i+1;
}
printf("\nPro AT BT");
for(i=0;i<MAX;i++)
{
printf("\nP%d %d %d",p[i].index,p[i].at,p[i].bt);
}
for(i=0;i<MAX;i++)
{
for(j=i+1;j<MAX;j++)
{
if(p[i].at>p[j].at)
{
temp=p[j];
p[j]=p[i];
p[i]=temp;
}
}
}
printf("\nAfter sort\n");
printf("\nPro AT BT");
for(i=0;i<MAX;i++)
{
printf("\n%d %d %d",p[i].index,p[i].at,p[i].bt);
}
clk=0;
idl=0;
printf("\nGantt Chart : ");
printf(" %d ",clk);
for(i=0;i<MAX;i++)
{
if(clk<p[i].at)
{
idl+=p[i].at-clk;
clk=p[i].at;
printf("|/////| %d ",clk);
}
p[i].wt=clk-p[i].at;
clk=clk+p[i].bt;
p[i].tat=clk-p[i].at;
printf("| P%d | %d ",p[i].index,clk);
}
printf("\n\n\nAfter Exc\n");
printf("\nPro AT BT WT TAT");
for(i=0;i<MAX;i++)
{
printf("\n%d %d %d %d %d",p[i].index,p[i].at,p[i].bt,p[i].wt,p[i].tat);
}
getch();
}
Subscribe to:
Posts (Atom)