Producer Consumer Problem with WAIT and NOTIFY > Java Program O perating Systems Program: import java.util.Vector; import java.util.logging.Level; import java.util.logging.Logger;
Computer Networks To find Subnet Mask and Network ID for given IP Address > Java Program import java.io.*; import java.net.InetAddress; public class subnet { public static void main(String[] args) throws IOException { System.out.println("ENTER IP:"); BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String ip = br.readLine(); String checkclass = ip.substring(0, 3);
Operating Systems Program using fork() to get the Parent and Child Process ID #include<stdio.h> #include<string.h> #include<fcntl.h> #include<sys/stat.h> #include<sys/types.h> int main() { int pid, p1, c;
Operating Systems I/O System Calls > C Programs Program 1 #include<stdio.h> #include<stdlib.h> #include<sys/types.h> #include<sys/stat.h> #include<unistd.h> #include<errno.h> int main(int argc,char*argv[]) { pid_t pid; pid=fork();
Operating Systems Linux Networking > Terminal Commands [root@localhost ~]# mkdir PRATHAMESH [root@localhost ~]# cd PRATHAMESH [root@localhost PRATHAMESH]# cd .. [root@localhost ~]# vi LMN [root@localhost ~]# cat LMN This is the new file to demonstrate the vi command. we are operating Linux Red Hat.
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 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 Computer Organization and Architecture import java.util.*; class RESTORING { public static void lshift(int a[],int q[]) {
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];
Insertion Sort > Java Program import java.io.DataInputStream; class InsertionSort { public static void main(String args[ ]) { int i,n=0; int x[]=new int[25];
Computer Networks Hamming Code Generation for Error Detection and Correction > Java Program import java.util.*; class hamming { public static void main(String args[]) {
Operating Systems Round Robin Scheduling Algorithm > Java Program Round robin Scheduling algorithm (RR) is designed especially for time sharing system.It is similar to FCFS scheduling,but preempted is added to switch between processes.A small unit of time called a time quantum is defined.a time quantum is generally from 10 to 100 milliseconds.The CPU scheduler goes around the ready queue ,allocating the CPU to each process for a time interval of up to 1 time quantum.
Operating Systems First Come First Serve (FCFS) Scheduling Algorithm > Java Program First come first serve (FCFS) scheduling algorithm with this schema the process that request the CPU First is allocated the CPU first.the Implementation of the First come first serve (FCFS) policy is easily managed with fifo queue.when a process enters into the ready queue ,its PCB is linked onto the tail of the queue.when the CPU is free it is allocated to the process at the head of the queue.the running process is then removed from the queue.the code for First come first serve (FCFS) scheduling is simple to write and Understand.The First come first serve (FCFS) sheduling algorithm in non preemptive.The First come first serve (FCFS) algorithm is particularly troublesome for time sharing system. import java.io.*; class fcfs { public static void main(String args[]) throws Exception { int n,AT[],BT[],WT[],TAT[];
Operating Systems Bankers Algorithm (Safety Algorithm) > Java Program import java.util.Scanner; public class bankers1{ private int need[][],allocate[][],max[][],avail[][],np,nr;
Operating Systems Dining Philosophers Problem > Java Program Dining Philosophers Problem: Consider five philosophers who spend time in thinking and eating.the philosophers share a common circular table surrounded by five chairs,each belonging to one philosopher.In the center of the table is a bowl of rice and the table is laid with five single chopsticks.when a philosopher thinks she does not interacts with her colleagues.From time to time philosopher gets hungry and tries to pick up the two chopsticks that are between her left and right philosopher. philosopher may pick up only one chopstick at a time.Obviously,she cannot pick chopstick in hand of neighbor.When hungry philosopher has both her chopstick at the same time she eats without releasing her chopstick.When she is finished eating she puts down chopstick and start thinking. import java.io.*; class Philo {
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 ...
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;
Theoretical Computer Science Turing Machine Program (Equal Number of 0's and 1's) > Java Program import java.io.*; import java.lang.*; class turing_machine {
System Security Convert Channel > Java Program Covert Channel is type of computer security attack that transfers information in a way that violates a security policy.Covert channel have been defined by Lampson in 1973 as a communication channel not designed for any kind of information transfer.There are different types of covert channels such as storage Channel ,Timing Channel,Termination Channel,Resource Channel,Power Channel.A covert channel is so called because it is hidden from the access control mechanisms of ultra-high-assurance secure operating systems
System Security CAPTCHA > Java Applet Program CAPTCHA is challenge response test most often placed within form to determine that the user is a human being and not a machine. CAPTCHA is a form of access control.A CAPTCHA images shows a random string which user has to type to submit a form. CAPTCHA generates and grades the test that human can pass but current computer program cannot.since computers are assumed to be unable to solve CAPTCHA,any user entering a correct format is presumed to be human. CAPTCHA are mainly used by websites that offers services like online polls and registration forms.
System Security Caesar Cipher > Java Program In cryptography Caesar cipher is one of the simple and most widely used Encryption algorithm.Caesar cipher is special case of shift cipher.Caesar cipher is substitution cipher where letter in plain text is replaced by some other letter.If shift is 3 then A letter is replaced by D,B is replaced by E and so on. import java.io.*; import java.lang.*; class CaesarCipher {
System Security RC4 Encryption Algorithm > Java Program In cryptography is most widely used software stream cipher and is used popular protocols such as secure socket layer(SSL) and wep. RC4 has variable length key. RC4 is developed by Ronald Rivest which require secure exchange of shared key..RC4 algorithm operates in OFB (output feedback mode) ,where block cipher is implemented as stream cipher.RC4 generates pseudo-random stream of bits.In RC4 algorithm key stream is completely independent of plain text. import java.io.*; class rc4 {
System Security RSA Algorithm > Java Program RSA is a public key encryption algorithm and the name RSA derived from it's investors Rivest,Shamir,Adleman.RSA works on the principle that says it is too difficult to find the factor of large prime numbers. import java.io.*; import java.math.*; class rsa { public static void main(String args[])throws IOException {
System Security Intrusion Detection System (IDS) > Java Program Intrusion Detection System-IDS is a device that provides early warning of an intrusion so that defensive action can be taken to prevent or minimize damage.Intrusion Detection System-IDS detects unusual pattern of activity which may be malicious or suspicious.Intrusion Detection System-IDS consist of counter measure response unit.Event database,Event generator,event analyzer.Intrusion Detection System-IDS is responsible for monitoring and analyzing both user and system activities,Tracking user policy violations etc. import java.io.*; import java.util.*; class IDS
Analysis of Algorithm Hamiltonian Cycle > Java Program import java.io.*; public class Hamiltonian { static boolean found = false; public static void main(String args[]) throws IOException {
Computer Organization and Architecture Next Fit > Java Program import java.io.*; class NFit { public static void main(String args[]) throws IOException {
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. */
Computer Organization and Architecture Best Fit Algorithm > Java Programs import java.io.*; class best { public static void main(String args[])throws IOException {
Computer Organization and Architecture First Fit Algorithm > Java Program import java.io.*; class firstfit { public static void main(String args[])throws IOException {
Computer Graphics 2D Transformations > C Program #include<stdio.h> #include<conio.h> #include<graphics.h> #include<math.h> int x1,x2,x3,y1,y2,y3,x11,x22,x33,y11,y22,y33,xc,yc,xmax,ymax;
To implement NQueen Problem > C Program Analysis of Algorithm, Artificial Intelligence Program: #include<stdio.h> #include<conio.h> #include<stdlib.h> #include<math.h> int *x; int place(int k,int i) {
Analysis of Algorithm Finding Longest Common Sub-sequence > C Program #include<stdio.h> #include<conio.h> #include<string.h> char b[20][20]; int c[20][20]; int m,n; void lcs(char x[],char y[]) {
Analysis of Algorithm All Pair Shortest Path Algorithm > C Program #include<stdio.h> #include<conio.h> int cost[10][10],a[10][10],i,k,j,c; int min(int a,int b) {
Applied Mathematics E(X) AND V(X) AND MOMENTS OF PROBABILITY DISTRIBUTION FUNCTION> Scilab X=[0 1 2 3 4] PX=[0.41 0.41 0.15 0.02 0.01] EX=0,VX=0,M1=0,M2=0,M3=0,M4=0,s1=0,s2=0,s3=0; for(i=1:5)
Analysis of Algorithm Minimum And Maximum using divide and conquer #include<stdio.h> #include<conio.h> void minmax(int i,int j,int *min, int *max); int a[20]; void minmax(int i,int j,int *min, int *max) {
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 {