An Overview

All the necessary study material for b-tech students.

What we have to offer you.

Codes,Syllabus,Study material,Lab manuals,Assignments and many more . . .

Surfing becomes easy.

You can have any material from our website and post your valuable comments for further improvement.

Get the latest techno news

Get yourself updated with this fast changing dynamic world and all the changes in b-tech pattern.

All the best resources for you.

We have done our level best to provide you with the best of the degree and thus this site is devoted to b-tech exclusively.

Showing posts with label computer graphics. Show all posts
Showing posts with label computer graphics. Show all posts

27 January 2012

Input/Output system designing and the steps to be followed.


Designing an I/O System in Five Easy Pieces
The art of I/O system design is to find a design that meets goals for cost, dependability, and variety of devices while avoiding bottlenecks to I/O performance. Avoiding bottlenecks means that components must be balanced between main memory and the I/O device, because performance—and hence effective cost/performance— can only be as good as the weakest link in the I/O chain. The architect must also plan for expansion so that customers can tailor the I/O to their applications. This expansibility, both in numbers and types of I/O devices, has its costs in longer I/O buses, larger power supplies to support I/O devices, and larger cabinets. Finally, storage must be dependable, adding new constraints on proposed designs.

In designing an I/O system, analyze performance, cost, capacity, and availability using varying I/O connection schemes and different numbers of I/O devices of each type. Here is one series of steps to follow in designing an I/O system. The answers for each step may be dictated by market requirements or simply by cost, performance, and availability goals.

Input/Output system- click to see the video


1. List the different types of I/O devices to be connected to the machine, or list the standard buses that the machine will support.

2. List the physical requirements for each I/O device. Requirements include size, power, connectors, bus slots, expansion cabinets, and so on.

3. List the cost of each I/O device, including the portion of cost of any controller needed for this device.

4. List the reliability of each I/O device.

5. Record the CPU resource demands of each I/O device. This list should include Clock cycles for instructions used to initiate an I/O, to support operation of an I/O device (such as handling interrupts), and complete I/O CPU clock stalls due to waiting for I/O to finish using the memory, bus, or Cache CPU clock cycles to recover from an I/O activity, such as a cache flush.

6. List the memory and I/O bus resource demands of each I/O device. Even when the CPU is not using memory, the bandwidth of main memory and the I/O bus is limited.

7. The final step is assessing the performance and availability of the different ways to organize these I/O devices. Performance can only be properly evaluated with simulation, though it may be estimated using queuing theory. Reliability can be calculated assuming I/O devices fail independently and are that MTTFs are exponentially distributed. Availability can be computed from reliability by estimating MTTF for the devices, taking into account the time from failure to repair.

17 November 2011

A man walking in rain.

#include<stdio.h>
#include<dos.h>
#include<conio.h>
#include<graphics.h>
#include<stdlib.h>

void rain(int x1,int y1,int x2,int y2)
{
int s,dx,dy,m,c=0,t=1;
float xi,yi,x,y;

dx=x2-x1;
dy=y2-y1;

if(abs(dx)>abs(dy))
s=abs(dx);
else
s=abs(dy);

xi=dx/(float)s;
yi=dy/(float)s;

x=x1;
y=y1;

putpixel(x1+0.5,y1+0.5,9);

for(m=0;m<s;m++)
{
c++;
x+=xi;
y+=yi;
if(getpixel(x,y)==4)
break;
if(c%10==0)
t++;
putpixel(x+0.5,y+0.5,0);
if(t%2==0)
putpixel(x+0.5,y+0.5,9);

}

}


void main()
{
int gd=DETECT,gm=DETECT,c=-200,i=0,x=40,l=15,h=15,ht=0;
initgraph(&gd,&gm,"");
cleardevice();
setcolor(BROWN);
line(0,201,600,201);

cont:

while(!kbhit())
{
setcolor(4);
ellipse(x,100,0,180,50,30);
line(x-50,100,x+50,100);
line(x,100,x,150);
circle(x-20,115,15);
line(x-20,130,x-20,175);
line(x-20,175,x-20-l,200);
line(x-20,175,x-20+l,200);
line(x-20,140,x,150);
line(x-20,140,x-20-h,160);


for(i=0;i<620;i+=20)
{
rain(i,c,i,200);
}
c++;
if(c==0)
c=-100;
setcolor(0);
delay(50);
ellipse(x,100,0,180,50,30);
line(x-50,100,x+50,100);
line(x,100,x,150);
circle(x-20,115,15);
line(x-20,130,x-20,175);
line(x-20,175,x-20-l,200);
line(x-20,175,x-20+l,200);
line(x-20,140,x,150);
line(x-20,140,x-20-h,160);

line(x+50,100,x+50,200);
x++;
l--;
if(l==-15)
l=15;
if(ht==1)
h++;
else h--;

if(h==15)
ht=0;
else if(h==-15)
ht=1;

}
if(getch()==' ')
{
while(!kbhit());
getch();
goto cont;
}

}

Fill bucket with water programin C

#include<conio.h>
#include<dos.h>
#include<graphics.h>

