AL3452 OS Lab Manual
AL3452 OS Lab Manual
Aim:
To install Windows/Linux Operating System
INTRODUCTION:
Each version of Microsoft Windows is installed on a computer using similar steps. While there are
stepsintheinstallationprocessthatdifferbetweenversionsofWindows,thefollowing generalsteps and
guidelines help you install Windows on your computer. The steps below are for all recent versions of
Windows, including Windows98,WindowsME,Windows2000,WindowsXP, Windows Vista,Windows
7,Windows 8,Windows10,and Windows 11. These steps even work for earlier versions (e.g., Windows
95) as long as you use the disc version. The floppy diskette version is similar, but it requires additional
steps.
HOWTOENTERANDEXITTHEBIOSORCMOSSETUP
Every computer provides a way to enter the BIOS or CMOS setup, which lets you configure some basic
settings for your computer and its hardware components.
Below is a list of common methods for accessing and exiting your computer's BIOS or CMOS setup and
recommendations if you're having trouble.
ACCESS BIOSORCMOSONNEWERCOMPUTERS:
Computers manufactured in the last few years allow you to enter the BIOS or CMOS setup by pressing
one of the five keys listed below during the boot process.
HOW TO EXIT THE BIOS OR CMOS:
There are several ways to exit the BIOS or CMOS setup depending on the computer's type. The most
common methods include the following.
Press the Esc key to exit without saving any changes.
Press the F10 or F12 key to save changes and exit.
Access the Exit or Save & Exit tab in setup and select the Exit or Save and Exit option.
If you have trouble exiting the BIOS or CMOS setup, you can try the following methods to fix the problem.
Press the F9 key to load default settings and press F10 to save and exit.
Access the Exit or Save& Exit tab in setup, select the Load Optimized Defaults option, select Yes,
and press Enter. Any changes made are reverted, and the BIOS or CMOS is set back to default
settings.
Turn off the computer(use only as a last resort and with caution).
LONG-TERMMAINTENANCEOFWINDOWS
Microsoft frequently releases new updates for Windows, so were commend you check for and install
available updates. Doing so helps keep Windows running better and keep your computer protected.
Also, periodically check for updated hardware device drivers from manufacturers' websites. Keeping
hardware drivers updated helps the hardware devices in the computer run at peak performance and
improves compatibility with other computer hardware and software.
How to install Linux?
If you want to install Linux, there are two ways to do that:
The first way is to download the Linux distribution you want and burn it into a DVD or USB stick and
boot your machine with it and complete the installation process.
The second way is to install it virtually on a virtual machine like VirtualBox or VMware without touching
your Windows or Mac system, so your Linux system will be contained in a window you can minimize and
continue working on your real system.
For me, I prefer VirtualBox, it’s free and runs very fast on my PC than VMware, and supports installing
Windows, Linux, and Mac OS with all versions.
Let’s choose any Linux distro and install it using both two ways.
I’m going to choose Linux mint; they call it the Mac OS of Linux. It is a good distro for personal use.
The version we are going to install is 18.1 “Serena” at the time of writing that article.
Go to this link and download it:
https://www.linuxmint.com/download.php
I prefer the Cinnamon desktop version; it is promising and elegant.
Once you download the ISO file, you will have to burn it on DVD or the easy way, copying it on a USB
stick using a program called Universal USB installer, you can download this program from this link:
https://www.pendrivelinux.com/universal-usb-installer-easy-as-1-2-3/
After downloading the application, open it and choose from the list the distro you want to install; in our
case, we will select Linux mint.
Make sure that you put your memory stick on the computer and click next and wait till the copying process
is finished.
how to install Linux using USB
Then Restart your PC and go to BIOS settings and select boot options and make sure that the USB is
the first option, then save your BIOS settings and reboot.
Then it will show the installation screen, press Enter, and it will load the live CD content.
If you are installing it on a new disk, choose the option Erase disk.
Linux requires two partitions to work, the root partition and the swap partition.
Now we will create them by clicking the plus button and choose about 12 GB or more as you need but
not less than that for the root partition and choose mount type as / which stands for root and of course
format will be Ext4.
Now we create a swap partition, choose the remaining free space and click the plus button and choose
the swap area as shown:
Now you choose the time zone and click continue the choose the language:
Now you write your username and password and click continue:
Result:
Thus the operating system was installed successfully.
Ex.No:2a INTRODUCTION TO UNIX
UNIX:
It is a multi-user operating system. Developed at AT & T Bell Industries, USA in 1969.
Ken Thomson along with Dennis Ritchie developed it from MULTICS (Multiplexed
Information and Computing Service) OS.
By1980, UNIX had been completely rewritten using C language.
LINUX:
It is similar to UNIX, which is created by Linus Torualds. All UNIX commands works in
Linux. Linux is a open source software. The main feature of Linux is coexisting with other OS such
as windows and UNIX.
STRUCTUREOFALINUXSYSTEM:
It consists of three parts.
a) UNIX kernel
b) Shells
c) Tools and Applications
UNIXKERNEL:
Kernel is the core of the UNIX OS. It controls all tasks, schedule all Processes and carries out all the
functions of OS.
Decides when one programs tops and another starts.
SHELL:
Shell is the command interpreter in the UNIX OS. It accepts command from the user and analyses and
interprets them
Ex.No:2b BASIC UNIX COMMANDS
AIM:
To study of Basic UNIX Commands and various UNIX editors such as
vi, ed, ex and EMACS.
CONTENT:
Note: Syn->Syntax
FILEMANIPULATIONCOMMANDS
a) cat–this create, view and concatenate files.
Creation:
Syn:$cat>filename
Viewing:
Syn:$cat filename
Add text to an existing file:
Syn:$cat>>filename
Concatenate:
Syn:$catfile1file2>file3
$catfile1file2>>file3 (no over writing of file3)
b) grep–used to search a particular word or pattern related to that word from the file.
Syn:$grep search word filename
Eg:$grep anu student
Examples:
$chmodu-wx student
Removes write and execute permission for users
$ch modu+rw,g+rwstudent
Assigns read and write permission for users and groups
$chmodg=rwx student
Assigns absolute permission for groups of all read, write and execute permissions
k) wc–it counts the number of lines, words, character in a specified file(s)
with the options as–l,-w,-c
Syn: $wc–lfilename
$wc–wfilename
$wc–cfilename
Ex.no:2c UNIX EDITORS
AIM:
To study of various UNIX editors such as vi, ed, ex and EMACS.
CONCEPT:
Editor is a program that allows user to see a portions a file on the screen and modify
characters and lines by simply typing at the current position. UNIX supports variety of Editors. They
are:
ed ex vi
EMACS
Vi- vi is stands for “visual”.vi is the most important and powerful editor.vi is a full screen editor that
allows user to view and edit entire document at the same time.vi editor was written in the University
of California, at Berkley by Bill Joy, who is one of the co-founder of Sun Microsystems.
Features of vi:
It is easy to learn and has more powerful features.
Itworksgreatspeedandiscasesensitive.vihaspowerfulundofunctionsandhas3modes:
1. Command mode
2. Insert mode
3. Escape or ex mode
In command mode, no text is displayed on the screen.
In Insert mode, it permits user to edit insert or replace text.
In escape mode, it displays commands at command line.
Moving the cursor with the help of h, l, k, j, I, etc
EMACS Editor
Motion Commands:
M-> Move to end of file
M-< Move to beginning of file
C-v Move forward a screen M –v Move
backward a screen C –n Move to next line
C-p Move to previous line
C-a Move to the beginning of the line
C-e Move to the end of the line
C-f Move forward a character
C-b Move backward a character
M-f Move forward a word
M-b Move backward a word
Deletion Commands:
DEL delete the previous character C -d delete the
current character M -DEL delete the previous word
M-d delete the next word
C-x DEL deletes the previous sentence
M-k delete the rest of the current sentence
C-k deletes the rest of the current line
C-xu undo the lasted it change
Search and Replace in EMACS:
y Change the occurrence of the pattern
n Don’t change the occurrence, but look for the other q Don’t change. Leave query replace
completely
! Change this occurrence and all others in the file
RESULT:
Thus the various concepts such as basic commands and UNIX editors such as vi, ed, ex and
EMACS were studied.
Ex.no:2d SIMPLE SHELL PROGRAMS
AIM:
To write simple shell programs by using conditional, branching and looping statements.
ALGORITHM:
PROGRAM:
OUTPUT
[nehru@localhost shellexam]$ sh oddeven
Enter the Number
35
35 is Odd number
[nehru@localhost shellexam]$ sh oddeven
Enter the Number
42
42 is Even number
2. Write a Shell program to check the given year is leap year or not
ALGORITHM:
PROGRAM:
OUTPUT
[nehru@localhost shellexam]$ sh leapyear
Enter the year
2000
2000 is a leap year
[nehru@localhost shellexam]$ sh leapyear
Enter the year
2010
2010 is not a leap year
ALGORITHM:
PROGRAM:
OUTPUT
[nehru@localhost shellexam]$ sh factorial
Enter a Number
6
The Factorial of the given Number is 720
ALGORITHM:
OUTPUT
[nehru@localhost shellexam]$ sh swaptemp
Enter Two Numbers
22 33
after swapping
33 22
RESULT:
Thus the shell programs written using testing and loops were executed successfully.
Ex.No.3: IMPLEMENTATION OF FORK, EXEC, GETPID, EXIT, WAIT,
AND CLOSE SYSTEM CALLS.
AIM:
To write a program for implementing process management using the following
system calls of UNIX operating system: fork, exec, getpid, exit, wait, close.
ALGORITHM:
Step1: Start the program.
Step2: Read the input from the command line.
Use fork() system call to create process, getppid() system call used to get the
parent process ID and getpid() system call used to get the current process ID
execvp() system call used to execute that command given on that command line
argument execlp() system call used to execute specified command.
Step3: Open the directory at specified in command line input.
Step4: Display the directory contents.
Step5: Stop the program.
PROGRAM:
#include<stdio.h> main(int arc,char*ar[])
{
int pid; char s[100]; pid=fork();
if(pid<0)
printf("error"); else
if(pid>0)
{
wait(NULL);
printf(“\nchild process:”);
printf(“\n\tchild parent id:\t%d”,getppid());
printf(s,”\n\tchild process id:\t%d”,getpid());
write(1,s,strlen(s));
printf(" ");
printf(" ");
printf(" ");
execvp(ar[2],&ar[2]);
error("can’t execute%s",ar[2]);
}}
OUTPUT:
[root@localhost ~]# ./a.out tst date Child process:
Child process id :
Parent Process:
RESULT:
Thus the program for process management was written and successfully
executed.
Ex. No: 4a CPU SCHEDULING - PRIORITY
AIM:
To write a C program for implementation of Priority scheduling algorithms
ALGORITHM:
PROGRAM:
//PRIORITY SCHEDULING:
#include<stdio.h>
#include<stdio.h>
#include<stdlib.h>
typedef struct
{
int pno;
int pri;
int pri;
int btime;
int wtime;
}sp;
int main()
{
int i,j,n;
int tbm=0,totwtime=0,totttime=0;
sp *p,t;
printf("\n PRIORITY SCHEDULING.\n");
printf("\n enter the no of process ... \n");
scanf("%d",&n);
p=(sp*)malloc(sizeof(sp));
printf("enter the burst time and priority:\n");
for(i=0;i<n;i++)
{
printf("process%d:”,i+1);
scanf("%d%d",&p[i].btime,&p[i].pri);
p[i].pno=i+1;
p[i].wtime=0;
}
for(i=0;i<n-1;i++)
for(j=i+1;j<n;j++)
{
if(p[i].pri>p[j].pri)
{
t=p[i];
p[i]=p[j];
p[j]=t;
}
}
printf("\n process\tbursttime\twaiting time\tturnaround time\n");
for(i=0;i<n;i++)
{
totwtime+=p[i].wtime=tbm;
tbm+=p[i].btime;
printf("\n%d\t\t%d",p[i].pno,p[i].btime);
printf("\t\t%d\t\t%d",p[i].wtime,p[i].wtime+p[i].btime);
}
totttime=tbm+totwtime;
printf("\n total waiting time:%d",totwtime);
printf("\n average waiting time:%f",(float)totwtime/n);
printf("\n total turnaround time:%d",totttime);
printf("\n avg turnaround time:%f",(float)totttime/n);
}
OUTPUT:
PRIORITY SCHEDULING.
enter the no of process....
3
enter the burst time and priority:
process1:10 2
process2:5 3
process3:2 1
3 2 0 2
1 10 2 12
2 5 12 17
Total waiting time:14
Average waiting time:4.666667
Total turnaround time:31
Avg turnaround time:10.333333
RESULT:
Thus the implementation of priority scheduling algorithms was executed successfully.
Ex. No: 4b CPU SCHEDULING - ROUND ROBIN SCHEDULING
AIM:
To write a C program for the implementation of Round Robin scheduling algorithms
ALGORITHM:
PROGRAM:
#include<stdio.h>
#include<stdlib.h>
struct rr
{
int pno,btime,sbtime,wtime,lst;
}p[10];
int main()
{
int pp=-1,ts,flag,count,ptm=0,i,n,twt=0,totttime=0;
printf("\n round robin scheduling. ..........");
printf("enter no of processes:");
scanf("%d",&n);
printf("enter the time slice:");
scanf("%d",&ts);
printf("enter the burst time");
for(i=0;i<n;i++)
{
printf("\n process%d\t",i+1);
scanf("%d",&p[i].btime);
p[i].wtime=p[i].lst=0;
p[i].pno=i+1;
p[i].sbtime=p[i].btime;
}
printf("scheduling.... \n");
do
{
flag=0;
for(i=0;i<n;i++)
{
count=p[i].btime;
if(count>0)
{
flag=-1;
count=(count>=ts)?ts:count;
printf("\n process %d",p[i].pno);
printf("from%d",ptm);
ptm+=count;
printf("to%d",ptm);
p[i].btime-=count;
if(pp!=i)
{
pp=i;
p[i].wtime+=ptm-p[i].lst-count;
p[i].lst=ptm;
}
}
OUTPUT:
RESULT:
Thus the implementation of round robin scheduling algorithms was executed
successfully.
Ex. No: 4c CPU SCHEDULING - FCFS
AIM:
To write a C program for the implementation of FCFS scheduling algorithms
ALGORITHM:
PROGRAM:
#include<stdio.h>
#include<stdlib.h>
struct fcfs
{
int pid;
int btime;
int wtime;
int ttime;
}
p[10];
int main()
{
int i,n;
int towtwtime=0,totttime=0;
printf("\n fcfs scheduling...\n");
printf("enter the no of process");
scanf("%d",&n);
for(i=0;i<n;i++)
{
p[i].pid=1;
printf("\n burst time of the process”);
scanf("%d",&p[i].btime);
}
p[0].wtime=0;
p[0].ttime=p[0].btime;
totttime+=p[i].ttime;
for(i=0;i<n;i++)
{
p[i].wtime=p[i-1].wtime+p[i-1].btim
p[i].ttime=p[i].wtime+p[i].btime;
totttime+=p[i].ttime;
towtwtime+=p[i].wtime;
}
for(i=0;i<n;i++)
{{
printf("\n waiting time for process”);
printf("\n turn around time for process”);
printf("\n");
}}
printf("\n total waiting time :%d", totwtime );
printf("\n average waiting time :%f",(float)totwtime/n);
printf("\n total turn around time :%d",totttime);
printf("\n average turn around time: :%f",(float)totttime/n);
}
OUTPUT:
FCFS SCHEDULING...
enter the no of process5
burst time of the process 1 4
burst time of the process 2 2
burst time of the process 3 1
burst time of the process 4 0
burst time of the process 5 5
waiting time for process 1=0
turn around time for process 1=4
waiting time for process 2=4
turn around time for process 2=6
waiting time for process 3=6
turn around time for process 3=7
waiting time for process 4=7
turn around time for process 4=7
waiting time for process 5=7
turn around time for process 5=12
total waiting time:24
average waiting time :4.800000
total turn around time :36
average turn around time :7.200000
RESULT:
Thus the implementation of FCFS scheduling algorithms was executed successfully.
Ex. No: 4d CPU SCHEDULING - SJF SCHEDULING
AIM:
To write a C program for implementation of SJF scheduling algorithms
ALGORITHM:
PROGRAM:
#include<stdio.h>
#include<stdlib.h>
typedef struct
{
int pid;
int btime;
int wtime;
}
sp;
int main()
{
int i,j,n,tbm=0,towtwtime=0,totttime
sp*p,t;
printf("\n sjf schaduling ..\n");
printf("enter the no of processor");
scanf("%d",&n);
p=(sp*)malloc(sizeof(sp));
printf("\n enter the burst time");
for(i=0;i<n;i++)
{
printf("\n process %d\t",i+1);
scanf("%d",&p[i].btime);
p[i].pid=i+1;
p[i].wtime=0;
}
for(i=0;i<n;i++)
for(j=j+1,j<n;j++)
{
if(p[i].btime>p[j].btime)
{
t=p[i];
p[i]=p[j];
p[j]=t;
}}
printf("\n process scheduling\n");
printf("\n process \tburst time \t w
for(i=0;i<n;i++)
{
towtwtime+=p[i].wtime=tbm;
tbm+=p[i].btime;
printf("\n%d\t\t%d",p[i].pid,p[i].bt
printf("\t\t%d\t\t%d",p[i].wtime,p[i
}
totttime=tbm+towtwtime;
printf("\n total waiting time :%d", totwtime );
printf("\n average waiting time :%f",(float)totwtime/n);
printf("\n total turn around time :%d",totttime);
printf("\n average turn around time: :%f",(float)totttime/n);
}
OUTPUT:
SJF SCHEDULING...
enter the no of process:3
burst time of the process 1 10
burst time of the process 2 4
burst time of the process 3 2
waiting time for process 1=0
turn around time for process 1=10
waiting time for process 2=10
turn around time for process 2=14
waiting time for process 3=14
turn around time for process 3=16
total waiting time:24
average waiting time :8.000000
total turn around time :40
average turn around time :13.333333
RESULT:
Thus the implementation of SJF scheduling algorithm was executed successfully.
Ex.No:5 IMPLEMENTATION OF IPC USING SHARED MEMORY
AIM:
To write a c program to implement IPC using shared memory.
ALGORITHM:
#include<stdio.h>
#include<stdlib.h>
#include<unistd.h>
#include<string.h>
#include<sys/ipc.h>
#include<sys/shm.h>
#include<sys/types.h>
#define SEGSIZE 100
int main(int argc, char *argv[ ])
{
int shmid,cntr;
key_t key;
char *segptr;
char buff[]="poooda ..... ";
key=ftok(".",'s');
if((shmid=shmget(key, SEGSIZE, IPC_CREAT | IPC_EXCL | 0666))== -1)
{
if((shmid=shmget(key,SEGSIZE,0))==-1)
{
perror("shmget");
exit(1);
}
}
else
{
printf("Creating a new shared memory seg \n");
printf("SHMID:%d",shmid);
}
system("ipcs –m");
if((segptr=(char*)shmat(shmid,0,0))==(char*)-1)
{
perror("shmat");
exit(1);
}
printf("Writing data to shared memory…\n");
strcpy(segptr,buff);
printf("DONE\n");
printf("Reading data from shared memory…\n");
printf("DATA:-%s\n",segptr);
printf("DONE\n");
printf("Removing shared memory Segment…\n");
if(shmctl(shmid,IPC_RMID,0)== -1)
printf("Can’t Remove Shared memory Segment…\n");
else
printf("Removed Successfully");
}
OUTPUT:
Semaphored arrays
RESULT:
Thus the algorithm to implementation IPC using shared memory was executed
successfully.
Ex.No.:6 Implement mutual exclusion by Semaphores
AIM:
To write a c program for the implementation of mutual exclusion by Semaphores
ALGORITHM:
Step 1: The Semaphore mutex, full & empty are initialized.
Step 2: In the case of producer process
i) Produce an item in to temporary variable.
ii) If there is empty space in the buffer checks the mutex value for enter into the critical section.
iii) If the mutex value is 0, allow the producer to add value in the temporary variable to the
buffer.
Step 3: In the case of consumer process
i) It should wait if the buffer is empty
ii) If there is any item in the buffer check formutex value, if the mutex==0,remove item from
buffer
iii) Signal the mutex value and reducetheemptyvalueby1.
Step 4: Consume the item.
Step 5: Print the result
PROGRAM:
#include<stdio.h>
#include<pthread.h>
typedef struct
{
pthread_mutex_t mutex;
pthread_cond_t condition;
int value;
}semaphore;
void semaphore_init(semaphore* sem,int initial_value){
pthread_mutex_init(&(sem->mutewx),NULL);
pthread_comd_init(&(sem->condition),NULL);
sem->value=initial_value;
}
OUTPUT:
Main thread performing some work
Main thread waiting
Main thread acquired the semaphore
Main thread releasing the semaphore
Thread waiting
Thread acquired the semaphore
Thread releasing the semaphore
RESULT:
Thus the c program to implement mutual exclusion by using semaphores was executed
successfully.
Ex.No :7 IMPLEMENTATION OF BANKERS ALGORITHM FOR DEADLOCK
AVOIDANCE
AIM:
To write a C program to implement banker’s algorithm for deadlock avoidance.
ALGORITHM:
PROGRAM:
#include<stdio.h>
#include<conio.h>
int max[100][100];
int alloc[100][100];
int need[100][100];
int avail[100];
int n,r;
void input();
void show();
void cal();
int main()
{
int i,j;
printf("********** Baner's Algo ************\n");
input();
show();
cal();
getch();
return 0;
}
void input()
{
int i,j;
printf("Enter the no of Processes\t");
scanf("%d",&n);
printf("Enter the no of resources instances\t");
scanf("%d",&r);
printf("Enter the Max Matrix\n");
for(i=0;i<n;i++)
{
for(j=0;j<r;j++)
{
scanf("%d",&max[i][j]);
}}
printf("Enter the Allocation Matrix\n");
for(i=0;i<n;i++)
{
for(j=0;j<r;j++)
{
scanf("%d",&alloc[i][j]);
}}
printf("Enter the available Resources\n");
for(j=0;j<r;j++)
{
scanf("%d",&avail[j]);
}}
void show()
{
int i,j;
printf("Process\t Allocation\t Max\t Available\t");
for(i=0;i<n;i++)
{
printf("\nP%d\t ",i+1);
for(j=0;j<r;j++)
{
printf("%d ",alloc[i][j]);
}
printf("\t");
for(j=0;j<r;j++)
{
printf("%d ",max[i][j]);
}
printf("\t");
if(i==0)
{
for(j=0;j<r;j++)
printf("%d ",avail[j]);
}}}
void cal()
{
int finish[100],temp,need[100][100],flag=1,k,c1=0;
int safe[100];
int i,j;
for(i=0;i<n;i++)
{
finish[i]=0;
}
//find need matrix
for(i=0;i<n;i++)
{
for(j=0;j<r;j++)
{
need[i][j]=max[i][j]-alloc[i][j];
}}
printf("\n");
while(flag)
{
flag=0;
for(i=0;i<n;i++)
{
int c=0;
for(j=0;j<r;j++)
{
if((finish[i]==0)&&(need[i][j]<=avail[j]))
{
c++;
if(c==r)
{
for(k=0;k<r;k++)
{
avail[k]+=alloc[i][j];
finish[i]=1;
flag=1;
}
printf("P%d->",i);
if(finish[i]==1)
{
i=n;
}}}}}}
for(i=0;i<n;i++)
{
if(finish[i]==1)
{
c1++;
}
Else
{printf("P%d->",i);
}}
if(c1==n)
{printf("\n The system is in safe state");
}
Else
{
printf("\n Process are in dead lock");
printf("\n System is in unsafe state");
}}
OUTPUT:
RESULT:
Thus the banker’s algorithm for avoiding deadlock has been implemented successfully.
Ex .No:8 IMPLEMENTATION OF ALGORITHM FOR DEADLOCK DETECTION
AIM:
To write a C program to implement algorithm for deadlock detection.
ALGORITHM:
PROGRAM:
#include<stdio.h>
#include<conio.h>
int max[100][100];
int alloc[100][100];
int need[100][100];
int avail[100];
int n,r;
void input();
void show();
void cal();
int main()
{
int i,j;
printf("********** Deadlock Detection Algo ************\n");
input();
show();
cal();
getch();
return 0;
}
void input()
{int i,j;
printf("Enter the no of Processes\t");
scanf("%d",&n);
printf("Enter the no of resource instances\t");
scanf("%d",&r);
printf("Enter the Max Matrix\n");
for(i=0;i<n;i++)
{for(j=0;j<r;j++)
{
scanf("%d",&max[i][j]);
}}
printf("Enter the Allocation Matrix\n");
for(i=0;i<n;i++)
{for(j=0;j<r;j++)
{
scanf("%d",&alloc[i][j]);
}}
printf("Enter the available Resources\n");
for(j=0;j<r;j++)
{
scanf("%d",&avail[j]);
}}
void show()
{
int i,j;
printf("Process\t Allocation\t Max\t Available\t");
for(i=0;i<n;i++)
{
printf("\nP%d\t ",i+1);
for(j=0;j<r;j++)
{
printf("%d ",alloc[i][j]);
}
printf("\t");
for(j=0;j<r;j++)
{printf("%d ",max[i][j]);
}
printf("\t");
if(i==0)
{
for(j=0;j<r;j++)
printf("%d ",avail[j]);
}}}
void cal()
{ int finish[100],temp,need[100][100],flag=1,k,c1=0;
int dead[100];
int safe[100];
int i,j;
for(i=0;i<n;i++)
{finish[i]=0;
}
//find need matrix
for(i=0;i<n;i++)
{for(j=0;j<r;j++)
{
need[i][j]=max[i][j]-alloc[i][j];
}}
while(flag)
{flag=0;
for(i=0;i<n;i++)
{int c=0;
for(j=0;j<r;j++)
{if((finish[i]==0)&&(need[i][j]<=avail[j]))
{c++;
if(c==r)
{
for(k=0;k<r;k++)
{avail[k]+=alloc[i][j];
finish[i]=1;
flag=1;
}//printf("\nP%d",i);
if(finish[i]==1)
{i=n;
}}}}}}
j=0;
flag=0;
for(i=0;i<n;i++)
{
if(finish[i]==0)
{dead[j]=i;
j++;
flag=1;
}}
if(flag==1)
{
printf("\n\nSystem is in Deadlock and the Deadlock process are\n");
for(i=0;i<n;i++)
{printf("P%d\t",dead[i]);
}}
Else
{
printf("\nNo Deadlock Occur");
}}
OUTPUT:
************Deadlock Detection Algo **************
Enter the no of processes 3
Enter the no of resources 3
Enter the Max Matrix
3 6 8
4 3 3
3 4 3
Enter the Allocation Matrix
3 3 3
2 0 3
1 2 4
Enter the available Resouces
1 2 0
Process Available Max Available
P1 3 3 3 3 6 8 1 2 0
P2 2 0 3 4 3 3
P3 1 2 4 3 4 4
System is in Deadlock and the deadlock processes are
P0 p1 p2
RESULT:
Thus the algorithm for detecting deadlock has been implemented successfully.
Ex.No.:9 IMPLEMENT THREADING APPLICATIONS
AIM:
To write a C program to implement threading applications.
ALGORITHM:
PROGRAM:
#include<stdio.h>
#include<string.h>
#include<pthread.h>
#include<stdlib.h>
#include<unistd.h>
pthread_t tid[2];
int counter;
pthread_mutex_t lock;
void* doSomeThing(void *arg)
{
pthread_mutex_lock(&lock);
unsigned long i = 0;
counter += 1;
printf("\n Job %d started\n", counter);
for(i=0; i<(0xFFFFFFFF);i++);
printf("\n Job %d finished\n", counter);
pthread_mutex_unlock(&lock);
return NULL;
}
int main(void)
{
int i = 0;
int err;
if (pthread_mutex_init(&lock, NULL) != 0)
{ printf("\n mutex init failed\n");
return 1;
}
while(i < 2)
{
err = pthread_create(&(tid[i]), NULL, &doSomeThing, NULL);
if (err != 0)
printf("\ncan't create thread :[%s]", strerror(err));
i++;
}
pthread_join(tid[0], NULL);
pthread_join(tid[1], NULL);
pthread_mutex_destroy(&lock);
return 0;}
OUTPUT:
$ ./threads
Job 1 started
Job 1 finished
Job 2 started
Job 2 finished
RESULT:
Thus the implementation of threading application was executed successfully.
Ex.No.:10 IMPLEMENTATION OF PAGING TECHNIQUE OF MEMORY
MANAGEMENT
AIM:
To write a c program to implement Paging technique for memory management.
ALGORITHM:
PROGRAM:
#include<stdio.h>
#include<conio.h>
#include<math.h>
main()
{
int size,m,n,pgno,pagetable[3]={5,6,7},i,j,frameno;
double m1;
int ra=0,ofs;
clrscr();
printf(“Enter process size (in KB of max 12KB):”);/*reading memeory size*/
scanf(“%d”,&size);
m1=size/4;
n=ceil(m1);
printf(“Total No. of pages: %d”,n);
printf(“\nEnter relative address (in hexadecimal notation eg.0XRA) \n”);
//printf(“The length of relative Address is : 16 bits \n\n The size of offset is :12 bits\n”);
scanf(“%d”,&ra);
pgno=ra/1000; /*calculating physical address*/
ofs=ra%1000;
printf(“page no=%d\n”,pgno);
printf(“page table”);
for(i=0;i<n;i++)
printf(“\n %d [%d]”,i,pagetable[i]);
frameno=pagetable[pgno];
printf(“\n Equivalent physical address : %d%d”,frameno,ofs);
getch();
}
OUTPUT:
Enter process size (in KB of max 12KB): 12
Total No. of pages: 3
Enter relatiee address (in hexadecimal notation eg.OXRA)
2643
Page no=2
Page table
0 [5]
1 [6]
2[7]
Equivalent physical address: 7643
RESULT:
Thus the implementation of paging technique for memory management was executed
successfully.
Ex.No.:11 IMPLEMENTATION OF MEMORY ALLOCATION
TECHNIQUES
AIM:
To write a C program to implement Memory Management concept using the
Technique best fit, worst fit and first fit algorithms.
ALGORITHM:
Step1: Get the number of process.
Step 2: Get the number of blocks and sizeof process.
Step3: Get the choices from the user and call the corresponding witch cases.
Step4: Firstfit-allocatetheprocesstotheavailablefreeblockmatchwiththesizeof the
process
Step5: Worstfit–allocatetheprocesstothelargestblocksizeavailableinthelist
Step6: Bestfit-allocatetheprocesstotheoptimumsizeblockavailableinthelist
Step7: Display the result with allocations
PROGRAM:
#include
<stdio.h>
main()
{
int p[10],np,b[10],nb,ch,c[10],d[10],alloc[10],flag[10],i,j;
printf("\nEnter the no of process:");
scanf("%d",&np);
printf("\nEnter the no of blocks:");
scanf("%d",&nb);
printf("\nEnter the size of each process:");
for(i=0;i<np;i++)
{
printf("\nProcess%d:",i);
scanf("%d",&p[i]);
}
printf("\nEnter the block sizes:");
for(j=0;j<nb;j++)
{
printf("\nBlock %d:",j);
scanf("%d",&b[j]);c[j]=b[j];d[j]=b[j];
}
if(np<=nb)
{
printf("\n1.Firstfit2.Bestfit3.Worstfit"); do
{
printf("\nEnter your choice:");
scanf("%d",&ch);
switch(ch)
{
case 1: printf("\nFirst Fit\n"); for(i=0;i<np;i++)
{
for(j=0;j<nb;j++)
{
if(p[i]<=b[j])
{
alloc[j]=p[i];printf("\n\nAlloc[%d]",all oc[j]);
printf("\n\nProcess %d of size %d is allocatedinblock:%dofsize:
%d",i,p[i],j,b[j]);
flag[i]=0,b[j]=0;break;
}
else
flag[i]=1;
}}
for(i=0;i<np;i++)
{
if(flag[i]!=0)
printf("\n\nProcess %d of size %d is not allocated",i,p[i]);
}
break;
case 2: printf("\nBest Fit\n");
for(i=0;i<nb;i++)
{
for(j=i+1;j<nb;j++)
{
if(c[i]>c[j])
{
inttemp=c[i]; c[i]=c[j]; c[j]=temp;
}}}
printf("\nAfter sorting block sizes:"); for(i=0;i<nb;i++)
printf("\nBlock%d:%d",i,c[i]); for(i=0;i<np;i++)
{
for(j=0;j<nb;j++)
{
if(p[i]<=c[j])
{}
else
}}
alloc[j]=p[i];printf("\n\nAlloc[%d]",all oc[j]);
printf("\n\nProcess %d of size %d is allocated in block %d of size
%d",i,p[i],j,c[j]); flag[i]=0,c[j]=0;break;
flag[i]=1;
for(i=0;i<np;i++)
{}
break;
if(flag[i]!=0)
break;
}
for(i=0;i<np;i++)
{
}
}while(ch<=3);
}
}
OUTPUT:
Enter the no of
process:3 Enter
the no of
blocks:3
Enter the size of each process:
Process0:100
Process1:150
Process2:200
Enter the block sizes:
Block0:300
Block1:350
Block2:200
1.First fit 2.Best fit
3.Worst fit Enter your
choice:1
Alloc[100]
Process 0 of size 100 is allocated in block 0 of size 300
Alloc[150]
Process 1 of size 150 is allocated in block 1 of size 350
Alloc[200]
Process 2 of size 200 is allocated in block 2 of
size 200 Enter your choice:2
BestFit
After sorting block
sizes are: Block
0:200
Block1:300
Block2:350
Alloc[100]
Process 0 of size 100 is allocated in block:0 of size:200
Alloc[150]
Process 1 of size 150 is allocated in block:1 of size:300
Alloc[200]
Process 2 of size 200 is allocated in block:2 of
size:350 enter your choice:3
Worst Fit
After sorting block sizes are:
Block0:350
Block1:300
Bloc
k2:2
00
Allo
c[10
0]
Process 0 of size 100 is allocated in block 0 of size 350
Alloc[150]
Process 1 of size 150 is allocated in block 1 of size 300
Alloc[200]
Process 2 of size 200 is allocated in block 2 of
size 200 Enter your choice:6
InvalidChoice…!
RESULT:
Thus the c program to implement memory management scheme using Best
fit, worst fit and first fit were executed successfully.
Ex.No:12a. IMPLEMENTATION OF FIFO PAGE REPLACEMEN ALGORITHM
AIM:
ALGORITHM:
PROGRAM:
#include<stdio.h>
int main()
{
int i=0,j=0,k=0,i1=0,m,n,rs[30],flag=1,p[30];
system("clear");
printf("FIFO page replacement algorithm ... \\n");
printf("enter the no. of frames:");
scanf("%d",&n);
printf("enter the reference string:");
while(1)
{
scanf("%d",&rs[i]);
if(rs[i]==0)
break;
i++;
}
m=i;
for(j=0;j<n;j++)
p[j]=0;
for(i=0;i<m;i++)
{
flag=1;
for(j=0;j<n;j++)
if(p[j]==rs[i])
{
printf("data already in page ... \n");
flag=0;
break;
}
if(flag==1)
{
p[i1]=rs[i];
i1++;
k++;
if(i1==n)
i1=0;
for(j=0;j<n;j++)
{
printf("\n page %d:%d",j+1,p[j]);
if(p[j]==rs[i])
printf("*");
}
printf("\n\n");
}
}
printf("total no page faults=%d",k);
}
OUTPUT:
RESULT:
Thus the implementation of FIFO page replacement algorithms was executed
successfully.
Ex.No:12b IMPLEMENTATION OF LRU PAGE REPLACEMENT ALGORITHM
AIM:
To write a c program to implement LRU page replacement algorithm.
ALGORITHM:
PROGRAM:
#include<stdio.h>
main()
{
int q[20],p[50],c=0,c1,d,f,i,j,k=0,n,r,t,b[20],c2[20];
printf("Enter no of pages:");
scanf("%d",&n);
printf("Enter the reference string:");
for(i=0;i<n;i++)
scanf("%d",&p[i]);
printf("Enter no of frames:");
scanf("%d",&f);
q[k]=p[k];
printf("\n\t%d\n",q[k]);
c++;
k++;
for(i=1;i<n;i++)
{
c1=0;
for(j=0;j<f;j++)
{
if(p[i]!=q[j])
c1++;
}
if(c1==f)
{c++;
if(k<f)
{q[k]=p[i];
k++;
for(j=0;j<k;j++)
printf("\t%d",q[j]);
printf("\n");
}
else
{for(r=0;r<f;r++)
{c2[r]=0;
for(j=i-1;j<n;j--)
{if(q[r]!=p[j])
c2[r]++;
else
break;
}}
for(r=0;r<f;r++)
b[r]=c2[r];
for(r=0;r<f;r++)
{
for(j=r;j<f;j++)
{
if(b[r]<b[j])
{
t=b[r];
b[r]=b[j];
b[j]=t;
}}}
for(r=0;r<f;r++)
{
if(c2[r]==b[0])
q[r]=p[i];
printf("\t%d",q[r]);
}
printf("\n");
}}}
printf("\nThe no of page faults is %d",c);
}
OUTPUT:
Enter no of pages:10
Enter the reference string:7 5 9 4 3 7 9 6 2 1
Enter no of frames:3
7
75
759
459
439
437
937
967
962
162
The no of page faults is 10
RESULT:
Thus the implementation of LRU page replacement algorithms was executed
successfully.
Ex.No:12c IMPLEMENTATION OF LFU PAGE REPLACEMENT ALGORITHM
AIM:
To write C program to implement LFU page replacement algorithm.
ALGORITHM:
PROGRAM:
#include<stdio.h>
int main()
{
int f,p;
int pages[50],frame[10],hit=0,count[50],time[50];
int i,j,page,flag,least,minTime,temp;
printf("Enter no of frames : ");
scanf("%d",&f);
printf("Enter no of pages : ");
scanf("%d",&p);
for(i=0;i<f;i++)
{
frame[i]=-1;
}
for(i=0;i<50;i++)
{
count[i]=0;
}
printf("Enter page no : \n");
for(i=0;i<p;i++)
{
scanf("%d",&pages[i]);
}
printf("\n");
for(i=0;i<p;i++)
{
count[pages[i]]++;
time[pages[i]]=i;
flag=1;
least=frame[0];
for(j=0;j<f;j++)
{
if(frame[j]==-1 || frame[j]==pages[i])
{
if(frame[j]!=-1)
{
hit++;
}
flag=0;
frame[j]=pages[i];
break;
}
if(count[least]>count[frame[j]])
{
least=frame[j];
}
}
if(flag)
{
minTime=50;
for(j=0;j<f;j++)
{
if(count[frame[j]]==count[least] && time[frame[j]]<minTime)
{
temp=j;
minTime=time[frame[j]];
}
}
count[frame[temp]]=0;
frame[temp]=pages[i];
}
for(j=0;j<f;j++)
{
printf("%d ",frame[j]);
}
printf("\n");
}
printf("Page hit = %d",hit);
return 0;
}
OUTPUT:
Enter no of frames: 3
Enter no of pages: 10
Enter page no:
2342137 43
2 -1 -1
2 3 -1
2 3 4
2 1 4
21 3
2 7 3
2 7 5
2 4 5
2 4 3
Page Hit = 1
RESULT:
Thus the implementation of LFU page replacement algorithms was executed
successfully.
Ex.No.:13a FILE ORGANIZATION TECHNIQUE-SINGLE LEVEL DIRECTORY
AIM:
ALGORITHM:
PROGRAM:
#include<stdio.h>
main()
{
int master,s[20]; charf[20][20][20];
chard[20][20]; int i,j;
printf("enter number of directorios:"); scanf("%d",&master);
printf("enter names of directories:"); for(i=0;i<master;i++) scanf("%s",&d[i]);
printf("enter size of directories:"); for(i=0;i<master;i++) scanf("%d",&s[i]);
printf("enter the file names:"); for(i=0;i<master;i++) for(j=0;j<s[i];j++) scanf("%s",&f[i]
[j]); printf("\n");
printf(" directory\tsize\tfilenames\n");
printf("*************************************************\n");
for(i=0;i<master;i++)
{
printf("%s\t\t%2d\t",d[i],s[i]); for(j=0;j<s[i];j++)
printf("%s\n\t\t\t",f[i][j]); printf("\n");
}
printf("\t\n");
}
OUTPUT:
RESULT:
Thus the file organization technique -Single level directory structure was executed
successfully.
Ex.No:13b FILE ORGANIZATION TECHNIQUE-TWO LEVEL DIRECTORY
AIM:
To write C program to organize the file using two level directory.
ALGORITHM:
PROGRAM:
#include<stdio.h>struct st
{
char dname[10];
char sdname[10][10]; char fname[10][10][10]; int ds,sds[10];
}dir[10]; void main()
{
int i,j,k,n;
clrscr();
printf("enter number of directories:");
scanf("%d",&n);
for(i=0;i<n;i++)
{
printf("enter directory %dnames:",i+1);
scanf("%s",&dir[i].dname);
printf("enter size of directories:");
scanf("%d",&dir[i].ds);
for(j=0;j<dir[i].ds;j++)
{
printf("enter sub directory name and size:");
scanf("%s",&dir[i].sdname[j]);
scanf("%d",&dir[i].sds[j]);
for(k=0;k<dir[i].sds[j];k++)
{
printf("enter file name:");
scanf("%s",&dir[i].fname[j][k]);
}}}
printf("\ndirname\t\tsize\tsubdirname\tsize\tfiles"); printf("\
n******************************************************\n"); for(i=0;i<n;i+
+){
printf("%s\t\t%d",dir[i].dname,dir[i].ds);
for(j=0;j<dir[i].ds;j++)
{
printf("\t%s\t\t%d\t",dir[i].sdname[j],dir[i].sds[j]);
for(k=0;k<dir[i].sds[j];k++) printf("%s\t",dir[i].fname[j][k]);
printf("\n\t\t");}
printf("\n"); }
}
OUTPUT:
RESULT:
Thus the file organization technique -Two level directory structure was executed
successfully.
Ex.No:14a FILE ALLOCATION STRATEGIES-SEQUENTIAL
AIM:
To write a C program for sequential file for processing the student information
ALGORITHM:
PROGRAM:
#include<stdio.h>
#include<conio.h>
typedef struct
{int sno;
char name[25];int m1,m2,m3;
}STD;
void display(FILE *);
int search(FILE *);
void main()
{int i,n,sno_key,opn;
FILE *fp;
clrscr();
printf(“How many records ?”);
scanf(“%d”,&n);
fp=fopen(“stud.dat”,”w”);
for(i=0;i<n;i++)
{printf(“Enter the student information : %d(sno,Name,M1,M2,M3):”,i+1);
scanf(“%d%s%d%d%d,&s.sno,s.name,&s.m1,&s.m2,&s.m3);
fwrite(&s,sizeof(s),1,fp);
}
fclose(fp);
fp=fopen(“stdu.dat”,”r”);
do
{printf(“1-DISPLAY\n2.SEARCH\n 3.EXIT\n YOUR OPTION: “);
scanf(“%d”,&open);
switch(opn)
{
case 1:
printf(“\n Student Records in the file \n”);
display(fp);
break;
case 2:
printf(“Read sno of the student to be searched :”);
scanf(“%d”,&sno_key);
if(search(fp,sno_key)){
printf(“success!! Record found in the file\n”);
printf(“%d\t%s\t%d\t%d\t%d\n”, s.sno,s.name,s.m1,s.m2,s.m3);
}
else
printf(“Failure!! Record %d not found\n”,sno_key);
break;
case 3:
printf(“Exit !! press key”);
getch();
break;
default:
printf(“Invalid option!!! Try again!!\n”);
break;
}
}while(opn!=3);
fclose(fp);
}
Void display(FILE *fp)
{rewind(fp);
while(fread(&s,sizeof(s),1,fp))
printf(“%d\t%s\t%d\t%d\t%d\n”,s.sno,s.name,s.m1,s.m2,s.m3);
}
int search(FILE *fp,int sno_key)
{rewind(fp);
while(fread(&s,sizeof(s),1,fp))
If(s.sno==sno_key)
return 1;
return 0;
}
OUTPUT:
2- SEARCH
3- EXIT
YOUR OPTION 1
1 Keerthana 100 99 98
2 Nitheesh 97 98 96
3 Rajasekhar 95 93 85
4 Ramesh 94 99 100
1-DISPLAY
2-SEARCH
3-EXIT
YOUR OPTION 2
1 Keerthana 100 99 98
RESULT:
Thus the Sequential file allocation method is implemented successfully.
Ex.No:14b FILE ALLOCATION STRATEGIES –INDEXED FILE ALLOCATION
AIM:
To Write a C Program to implement Indexed File Allocation method.
ALGORITHM:
Step1:Start.
Step2:Let n be the sizeof the buffer
OUTPUT:
Enter no.of files:2
Enter starting block & size of file 1:2 5
Enter blocks occupied by file1:10
Enter blocks of file 1:3 2 5 4 6 7 2 6 4 7
Enter starting block and size of file 2:3 4
Enter blocks occupied by file 2:5
Enter blocks of file 2: 2 3 4 5 6
File index length
1 2 10
2 3 5
Enter file name:midname
File name is:12803
Index is 0
Block occupied
RESULT:
Thus the indexed file allocation method is implemented successfully
Ex.No:14c FILE ALLOCATION STRATEGIES-LINKED
AIM:
To write a C program for random access file for processing the employee details.
ALGORITHM:
PROGRAM:
#include<stdio.h>
#include<conio.h>
#include<string.h>
struct record
{
char empname[20];
int age;
float salary;
};
typedef struct record person
FILE *people;
void main()
{
person employee;
int I,n;
FILE *fp;
printf(“How many records:”);
scanf(“%d”,&n);
fp=fopen(“PEOPLE.txt”,”w”);
for(i=0;i<n;i++)
{
printf(“Enter the employee information :%d(EmpName, Age,Salary):”,i+1);
scanf(“%s%d%f”,employee.empname,&employee.age,& employee.salary);
fwrite(,&employee.sizeof(employee,1,people);
}
fclose(fp);
int rec,result;
people=fopen(“PEOPLE.txt”,”r”);
printf(“Which record do you want to read from file?);
scanf(“%d”,&rec);
while(rec>=0)
{
fseek(people,rec*sizeof(employee),SEEK_SET);
result=fread(&em[ployee,sizeof(employee),1,people)
if(result==1)
{
printf(“\n RECORD %d\n”,rec);
printf(“Given name:%s\n”, employee.empname);
printf(“Age:%d years\n”,employee.age);
printf(“Current salary:$ %8.2f\n\n”,employee.salary);
}
else
printf( “\n RECORD %d not found !\n\n”,rec);
printf(“Which record do you want(0to3)”):
scanf(“%d”<&rec):
}
fclose(people):
getch():
}
OUTPUT:
1-DISPLAY
2-SEARCH
3-EXIT
YOUR OPTION 1
1 Keerthana 100 99 98
2 Nitheesh 97 98 96
3 Rajasekhar 95 93 85
4 Ramesh 94 99 100
1- DISPLAY
2- SEARCH
3- EXIT
YOUR OPTION 2
1 Keerthana 100 99 98
RESULT:
Thus the implementations of file allocation using linked access have been executed
successfully.
Ex.No.15a Implementation of FCFS disk scheduling algorithms
Aim:
To implement FCFS the simplest of all the Disk Scheduling Algorithms
In FCFS, the Requests are addressed in the order they arrive in the disk queue.
ALGORITHM:
Step 1: Start the program
Step 2: Declare the necessary header files
Step 3: Declare the variables which is needed to execute FCFS
Step 4:Get the number of variables RQ[i],using for loop
Step 5:Assign the logic of the FCFS disk scheduling
Step 6:Execute till the process get completed
Step 7:Set the initial head position
Step 8:Print the results Total Head Moment
Step 9:Stop the execution
PROGRAM:
#include<stdio.h>
#include<stdlib.h>
int main()
{
intRQ[100],i,n,TotalHeadMoment=0,initial;
printf("Enter the number of Requests\n");
scanf("%d",&n);
}
OUTPUT:
Enter the number of Request 8
Enter the Requests Sequence 95 180 34 119 11 123 62 64
Enter initial head position 50
Total head movement is 644
RESULT:
Thus the above Disk scheduling FCFS is implemented successfully
Ex.No.15b Implementation of SSTF disk scheduling Algorithm
AIM:
To implement Shortest seek time first(SSTF)algorithm, selects the disk I/O request which
requires the least disk arm movement from its current position regardless of the direction. It
reduces the total seek time as compared to FCFS
ALGORITHM:
PROGRAM:
#include<stdio.h>
#include<stdlib.h>
int main()
{
intRQ[100],i,n,TotalHeadMoment=0,initial,count=0;
printf("Enter the number of Requests\n");
scanf("%d",&n);
printf("EntertheRequestssequence\n");
for(i=0;i<n;i++)
scanf("%d",&RQ[i]);
printf("Enterinitialheadposition\n");
scanf("%d",&initial);while(count!=n)
{
intmin=1000,d,index;
for(i=0;i<n;i++)
{
d=abs(RQ[i]-initial); if(min>d)
{min=d; index=i;
}
}
TotalHeadMoment=TotalHeadMoment+min; initial=RQ[index];
//1000is for max
//you can use any number RQ[index]=1000;
count++;
}
printf("Total head movement is%d", TotalHeadMoment); return 0;
}
OUTPUT:
RESULT:
Thus the above Disk scheduling SSTF is implemented successfully.