Sunday 29 October 2017

Implementation of data hazards in 8086 using java program (MP)

import java.util.*;
class datahazard
{
static void accept()
{
Scanner scr=new Scanner(System.in);
System.out.print("\nFirst Instruction:\nOpcode ");
s[0][0]=scr.nextLine();
System.out.print("\nDomain: ");
s[0][2]=scr.nextLine();
System.out.print("\nRange: ");
s[0][1]=scr.nextLine();
System.out.print("\nSecond Instruction:\nOpcode ");
s[1][0]=scr.nextLine();
System.out.print("\nDomain: ");
s[1][2]=scr.nextLine();
System.out.print("\nRange: ");
s[1][1]=scr.nextLine();
}
static int check()
{
if(s[0][1].equals(s[1][2]))
return 1;
else
if(s[0][2].equals(s[1][1]))
return 2;
else
if(s[0][1].equals(s[1][1]))
return 3;
else
return 0;
}
static String s[][]=new String[2][3];
public static void main(String args[])
{
Scanner scr=new Scanner(System.in);
int ch=0;
do
{
int c=0;
accept();

System.out.println(s[0][0]+" "+s[0][1]+" "+s[0][2]);
System.out.println(s[1][0]+" "+s[1][1]+" "+s[1][2]);
c=check();
if(c==1)
System.out.println("RAW hazard exists");
else
if(c==2)
System.out.println("WAR hazard exists");
else
if(c==3)
System.out.println("WAW hazard exists");
else
System.out.println("There are No Data Dependency Hazards");
System.out.println("Do you wish to continue?(1/0)");
ch=scr.nextInt();
}
while(ch==1);
}
}

Output:

D:\Extras>javac datahazard.java

D:\Extras>java datahazard

First Instruction:
Opcode mul

Domain: r2

Range: r1

Second Instruction:
Opcode add

Domain: r4

Range: r1
mul r1 r2
add r1 r4
WAW hazard exists
Do you wish to continue?(1/0)
1

First Instruction:
Opcode mov

Domain: r2

Range: m2

Second Instruction:
Opcode mov

Domain: r1

Range: m1
mov m2 r2
mov m1 r1
There are No Data Dependency Hazards
Do you wish to continue?(1/0)
0

D:\Extras>

Implementation of BIOS interrupt in 8086 using ALP (MP)

data segment
CR equ 0dh          ;start of the cursor
LF equ 0ah           ;cursor will go to next line
lgn_msg db CR,LF,'Enter a Number between 0-9',CR,LF,'$'
data ends
code segment
assume cs:code, ds:data
start:
mov ax,data
mov ds,ax
mov dx,offset lgn_msg
mov ah,09h          ;for displaying message on screen
int 21h
mov ah,01h          ;for accepting user input from keyboard
int 21h
cmp al,39h           ;to check whether number in range of 0 to 9
ja exit
sub al,30h            ;to convert hexadecimal to decimal
mov ah,00h
mov cx,ax
mov ax,0001h
mov bx,0001h
up: mul bx
inc bx
dec cx
jnz up
exit:
int 03h
code ends
end start

TRANSFER DATA FROM DATA SEGMENT TO EXTRA SEGMENT USING ALP 2ND METHOD (MP)

data segment
arr1 dw 1111h,2222h,3333h,4444h
data ends

extra segment
arr2 dw 05 dup(?)
extra ends
  
code segment
assume cs:code, ds:data, es:extra
start:
mov ax,data
mov ds,ax

mov ax,extra
mov es,ax

lea si,arr1
lea di,arr2
mov cx,04

up:
lodsw
stosw
loop up

int 03h
code ends

end start

TRANSFER DATA FROM DATA SEGMENT TO EXTRA SEGMENT USING ALP (MP)

data segment
arr1 dw 1111h,2222h,3333h,4444h
data ends

extra segment
arr2 dw 05 dup(?)
extra ends

code segment
assume cs:code,ds:data,es:extra
start:
mov ax,data
mov ds,ax
mov ax,extra
mov es,ax
lea si,arr1
lea di,arr2
mov cx,04

up:
mov ax,[si]
mov es:[di],ax
inc si
inc si
inc di
inc di
loop up

int 03h
code ends

end start

Saturday 28 October 2017

Hospital Management System - Project Proposal

Hospital Management System - Project Proposal Complete Document

Goto: Scribd


Hospital Management System - System Requirement Specification (SRS)

Hospital Management System - System Requirement Specification (SRS) Complete Document

Goto: Scribd


Student Management System - System Requirement Specification (SRS)

Student Management System - System Requirement Specification (SRS) Complete Document
Goto: Scribd


sstf.java (OS)

import java.util.Scanner;

public class sstf
{
public static void main(String[] args)
{
int b[]=new int[20];
int a[]=new int[20],d,n,i,j,temp,s,k=0,x=0,t=0;
Scanner sc= new Scanner(System.in);
System.out.println("Enter head pointer position:");
a[0]= sc.nextInt();
System.out.println("\nEnter number of processes:");
n= sc.nextInt();
System.out.println("\nEnter processes in request order");
for(i=1;i<=n;i++)
{
a[i]=sc.nextInt();
}
b[k++]=a[0];
for(i=0;i<n;i++)
{
s=1000;
for(j=i+1;j<=n;j++)
{
if(a[i]>a[j])
d=a[i]-a[j];
else
d=a[j]-a[i];
if(d<s)
{
s=d;
x=j;
}
}
t+=s;
temp=a[i+1];
a[i+1]=a[x];
a[x]=temp;
b[k++]=a[i+1];
}
System.out.println("\nProcessing order:");
for(i=1;i<=n;i++)
System.out.print("\t"+b[i]);
System.out.println("\nTotal Head Movement:"+t);
}
}

Output:

Enter head pointer position:
50

Enter number of processes:
5

Enter processes in request order
75
82
61
10
26

Processing order:
        61      75      82      26      10
Total Head Movement:104