Posts

Showing posts with the label Computer Organization and Architecture

Full Adder > Java Program

Full Adder > Java Program Computer Organization and Architecture import java.util.*; class FULLADDER { public static void main(String args[]) { int a[],b[]; Scanner sc=new Scanner(System.in); System.out.println(“ENTER NUMBER OF BITS : “); int n=sc.nextInt(); a=new int[n]; b=new int[n];

Binary Division using Non Restoring Algorithm > Java Program

Binary Division using Non Restoring Algorithm Computer Organization and Architecture import java.io.*; class NONRESTORING { public static int[] lshift(int s1[],int s2) { int s[]=new int [4]; for(int i=0;i<3;i++) { s[i]=s1[i+1]; } s[3]=s2; return(s); }

Binary Division using Restoring Algorithm > Java Program

Binary Division using Restoring Algorithm > Java Program Computer Organization and Architecture import java.util.*; class RESTORING { public static void lshift(int a[],int q[]) {

Booth's Algorithm > Java Program

Booth's Algorithm > Java Program Computer Organization and Architecture import java.util.*; class BOOTH { public static int[] add(int a[],int m1[]) { int carry=0; int sum[]=new int [4];

Least Recently Used (LRU) Page Replacement Algorithm > Java Program

Computer Organization and Architecture Least Recently Used (LRU) Page Replacement Algorithm > Java Program In Least Recently Used (LRU) page replacement algorithm we use the recent past as an approximation of the near future,then we will replace the pagethat has not been used for the longest period of time. In Least Recently Used (LRU) page replacement algorithm is associated with the each page the time of that page's last use.When a page must be replaced,In Least Recently Used (LRU) page replacement algorithm chooses that page has not been used for longest period of time.The In Least Recently Used (LRU) page replacement algorithm Policy is often used as page replacement algorithm and is consider to be good.The major problem is how to implement In Least Recently Used (LRU) page replacement algorithm.An In Least Recently Used (LRU) page replacement algorithm may require substantial hardware assistance.  import java.util.*; class LRU { public static void main(String ...

First In First Out (FIFO) Page Replacement > Java Program

Computer Organization and Architecture First In First Out (FIFO) Page Replacement > Java Program The Simplest page replacement algorithm is First In First Out (FIFO) .A First In First Out (FIFO) replacement algorithm associated with each page the time when that page was brought into memory.When a page must be replaced ,the oldest page is chosen.We can create First In First Out (FIFO) queue to hold all pages in memory.The First In First Out (FIFO) page replacement algorithm is easy to understand and program. import java.io.*; class FIFO {         public static void main(String args[]) throws IOException         {                                  int n;                 int f;

Next Fit > Java Program

Computer Organization and Architecture Next Fit > Java Program import java.io.*;  class NFit  {  public static void main(String args[]) throws IOException  {         

Shortest Job First (SJF) Scheduling Non - Preemptive > Java Program

Computer Organization and Architecture Shortest Job First (SJF) Scheduling > Java Program /* A different approach to CPU scheduling is Shortest job first(sjf) scheduling algorithm.This associates with each process the length of the latter next CPU burst.When the CPU is available it is assigned to the process that has the smallest next CPU burst.if two processes have same length next CPU burst,FCFS scheduling is used to break the tie.Note that a more appropriate term would be the shortest next CPU burst ,because the scheduling is done by examining the length of the next CPU burst because the scheduling is done by examining the length of the next CPU burst of a process,rather than its total length.The real difficulty in Shortest job first(sjf) scheduling algorithm is knowing the length of the next process.Shortest job first(sjf) scheduling algorithm is provably optimal.in that it gives the minimum average waiting time for a given set of processes. */

Best Fit Algorithm > Java Programs

Computer Organization and Architecture Best Fit Algorithm > Java Programs import java.io.*; class best { public static void main(String args[])throws IOException {

First Fit Algorithm > Java Program

Computer Organization and Architecture First Fit Algorithm > Java Program import java.io.*; class firstfit  {  public static void main(String args[])throws IOException {

Implement Multiplication of two unsigned n-bit binary numbers with shift and add method. > Java Program

Computer Organization and Architecture A Java Program for Implement Multiplication of two unsigned n-bit binary numbers with shift and add method. The numbers are taken as input from the user in decimal form and must be converted from decimal to binary form as required. The final answer should be shown to the user in both decimal and binary form. import java.util.*; //Importing all classes of Util Package public class BitMultiply //Creating a class named BitMultiply  {