void main()
{
int gd=DETECT,gm=DETECT,i,j;
initgraph(&gd,&gm,"");
ellipse(300,200,0,360,50,25);
ellipse(300,300,0,360,50,25);
line(250,200,250,300);
line(350,200,350,300);
ellipse(300,100,180,360,5,2);
line(295,100,295,80);
line(305,100,305,86);
arc(300,80,90,180,5);
putpixel(306,85,15);
putpixel(307,84,15);
line(308,84,630,84);
line(300,75,303,75);
line(314,75,630,75);
putpixel(304,74,15);
putpixel(305,73,15);
line(306,72,306,65);
line(311,72,311,65);
putpixel(312,73,15);
putpixel(313,74,15);
pieslice(309,62,0,360,5);
setfillstyle(SOLID_FILL,BLUE);
setcolor(BLUE);
for(i=0;i<7;i++)
{
line(297+i,103,297+i,300);
}
for(i=1;i<100;i++)
{
setcolor(LIGHTBLUE);
ellipse(300,300-i,180,360,4,2);
delay(30);
fillellipse(300,300-i,49,25);
setcolor(1);
line(297,275-i,303,275-i);
setcolor(15);
ellipse(300,200,180,360,50,25);
delay(50);
}
ellipse(300,200,0,360,50,25);
setcolor(0);
for(i=0;i<7;i++)
line(297+i,103,297+i,174);
getch();
}

Moving wheel program in C


#include<stdio.h>
#include<conio.h>
#include<graphics.h>
#include<math.h>
#include<dos.h>

int l=1;

void ddaline(int x1,int y1,int x2,int y2)
{

int s,dx,dy,m;
float xi,yi,x,y;

dx=x2-x1;
dy=y2-y1;

if(abs(dx)>abs(dy))
s=abs(dx);
else
s=abs(dy);

xi=dx/(float)s;
yi=dy/(float)s;

x=x1;
y=y1;

putpixel(x1+0.5,y1+0.5,15);

for(m=0;m<s;m++)
{
x+=xi;
y+=yi;
putpixel(x+0.5,y+0.5,15);
}
}


void plotpoints1(int x,int y,int cx,int cy)
{
putpixel(cx+x,cy+y,15);
putpixel(cx-x,cy-y,15);
putpixel(cx-y,cy+x,15);
putpixel(cx+y,cy-x,15);
if(l%20==0)
{
ddaline(cx-x,cy-y,cx+x,cy+y);
ddaline(cx-y,cy+x,cx+y,cy-x);
}
l++;
}

void plotpoints2(int x,int y,int cx,int cy)
{

putpixel(cx-x,cy+y,15);
putpixel(cx+x,cy-y,15);
putpixel(cx+y,cy+x,15);
putpixel(cx-y,cy-x,15);
if(l%20==0)
{
ddaline(cx+x,cy-y,cx-x,cy+y);
ddaline(cx-y,cy-x,cx+y,cy+x);
}
l++;
}


void mcircle(int cx,int cy,int r)
{
int x=0,y,p;

y=r;
p=1-r;


while(x<y)
{
plotpoints1(x,y,cx,cy);
x++;
if(p<0)
p+=2*x+1;
else
{
y--;
p+=2*(x-y)+1;
}
}



x=y+1;
while(abs(x)>0)
{
plotpoints2(x,y,cx,cy);
x--;
if(p>=0)
p =p-2*x-1;
else
{
y++;
p=p-2*(x-y)-1;
}
}
}

void main()
{
int gd=DETECT,gm=DETECT;
initgraph(&gd,&gm,"");

int i=0;

while(i<300)
{
cleardevice();
mcircle(100+(i++),200,100);
delay(90);
i++;
}
getch();
}

A program in c for pendulum


#include<graphics.h>
#include<conio.h>
#include<dos.h>
#include<process.h>

int cx=300,cy=100,r=300;
int x=0,y,p;

int path(int dtn)
{
int x1,y1;
setcolor(15);
if(x>=y)
{
return 0;
}
cleardevice();

if(dtn==1)
{
circle(cx+x,cy+y,20);
line(cx,cy,cx+x,cy+y);
}
else
{
circle(cx-x,cy+y,20);
line(cx,cy,cx-x,cy+y);
}
delay(10);
if(kbhit())
exit(0);
x++;
if(p<0)
p+=2*x+1;
else
{
y--;
p+=2*(x-y)+1;
}
x1=x;
y1=y;
path(dtn);

cleardevice();
if(dtn==1)
{
circle(cx+x1,cy+y1,20);
line(cx,cy,cx+x1,cy+y1);
}
else
{
circle(cx-x1,cy+y1,20);
line(cx,cy,cx-x1,cy+y1);
}
delay(10);
if(kbhit())
exit(0);
}



void main()
{
int gd=DETECT,gm=DETECT;
initgraph(&gd,&gm,"");
cleardevice();
putpixel(300,100,4);
while(1)
{
x=0;
y=r;
p=1-r;
path(1);
x=0;
y=r;
p=1-r;
path(0);
}
getch();
}