Posts

Showing posts with the label Operating Systems

Optimal Page Replacement > Java Program

Optimal Page Replacement > Java Program   Operating Systems Program: import java.util.*; class PR3 {

Producer Consumer Problem > Java Program

Producer Consumer Problem > Java Program Operating Systems import java.util.Vector; public class S3 {

Bankers Algorithm (Resource and Safety Algoritm) > Java Program

Bankers Algorithm (Resource and Safety Algoritm) > Java Program Operating Systems Program:

Producer Consumer Problem with Wait and Notify > Java Program

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;

To use fork() to get the Parent and Child Process ID > C Program

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;

I/O System Calls > C Program

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();

Linux Networking > Terminal Commands 1

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.

Round Robin Scheduling Algorithm > Java Program

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. 

First Come First Serve (FCFS) Scheduling Algorithm > Java Program

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[]; 

Bankers Algorithm > Java Program

Operating Systems Bankers Algorithm (Safety Algorithm) > Java Program import java.util.Scanner; public class bankers1{     private int need[][],allocate[][],max[][],avail[][],np,nr;

Dining Philosophers Problem > Java Program

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 {

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 {