Final Lab Manual-Take Print-1
Final Lab Manual-Take Print-1
REGULATION-2021
REGULATION-2021
SIGNATURE: SIGNATURE :
DATE: DATE:
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
ACADEMIC YEAR: 2023 - 2024 (EVEN SEMESTER)
VISION, MISSION, POs, PEOs and PSOs
Vision of the Institution:
We endeavor to impart futuristic technical education of the highest quality to the student community
and to inculcate discipline in them to face the world with self-confidence and thus we prepare them for life as
responsible citizens to uphold human values and to be of services at large. We strive to bring up the
Institution as an Institution of Academic excellence of International standard.
PEO1 - Graduates will have successful careers with high level of technical competency and problem-solving
skills to produce innovative solutions for industrial needs.
PEO2 – Graduates will have good professionalism, team work, effective communication, leadership qualities
and life-long learning for the welfare of mankind. PEO3 – Graduates will be familiar with recent trends in
industry for delivering and implementing innovative system in collaboration.
PO 10: Communication: Communicate effectively on complex engineering activities with the engineering
community and with society at large, such as, being able to comprehend and write effective reports and
design documentation, make effective presentations, and give and receive clear instructions.
PO 11: Project management and finance: Demonstrate knowledge and understanding of the engineering and
management principles and apply these to one’s own work, as a member and leader in a team, to manage projects
and in multidisciplinary environments.
PO 12: Life Long Learning: Recognize the need for, and have the preparation and ability to engage in
independent and life-long learning in the broadest context of technological change.
Program Specific Outcome (PSO)
PSO1 :Students will be apply programming skills to develop new software with assured quality.
PSO2 : Students will be ability to demonstrate specific coding skills to improve employability.
PSO3 :Ability to work effectively with various engineering fields as a team to design, build and develop
system applications.
CO PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO10 PO11 PO12 PSO1 PSO2 PSO3
1 3 1 3 1 1 - - - 1 3 3 2 1 3 3
2 3 1 1 2 2 - - - 3 2 1 1 3 1 2
3 3 3 2 1 2 - - - 3 3 1 2 2 2 2
4 1 2 2 3 2 - - - 3 1 3 1 1 2 1
5 2 2 1 1 3 - - - 1 2 2 3 1 3 3
Avg. 2 2 2 2 2 - - - 2 2 2 2 2 2 2
*ForEntireCourse,PO/PSOMapping;1(Low);2(Medium);3(High)ContributiontoPO/PSO
JUSTIFICATIONFORMAPPING
PO1-H Highly mapped as students gain the knowledge of define and implement UNIX
Commands.
PO2-H Slightly mapped as students understand the UNIX Commands.
PO3-L Slightly mapped as the students will be able compare the performance of various CPU
Scheduling Algorithms.
PO4-M Slightly mapped as students will learn the importance of software maintenance and
complexities involved in software evolution.
PO5-M Moderately mapped as students will compare the performance of various CPU
Scheduling Algorithms.
PO9-H Moderately mapped as the students will be able to explore design contrast various
Memory Allocation Methods.
PO10-L Highly mapped as the students will be able to explore design alternatives to producea
variety of potential design solutions of class model suited to meet functional
C02 requirements.
PO11-M Highly mapped as the students will be able to explore contrast various Memory
Allocation Methods.
PO12-H Slightly implement various Disk Scheduling Algorithms.
PO1-H Highly mapped as students gain the knowledge of define and implement UNIX
Commands.
PO2-L Slightly mapped as students understand the UNIX Commands.
PO3-L Slightly mapped as the students will be able compare the performance of various CPU
Scheduling Algorithms.
PO4-L Slightly mapped as students will learn the importance of software maintenance and
complexities involved in software evolution.
CO3
PO5-H Moderately mapped as students will compare the performance of various CPU
Scheduling Algorithms.
PO9-H Moderately mapped as the students will be able to explore design contrast various
Memory Allocation Methods.
PO10-M Highly mapped as the students will be able to explore design alternatives to producea
variety of potential design solutions of class model suited to meet functional
requirements.
PO11-L Highly mapped as the students will be able to explore contrast various Memory
Allocation Methods.
PO12-L Slightly implement various Disk Scheduling Algorithms.
PO1-H Highly mapped as students gain the knowledge of define and implement UNIX
Commands.
PO2-M Slightly mapped as students understand the UNIX Commands.
PO3-M Slightly mapped as the students will be able compare the performance of various CPU
Scheduling Algorithms.
PO4-M Slightly mapped as students will learn the importance of software maintenance and
CO4
complexities involved in software evolution.
PO5-L Moderately mapped as students will compare the performance of various CPU
Scheduling Algorithms.
PO9-L Moderately mapped as the students will be able to explore design contrast various
Memory Allocation Methods.
PO10-H Highly mapped as the students will be able to explore design alternatives to producea
variety of potential design solutions of class model suited to meet functional
requirements.
PO11-M Highly mapped as the students will be able to explore contrast various Memory
Allocation Methods.
PO12-M Slightly implement various Disk Scheduling Algorithms.
PO1-H Highly mapped as students gain the knowledge of define and implement UNIX
Commands.
PO2-H Slightly mapped as students understand the UNIX Commands.
PO3-L Slightly mapped as the students will be able compare the performance of various CPU
Scheduling Algorithms.
PO4-L Slightly mapped as students will learn the importance of software maintenance and
complexities involved in software evolution.
PO5-L Moderately mapped as students will compare the performance of various CPU
CO5 Scheduling Algorithms.
PO9-H Moderately mapped as the students will be able to explore design contrast various
Memory Allocation Methods.
PO10-L Highly mapped as the students will be able to explore design alternatives to producea
variety of potential design solutions of class model suited to meet functional
requirements.
PO5-11 Highly mapped as the students will be able to explore contrast various Memory
Allocation Methods.
PO12-M Slightly implement various Disk Scheduling Algorithms.
PSO2-H Highly mapped as Students should be able to develop and implement the
CO1 solution of real life computingproblems using contemporary technologies.
PSO3-L Slightly should be able to apply ethical principles and commit to professional and
socialresponsibilities.
PSO1-L Slightly mapped as students understand the concepts of
softwareengineering and software requirements required in building the applications.
PSO2-H Highly mapped as Students should be able to develop and implement the
solution of real life computingproblems using contemporary technologies.
CO2
PSO3-L Slightly should be able to apply ethical principles and commit to professional and
socialresponsibilities.
PSO2-H Highly mapped as Students should be able to develop and implement the
solution of real life computingproblems using contemporary technologies.
CO3
PSO3-L Slightly should be able to apply ethical principles and commit to professional and
socialresponsibilities.
PSO3-L Slightly should be able to apply ethical principles and commit to professional and
socialresponsibilities.
EXPERIMENTS:
1. Installation of windows operating system.
2. Illustrate UNIX commands and Shell Programming .
3. Process Management using System Calls : Fork, Exit, Getpid, Wait, Close.
4. Write C programs to implement the various CPU Scheduling Algorithms.
5. Illustrate the inter process communication strategy .
6. Implement mutual exclusion by Semaphore.
7. Write C programs to avoid Deadlock using Banker's Algorithm .
8. Write a C program to Implement Deadlock Detection Algorithm.
9. Write C program to implement Threading.
10. Implement the paging Technique using C program .
11. Write C programs to implement the following Memory Allocation Methods a. First Fit b. Worst Fit c.
Best Fit.
12. Write C programs to implement the various Page Replacement Algorithms .
13. Write C programs to Implement the various File Organization Techniques.
14. Implement the following File Allocation Strategies using C programs a. Sequential b. Indexed c. Linked
15. Write C programs for the implementation of various disk scheduling algorithms .
16. Install any guest operating system like Linux using VMware.
TOTAL:45 PERIODS
COURSEOUTCOMES:
On completion of the course, students will be able to:
CO1: Define and implement UNIX Commands.
2. No cell phones or electronic devices at the lab stations (i pods, MP3 Players, etc.,).
5. Students must inspect their position for possible damage and report immediately to the
faculty any damage that may be found.
6. Students must follow the faculty’s instructions explicitly concerning all uses of the lab
equipment.
7. Leave your shoes in the shoes rack before entering into the lab
8. Shut down the computer properly before leaving from the lab.
10. Arrange your chairs properly before leaving from the lab
COURSE OBJECTIVES:
To install windows operating systems.
To understand the basics of Unix command and shell programming.
To implement various CPU scheduling algorithms.
To implement Deadlock Avoidance and Deadlock Detection Algorithms
To implement Page Replacement Algorithms
To implement various memory allocation methods.
To be familiar with File Organization and File Allocation Strategies.
LIST OF EXPERIMENTS:
1. Installation of windows operating system
2. Illustrate UNIX commands and Shell Programming
3. Process Management using System Calls: Fork, Exit, Getpid, Wait, Close
4. Write C programs to implement the various CPU Scheduling Algorithms
5. Illustrate the inter process communication strategy
6. Implement mutual exclusion by Semaphore
7. Write C programs to avoid Deadlock using Banker's Algorithm
8. Write a C program to Implement Deadlock Detection Algorithm
9. Write C program to implement Threading
10. Implement the paging Technique using C program
11. Write C programs to implement the following Memory Allocation Methods
a. First Fit b. Worst Fit c. Best Fit
12. Write C programs to implement the various Page Replacement Algorithms
13. Write C programs to Implement the various File Organization Techniques
14. Implement the following File Allocation Strategies using C programs
a. Sequential b. Indexed c. Linked
15. Write C programs for the implementation of various disk scheduling algorithms
16. Install any guest operating system like Linux using VMware.
TOTAL:45 PERIODS
COURSE OUTCOMES:
At the end of this course, the students will be able to:
AIM:
To install Windows Operating System on computer.
PROCEDURE:
1. To perform a clean installation of Windows 10, download the free official Windows 10
installation media from Microsoft. Download it from here: https://www.microsoft.com/en-
us/software-download/windows10startfresh
4. Accept the license term. Now, you will be asked to "Give your PC a fresh start." Choose
any one of the options given below. Select what you want to keep.
6. Select the language, architecture, and edition according to your need. For example, if you
have a laptop or PC with a 64-bit CPU, then you have to install the 64-bit version. If you
have a computer or PC with a 32-bit CPU, then you have to install the 32-bit version. If
you want to install Windows 10 on your current using laptop or PC, check the box "Use
the recommended options for this PC," and it will automatically download the best
compatible version for your current using PC; otherwise, uncheck this box. See the image
below:
8. Now, the installation media is created. Please insert it into your laptop or PC and install
Windows 10. You have to boot to the Windows 10 installer. For the booting process, Click
on the Start menu button and restart your laptop.
9. Now, press and hold Del or F2 button to enter setup. This key may be different in some
computers. Generally, it is displayed as a message on startup that says, "Press [key] to enter
setup."
10. Now, go to the "Boot" option on the above menu bar and select a device from which you
have to boot. You will see the following two option there:
a. For a USB flash drive, select the Removable Devices option.
b. For a disc installation, select the CD-ROM Drive option.
13. You may have to click on several "next" buttons, and finally, you will see the installer
screen. See the below image:
14. Click on the install now button and follow the given instructions to install Windows 10 on
your system successfully.
16. If you have a valid product key for Windows 10, you can paste it here. You can also paste
a valid Windows 7, 8, or 8.1 key here. You will get the advantage of the free Windows 10
upgrade offer on your PC.
17. After that, you will see a new Windows setup screen "Which type of installation do you
want?" Click "Custom" if you want to perform a clean installation. It will remove
everything on your PC. If you want to upgrade your existing installation, click the
"Upgrade" option.
19. In this installation process, your system may restart several times. At the end of the process,
you will get a new Windows 10 as your operating system.
RESULT
Thus, the Windows Operating System has been installed successfully.
AIM:
To study the basic Shell Commands in UNIX.
1. date command
Syntax: date
Explanation: The date command is used to display the current date with day of the week,
month, day time (24hr clock) and the year.
Example: 12ee01@localhost]:~ $ date
Output : Wed Feb 10 05:05:44 EST 2010
12ee01@localhost]:~ $
2. echo command
Syntax: echo text
Explanation: The echo command is used to print the message on the screen, whatever is
typed on the line.
Example: 12ee01@localhost]:~ $ echo Akshaya College of Engineering and
Technology
Output : Akshaya College of Engineering and Technology
12ee01@localhost]:~ $
3. banner command
Syntax: banner message
Explanation: The banner command is used to print the message in large letters to give the
impression of a banner.
Example: 12ee01@localhost]:~ $ banner UNIX
Output : 12ee01@localhost]:~ $ banner EEE
4. cal command
Syntax: cal [month] [year]
Explanation: The calendar (cal) command displays the calendar for the specified month
or year.
Example 1: 12ee01@localhost]:~ $ cal
Output : prints the calendar of the current year.
Example 2: 12ee01@localhost]:~ $ cal 2 2005
Output : February 2005
5. bc command
Syntax: bc
Explanation: The bc (calculator) command offers an online calculator.
Example: 12ee01@localhost]:~ $ bc
Output : bc 1.06.94
Copyright 1991-1994, 1997, 1998, 2000, 2004, 2006 Free Software Foundation,
Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'.
7+5*2
17
(50-10)*2
80
(Press CTRL d to exit the calculator)
12ee01@localhost]:~ $
6. who command
Syntax: who
Explanation: The who command is used to display data about all the users who are
currently logged into the system.
7. who am i command
Syntax: who am i
Explanation: The “who am i” command displays the login details of the user.
Example: 12ee01@localhost]:~ $ who am i
Output : acet pts/0 2010-02-10 05:05 (:0.0)
12ee01@localhost]:~ $
8. finger command
Syntax: finger [username]
Explanation: The finger command displays information about the user.
Example: 12ee01@localhost]:~ $ finger acet
Output : Login: acet Name: admin
Directory: /home/acet Shell: /bin/bash
On since Wed Feb 10 15:34 (EST) on tty7 from :0
On since Wed Feb 10 05:05 (EST) on pts/0 from :0.0
Note: The finger command without any username will display the information about the all the
users who are currently logged in.
9. id command
Syntax: id
Explanation: The id command displays the numerical value that corresponds to the login
name.
i.e. every user is assigned a user id and group id. These ids are displayed in the id command.
Example: 12ee01@localhost]:~ $ id
FILE COMMANDS
1. cat command
Syntax: cat > filename
Explanation: The cat command is used to create a new file.
Example: 12ee01@localhost]:~ $ cat > check1
Hello
(Press CTRL d )
12ee01@localhost]:~ $
Output : world
12ee01@localhost]:~ $
3.cat command
Syntax: cat file1 file2 file3 > file_out
Explanation: The cat command can also used to concatenate multiple files into a single
file.
Example: 12ee01@localhost]:~ $ cat check1 check2 > check3
Output : 12ee01@localhost]:~ $ cat check3
hello
world
12ee01@localhost]:~ $
4. cp command
Syntax: cp old_file new_file
Explanation: The cp command is used to copy the contents of one file to another.
Example: 12ee01@localhost]:~ $ cp test1.c test2.c
Output : 12ee01@localhost]:~ $ cat test1.c
#include <stdio.h>
int main()
{
printf(“This is a C file…”);;
return 0;
}
12ee01@localhost]:~ $
12ee01@localhost]:~ $ cat test2.c
#include <stdio.h>
int main()
{
printf(“This is a C file…”);;
return 0;
}
12ee01@localhost]:~ $
Options: -i (used to warn the user before overwriting the destination file).
-R (used to copy entire directory structure).
6. rm command
Syntax: rm filename
Explanation: The rm command is used to remove or erase an existing file.
Example: 12ee01@localhost]:~ $ rm test1.c
Output : 12ee01@localhost]:~ $ ls
a a.out check2 dma2.c examples.desktop factorial file1 Pictures sqlll.c swap
test2.c Videos akshaya2.txt check1 Desktop dynamic.c f2 f3 file
fork.c Public sum swapptr.c test.c
12ee01@localhost]:~ $
7. ls command
Syntax: ls
Explanation: The ls command is used to view the contents of a directory.
Example: 12ee01@localhost]:~ $ ls
Output : Displays the list of files and sub-directories in the current directory.
Other examples: 12ee01@localhost]:~ $ ls -x
12ee01@localhost]:~ $ ls -t
12ee01@localhost]:~ $ ls –r
12ee01@localhost]:~ $ ls -A
12ee01@localhost]:~ $ ls -h
12ee01@localhost]:~ $ ls –q
12ee01@localhost]:~ $ ls -l
9. wc command
Syntax: wc filename
Explanation: The wc command is used to count the number of words lines and characters
in a file.
Example 1: 12ee01@localhost]:~ $ wc check1
Output : 1 1 6 check1
12ee01@localhost]:~ $
DIRECTORY COMMANDS
1. mkdir command
Syntax: mkdir dirname
Explanation: The mkdir command is used to create an empty directory in a disk.
Example: 12ee01@localhost]:~ $ mkdir akshaya
Output : 12ee01@localhost]:~ $ ls
2. pwd command
Syntax: pwd
Explanation: The pwd command is provided to know the current working directory. pwd
is the abbreviation for “print working directory” or “present working directory”.
Example 1: 12ee01@localhost]:~ $ pwd
Output : /home/acet
12ee01@localhost]:~ $
Output : /home/acet/check
acet@ubuntu:~/check$
3. rmdir command
Syntax: rmdir dirname
Explanation: The rmdir command is used to remove a directory from the disk. The
command deletes only empty directory.
Example 1: 12ee01@localhost]:~ $ rmdir aaa
Output : removes the directory aaa.
12ee01@localhost]:~ $
12ee01@localhost]:~ $ cd akshaya
acet@ubuntu:~/akshaya$ rm f1
acet@ubuntu:~/akshaya$ cd
12ee01@localhost]:~ $ rmdir akshaya
12ee01@localhost]:~ $
12ee01@localhost]:~ $ ls
a aaa akshaya1.txt biggest check2 Desktop Documents exec.c
factorial.abw fibo.c filechar.c hello Public sumodd system.c factorial
file filecopy.c Music reverse sum swap Videos
12ee01@localhost]:~ $
12ee01@localhost]:~ $ cd aaa
acet@ubuntu:~/aaa$
acet@ubuntu:~/aaa$ cd
acet@ubuntu:~/aaa$
12ee01@localhost]:~ $ rm aaa -r
acet@ubuntu:~$
12ee01@localhost]:~ $ ls
a akshaya1.txt biggest check2 Desktop Documents exec.c factorial.abw
fibo.c filechar.c hello Public sumodd system.c factorial file
filecopy.c Music reverse sum swap Videos
12ee01@localhost]:~ $
4. cd command
Syntax: cd dirname
Explanation: The cd command is used to move from one directory to another.
Example: 12ee01@localhost]:~ $ cd akshaya
Output : acet@ubuntu:~/akshaya$
acet@ubuntu:~/akshaya$ ls
acet@ubuntu:~/akshaya$
acet@ubuntu:~/akshaya$ cat f1
This is a sample file…
acet@ubuntu:~/akshaya$
acet@ubuntu:~/akshaya$ cd ..
12ee01@localhost]:~ $
6. clear command
Syntax: clear
Explanation: The clear command is used to clear the display screen.
Example: 12ee01@localhost]:~ $ clear
Output : The screen is cleared
RESULT
Thus the basic Unix Commands have been successfully executed.
ALGORITHM:
Step 1: Start the program.
Step 2: Declare the variable pid.
Step 3: Assign p=fork(c).
Step 4: If pid=0, child process is executed and displays child id and child process id.
Step 5: Else parent process is executed and displays parent process id.
Step 6: Stop the program.
PROGRAM:
// FORK SYSTEM CALL
//vi fork.c
#include<stdio.h>
int main()
{
int pid;
pid = fork();
if(pid==0)
{
printf(" Child process is: %d \n ", getpid());
printf(" Parent process is: %d \n ", getppid());
}
else
{
printf(" Parent process is: %d \n ", getpid());
printf(" Parent of parent process is: %d \n ", getppid());
}
return 0;
OUTPUT:
cse23@localhost cse23]$ cc fork.c
cse23@localhost cse23]$ ./a.out
Child process is: 28054
Parent process is: 28053
Parent process is: 28053
Parent of parent process is: 4659
RESULT:
Thus the C program using fork system call was executed and output is verified
successfully.
AIM
To Write a C program using the exit system call.
ALGORITHM
Step 1: Start the program.
Step 2: Call fork() system call.
Step 3: Pass value more than 255 in exit()
Step 4: Check status and exit.
Step 5: Stop the program.
OUTPUT
Exit code:15
RESULT
Thus the C program using exit system call was executed and output is verified
successfully.
ALGORITHM:
Step 1: Start the program.
Step 2: Declare the variable p and pp.
Step 3: Assign p=getpid( ) and pp=getppid( ).
Step 4: Display child and parent processed.
Step 5: Stop the program.
PROGRAM:
// GETPID SYSTEMCALL
// vi getpid.c
# include<stdio.h>
int main()
{
int p, pp;
p = getpid();
pp = getppid();
printf( " Child process id:%d \n ", p);
printf( " Parent process id:%d \n ", pp);
return 0;
}
RESULT:
Thus the C program to implement getpid system call was executed and output is
verified successfully.
ALGORITHM:
Step 1: Start the program.
Step 2: If pid=0 then child process executes.
Step 3: If pid ! = 0 then wait() will make the parent process to wait until the child process
completes its execution.
Step 4: Print the status of the parent and child process.
Step 5: Stop the program.
PROGRAM:
// WAIT SYSTEM CALL
// vi wait.c
#include<stdio.h>
main()
{
int i=0,pid;
printf("Ready to fork\n");
pid=fork();
if(pid==0)
{
printf("Child states\n");
for(i=0;i<10;i++)
printf("%d \t",i);
printf("Child ends\n");
}
else
{
wait(0);
OUTPUT:
[cse23@localhost cse23]$ cc wait.c
[cse23@localhost cse23]$ ./a.out
Ready to fork
Child states
0 1 2 3 4 5 6 7 8 9 Child ends
0 1 2 3 4 5 6 7 8 9 Parent process end
RESULT:
Thus the C program to implement wait system call was executed and output is verified
successfully.
AIM
To write a C program to implement the close system call.
ALGORITHM
Step 1: Start the program.
Step 2: Open a file foo.txt.
Step 3: If fd1<0 = 0 then open the file descriptor table.
Step 4: If (close(fd1) < 0) then close the file descriptor table.
Step 5: Stop the program.
RESULT
Thus the C program to implement close system call was executed and output is
verified successfully.
AIM:
To write a C program to implement FCFS Scheduling.
ALGORITHM
Step 1: Start the program.
Step 2: Declare the variables.
Step 3: Prompt for number of process from the user.
Step 4: Get the process name and burst time for FCFS.
Step 5: Call the average waiting time and total running time.
Step 6: Set the process.
Step 7: Display the Gantt chart.
Step 8: Stop the program.
RESULT:
Thus the C program to implement the first come first serve scheduling was executed
and output is verified successfully.
ALGORITHM:
Step 1: Start the program.
Step 2: Declare the variables.
Step 3: Prompt for number of process from the user.
Step 4: Get the process name and start name, burst time for shortest path scheduling.
Step 5: Call the average waiting time, total running time and gantt chart.
Step 6: Set the process.
Step 7: Display the gantt chart.
Step 8: Stop the process.
PROGRAM:
// SJF SCHEDULING
// vi sjf.c
#include<stdio.h>
void swap(int j);
char procno[100];
float burst[100];
int main()
{
int num=0,i;
float start=0.00,bt=0.00,avgwait=0.00,wait=0.00;
printf("Enter the number of processes:\n");
scanf("%d",&num);
printf("Enter the process name and burst time in ms:\n");
for(i=0;i<num;i++)
{
scanf("%s",&procno[i]);
OUTPUT:
[cse23@localhost cse23]$ cc sjf.c
[cse23@localhost cse23]$ ./a.out
Enter the number of processes:
4
Enter the process name and burst time in ms:
a 6
b 8
c 7
d 3
Gantt chart
ProcessName StartTime BurstTime
d 0.000000 3.000000
a 3.000000 9.000000
c 9.000000 16.000000
b 16.000000 24.000000
Average waiting time of a process= 7.000000
Total running time of process= 24.000000
RESULT:
Thus the C program to implement the shortest job first scheduling was executed and
output is verified successfully.
AIM:
To write a C program to implement Priority Scheduling.
ALGORITHM:
Step 1: Start the program.
Step 2: Prompt for number of processor from the user.
Step 3: Get the priority process name, burst time and the corresponding priority of the
process.
Step 4: Sort the process according to the priority and allocate the one with highest
priority to be executed first.
Step 5: If number of process has the same priority then FCFS-scheduling algorithm is
used.
Step 6: Calculate the average waiting time and total running time for the processors.
Step 7: Display the result.
Step 8: Stop the program.
PROGRAM:
// PRIORITY SCHEDULING
// vi priority.c
#include<stdio.h>
void swap(int j);
int priority[100];
char procno[100];
float burst[100];
int main()
{
int num,i;
float start=0.00,bt=0.00,sum=0.00,avgwait,wait=0.00;
printf("Enter the number of processes:\n");
scanf("%d",&num);
OUTPUT:
[cse23@localhost cse23]$ cc priority.c
[cse23@localhost cse23]$ ./a.out
Enter the number of processes:
5
Enter the process name, priority and burst time:
a 3 10
b 1 1
c 4 2
d 5 1
e 2 5
Gantt chart
Process Name Priority Start Burst
b 1 0.000000 1.000000
e 2 1.000000 6.000000
a 3 6.000000 16.000000
c 4 16.000000 18.000000
RESULT:
Thus the C program to implement the priority scheduling was executed and output is
verified successfully.
ALGORITHM:
Step 1: Start the program.
Step 2: Get the number of processes from user.
Step 3: Get the value for burst time for individual process.
Step 4: If the process burst time is less then time quantum then process is released by
CPU.
Step 5: Calculate the average waiting time and turnaround time of process.
Step 6: Display the result.
Step 7: Stop the program.
PROGRAM:
// ROUND ROBIN SCHEDULING
// vi roundrobin.c
#include<stdio.h>
main()
{
int st[10],bt[10],wt[10],tat[10],n,tq;
int i,count=0,swt=0,stat=0,temp,sq=0;
float awt=0.0,atat=0.0;
printf("Enter number of processes:");
scanf("%d",&n);
printf("Enter burst time for sequences:");
for(i=0;i<n;i++)
{
scanf("\n%d",&bt[i]);
st[i]=bt[i];
}
OUTPUT:
[cse23@localhost cse23]$ cc roundrobin.c
[cse23@localhost cse23]$ ./a.out
Enter number of processes: 4
Enter burst time for sequences: 5
7
3
9
Enter time quantum: 3
Process_no Burst time Wait time Turn around time
1 5 9 14
2 7 14 21
3 3 6 9
4 9 15 24
Average wait time is 11.000000
Average turnaround time is 17.000000
RESULT:
Thus the C program to implement the round robin scheduling was executed and output
is verified successfully.
ALGORITHM
Step1: Start the program.
Step2: Initialize the required variables.
Step3: Create a pipe.
Step4: Send a message to the pipe.
Step5: Retrieve the message from the pipe and write it to the standard output.
Step5: Send another message to the pipe.
Step6: Retrieve the message from the pipe and write it to the standard output.
Step7: Stop the program
RESULT
Thus the C program to implement inter process communication using PIPE was
executed and output is verified successfully.
AIM:
To write a C program to implement producer consumer problem using semaphore.
ALGORITHM:
Step1: Start the program.
Step2: Declare the semaphores.
Step3: Get the choice from the user.
Step4: If choice is 1, then producer produces the item when buffer is not full.
Step5: If choice is 2, then consumer consumes the item when buffer is not empty.
Step6: If choice is 3, break the process.
Step7: Display the result.
Step8: Stop the program.
PROGRAM:
// PRODUCER CONSUMER PROBLEM
// vi producerconsumer.c
#include<stdio.h>
#include<stdlib.h>
int mutex=1,full=0,empty=3,x=0;
main()
{
int n;
void producer();
void consumer();
int wait(int);
int signal(int);
printf("\n1.PRODUCER\n2.CONSUMER\n3.EXIT\n");
while(1)
{
OUTPUT:
[cse23@localhost cse23]$ cc producerconsumer.c
[cse23@localhost cse23]$ ./a.out
1. PRODUCER
2. CONSUMER
3. EXIT
ENTER YOUR CHOICE 1
producer produces the item1
ENTER YOUR CHOICE 1
producer produces the item2
ENTER YOUR CHOICE 1
producer produces the item3
ENTER YOUR CHOICE 1
BUFFER IS FULL
RESULT:
Thus the C program to implement the producer consumer problem was executed and
output is verified successfully.
AIM
To write a C program to implement for deadlock avoidance using banker’s algorithm
ALGORITHM
Step 1: Start the program.
Step 2: Get the values of resources and processes.
Step 3: Get the avail value.
Step 4: After allocation find the need value.
Step 5: Check whether it is possible to allocate.
Step 6: If it is possible then the system is in safe state.
Step 7: Else system is not in safety state.
Step 8: If the new request comes then check that the system is in safety.
Step 9: Or if not allow the request.
Step 10: Stop the program.
ALGORITHM:
Step 1: Start the Program
Step 2: Obtain the required data through char and in data types.
Step 3: Enter the filename, index block.
Step 4: Print the file name index loop.
Step 5: File is allocated to the unused index blocks
Step 6: This is allocated to the unused linked allocation.
Step 7: Stop the execution
PROGRAM:
//Deadlock Detection algorithm implementation
#include <stdio.h>
#include <conio.h>
void main()
{
int found,flag,l,p[4][5],tp,tr,c[4][5],i,j,k=1,m[5],r[5],a[5],temp[5],sum=0;
clrscr();
printf("Enter total no of processes");
scanf("%d",&tp);
printf("Enter total no of resources");
scanf("%d",&tr);
printf("Enter claim (Max. Need) matrix\n");
for(i=1;i<=tp;i++)
{
printf("process %d:\n",i);
for(j=1;j<=tr;j++)
scanf("%d",&c[i][j]);
}
printf("Enter allocation matrix\n");
for(i=1;i<=tp;i++)
{
printf("process %d:\n",i);
for(j=1;j<=tr;j++)
scanf("%d",&p[i][j]);
OUTPUT:
RESULT:
AIM
To write a C program to implement the threading and synchronization applications.
ALGORITHM
Step1: Start the program.
Step 2: Enter the page size.
Step 3: Enter the logical memory address.
Step 4: Enter the user data.
Step 5: Enter starting position of each page.
Step 6: Enter data to which mapping address to be found.
Step 7: Calculate and display the physical address for the corresponding logical address.
Step 8: Stop the program
1 2 3 4 5 6 7 8 9 10
RESULT
Thus a C program to implement the threading and synchronization applications
was executed and output is verified successfully.
AIM:
To write a C program to implement the memory management scheme using paging.
ALGORITHM:
Step1: Start the program.
Step 2: Enter the page size.
Step3: Enter the logical memory address.
Step 3: Enter the user data.
Step 4: Enter starting position of each page.
Step5: Enter data to which mapping address to be found.
Step 5: Calculate and display the physical address for the corresponding logical address.
Step 7: Stop the program.
PROGRAM:
#include<stdio.h>
void main()
{
int a[20],lmem,pmem,ch,psize,str,b[35],c[10];
int i,j,k,INDEX,page,frame,addr;
printf("\nEnter page size: ");
scanf("%d",&psize);
printf("\nEnter logical memory in bytes: ");
scanf("%d",&lmem);
printf("\nEnter physical memory: ");
scanf("%d",&pmem);
printf("\nEnter user data: ");
for(i=0;i<lmem;i++)
scanf("%d",&a[i]);
for(i=0;i<32;i++)
-1
-1
-1
-1
Enter data to which mapping addr to be found: 3
The physical address of 3 is 11
[osslab@fosslab ~]$
RESULT:
Thus the C program to implement the memory management scheme using paging
algorithm was executed and output is verified successfully.
ALGORITHM:
Step1: Start the program.
Step2: Declare the size.
Step3: Get number of process to be inserted.
Step4: Allocate the first hole that is big enough searching.
Step5: Start at the beginning of the set of holes.
Step6: If not start at the hole that is sharing the previous first fit search end.
Step7: Compare the hole.
Step8: If large enough then stop searching in the procedure.
Step9: Display the value.
Step10: Stop the program.
OUTPUT:
RESULT:
Thus the C program to implement the memory management scheme using first fit
algorithm was executed and output is verified successfully.
AIM:
To write a C program to implement the memory management scheme using worst fit algorithm.
ALGORITHM:
Step1: Start the program.
Step2: Declare the size.
Step3: Get number of process to be inserted.
Step4: Allocate the first hole that is big enough searching.
Step5: Start at the beginning of the set of holes.
Step6: If not start at the hole that is sharing the previous first fit search end.
Step7: Compare the hole.
Step8: If large enough then stop searching in the procedure.
Step9: Display the value.
Step10: Stop the program.
RESULT:
Thus a C program to implement the memory management scheme using worst fit algorithm
was executed and output is verified successfully.
ALGORITHM:
Step1: Start the process
Step2: Declare the size
Step3: Give the number of processes to be inserted
Step4: Allocate the first block that is big enough searching
Step5: Start at the beginning of the set of blocks
Step6: If not start at the block that is sharing the pervious first fit search end
Step7: Compare the block
Step8: if large enough then stop searching in the procedure
Step9: Display the values
Step10: Stop the process
PROGRAM:
#include<stdio.h>
#include<conio.h>
#define max 25
void main()
{
int frag[max],b[max],f[max],i,j,nb,nf,temp,lowest=10000;
static int bf[max],ff[max];
printf("\n\t Best Fit algorithm");
printf("\nEnter the number of blocks:");
scanf("%d",&nb);
printf("Enter the number of files:");
scanf("%d",&nf);
printf("\nEnter the size of the blocks:-\n");
OUTPUT:
RESULT:
Thus a C program to implement the memory management scheme using best fit
algorithm was executed and output is verified successfully.
ALGORITHM
Step 1: Start the process
Step 2: Declare the size with respect to page length
Step 3: Check the need of replacement from the page to memory
Step 4: Check the need of replacement from old page to new page in memory
Step 5: Forma queue to hold all pages
Step 6: Insert the page require memory into the queue
Step 7: Check for bad replacement and page fault
Step 8: Get the number of processes to be inserted
Step 9: Display the values
Step 10: Stop the process
OUTPUT:
Enter the number of pages:
4
enter the reference string:
7
2
1
0
enter the number of frames:
3
ref string page frmaes
7 7 -1 -1
2 7 2 -1
1721
0021
page fault is 4
RESULT:
The program for FIFO page replacement was implemented and hence verified
ALGORITHM
Step 1: Start the process
Step 2: Declare the size
Step 3: Get the number of pages to be inserted
Step 4: Get the value
Step 5: Declare counter and stack
Step 6: Select the least recently used page by counter value
Step 7: Stack them according the selection.
Step 8: Display the values
Step 9: Stop the process
OUTPUT:
MENU
1. Input
2. LRU (Least Recently Used) Algorithm
0. Exit.
Enter your choice.1
Enter the number of page frames : 3
Enter the reference string (-1 for end) : 2
0
1
1
-1
MENU
1. Input
2. LRU (Least Recently Used) Algorithm
0. Exit.
Enter your choice.2
After inserting 2 the stack status is : 2
RESULT:
The program for LRU page replacement was implanted and hence verified.
ALGORITHM
Step 1: Start the process
Step 2: Declare the size
Step 3: Get the number of pages to be inserted
Step 4: Get the value
Step 5: Declare counter and stack
Step 6: Select the least frequently used page by counter value
Step 7: Stack them according the selection.
Step 8: Display the values
Step 9: Stop the process
OUTPUT:
RESULT:
Thus the experiment was successfully compiled and executed
ALGORITHM:
Step 1: Start the Program
Step 2:Obtain the required data through char and int datatypes.
Step 3:Enter the filename,index block.
Step 4: Print the file name index loop.
Step 5:Fill is allocated to the unused index blocks
Step 6: This is allocated to the unused linked allocation.
Step 7: Stop the execution
PROGRAM:
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<graphics.h>
void main()
{
int gd=DETECT,gm,count,i,j,mid,cir_x;
char fname[10][20];
clrscr();
initgraph(&gd,&gm,"c:\tc\bgi");
cleardevice();
setbkcolor(GREEN);
puts("Enter no of files do u have?");
scanf("%d",&count);
for(i=0;i<count;i++)
{ cleardevice();
setbkcolor(GREEN);
printf("Enter file %d name",i+1);
scanf("%s",fname[i]);
setfillstyle(1,MAGENTA);
mid=640/count; cir_x=mid/3;
bar3d(270,100,370,150,0,0);
settextstyle(2,0,4);
settextjustify(1,1);
outtextxy(320,125,"Root Directory");
setcolor(BLUE);
for(j=0;j<=i;j++,cir_x+=mid)
{
line(320,150,cir_x,250);
fillellipse(cir_x,250,30,30);
OUTPUT
RESULT
Thus files were organized into a single level directory.
ALGORITHM:
Step 1: Start the Program
Step 2: Obtain the required data through char and in datatypes.
Step 3: Enter the filename, index block.
Step 4: Print the file name index loop.
Step 5: File is allocated to the unused index blocks
Step 6: This is allocated to the unused linked allocation.
Step 7: Stop the execution
PROGRAM:
#include<stdio.h>
#include<graphics.h>
struct tree_element
{
char name[20];
int x,y,ftype,lx,rx,nc,level;
struct tree_element *link[5];
};
typedef struct tree_element node;
void main()
{
int gd=DETECT,gm;
node *root;
root=NULL;
clrscr();
create(&root,0,"null",0,639,320);
clrscr();
RESULT
Thus user files have been stored in their respective directories and retrieved
easily.
ALGORITHM:
OUTPUT:
RESULT:
Thus the program to implement File Organization concept using the technique
hierarchical level directory was executed successfully.
ALGORITHM
Step 1: Start the Program
Step 2: Obtain the required data through char and int datatypes.
Step 3: Enter the filename, index block.
Step 4: Print the file name index loop.
Step 5: File is allocated to the unused index blocks
Step 6: This is allocated to the unused linked allocation.
Step 7: Stop the execution
RESULT:
Thus the program to implement File Organization concept using the technique DAG was
executed successfully.
ALGORITHM
Step 1: Start the program.
Step 2: Get the number of files.
Step 3: Get the memory requirement of each file.
Step 4: Allocate the required locations to each in sequential order.
a). Randomly select a location from available location s1= random (100);
b). Check whether the required locations are free from the selected location.
c). Allocate and set flag=1 to the allocated locations.
Step 5: Print the results file no., length, Blocks allocated.
Step 6: Stop the program.
RESULT:
Thus the C program to implement the Sequential file allocation strategies was
executed and output is verified successfully.
ALGORITHM:
Step 1: Start the Program
Step 2: Obtain the required data through char and int datatypes.
Step 3: Enter the filename, index block.
Step 4: Print the file name index loop.
Step 5: Fill is allocated to the unused index blocks
Step 6: This is allocated to the unused linked allocation.
Step 7: Stop the execution
OUTPUT:
RESULT:
Thus the C program to implement the Indexed file allocation strategies was executed
and output is verified successfully.
ALGORITHM:
Step 1: Start the Program
Step 2: Obtain the required data through char and int datatypes.
Step 3: Enter the filename, starting block ending block.
Step 4: Print the free block using loop.
Step 5: ‟for‟ loop is created to print the file utilization of linked type of entered type.
Step 6: This is allocated to the unused linked allocation.
Step 7: Stop the execution
RESULT:
Thus the C program to implement the Linked file allocation strategies was executed
and output is verified successfully.
ALGORITHM:
Step 1: Start the program.
Step 2: Declare the variables.
Step 3: Prompt for current position.
Step 4: Get the number of requests for FCFS.
Step 5: Get the request order.
Step 6: Calculate the absolute value.
Step 7: Display the total head movement.
Step 8: Stop the program.
RESULT
Thus a C program to implement FCFS Disk Scheduling Algorithm was executed and
output is verified successfully.
ALGORITHM:
Step 1: Start the program.
Step 2: Declare the variables.
Step 3: Prompt for current position.
Step 4: Get the number of requests for SSTF.
Step 5: Get the request order.
Step 6: Calculate distance of each request from current position.
Step 7: Find the nearest request.
Step 8: Change the current position value to next request.
Step 9: Display the total head movement.
Step 10: Stop the program.
OUTPUT
RESULT
Thus a C program to implement SSTF Disk Scheduling Algorithm was executed and
output is verified successfully.
AIM:
To install Ubuntu Operating System using VMWare.
PROCEDURE:
1) Download & Install VMWare Player.
2) Download Ubuntu by choosing the option of downloading it onto a CD or USB stick.
Remember to choose either 32-bit or 64-bit.
http://www.ubuntu.com/download/desktop
3) Open the VMWare player application. MAKE SURE TO RUN THE PROGRAM AS AN
ADMINISTRATOR. Click on Create a New Virtual Machine.
4) Choose install from Installer disc image file (iso) and browse for the Ubuntu .iso you just
downloaded. Click Next.
6) Enter a name you wish to use for the virtual machine, or you may leave it as is. Click Next.
9) If you are prompted to install VMWare tools, then go ahead and do so.
Installing VMWare tools will support faster graphics performance along with additional
benefits.
More information located here
11) Once fully installed install the VMWare Client Tools driver.
4) If you want X11 forwarding to run for a specific host during your current ssh session do this:
Type:
ssh -X username@servername
ssh -X [email protected]
Press Enter.
Enter your password when prompted to do so.
Note: This command will only enable X11 forwarding for your current session that you are
connected to the maegrad server.
5) Congratulations - you have a Linux VM running!
RESULT
Thus, the Ubuntu Operating System has been installed successfully using VMWare.
AIM :
To write a program to display the Fibonacci series.
ALGORITHM:
OUTPUT :
Enter the limit for Fibonacci:
5
The Fibonacci series is:
0
1
1
2
3
RESULT:
Thus the program has been executed successfully.
AIM:
ALGORITHM:
PROGRAM:
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
int main(void)
{ int fd[2], nbytes;
pid_t childpid;
char string[] = "Hello, world!\n";
char readbuffer[80];
pipe(fd);
if((childpid = fork()) == -1)
{
perror("fork");
exit(1);
}
if(childpid == 0)
{
/* Child process closes up input side of pipe */
close(fd[0]);
/* Send "string" through the output side of pipe */
write(fd[1], string, (strlen(string)+1));
exit(0);
}
else
{
/* Parent process closes up output side of pipe */
OUTPUT:
Hello World
RESULT:
Thus the program has been executed successfully and the output is verified.
4) What is a socket?
A socket is used to make connection between two applications. Endpoints of the connection are
called socket.
6) What is kernel?
Kernel is the core and most important part of a computer operating system which provides basic
services for all parts of the OS.
10) What is the difference between micro kernel and macro kernel?
Micro kernel: micro kernel is the kernel which runs minimal performance affecting services for
operating system. In micro kernel operating system all other operations are performed by
processor.
Macro Kernel: Macro Kernel is a combination of micro and monolithic kernel.
18) What are the four necessary and sufficient conditions behind the
deadlock?These are the 4 conditions:
1) Mutual Exclusion Condition: It specifies that the resources involved are non-sharable.
2) Hold and Wait Condition: It specifies that there must be a process that is holding a resource
already allocated to it while waiting for additional resource that are currently being held by other
processes.
26) What is the difference between logical address space and physical address space?
Logical address space specifies the address that is generated by CPU. On the other hand physical
address space specifies the address that is seen by the memory unit.
30) What is the difference between internal commands and external commands?
Internal commands are the built-in part of the operating system while external commands are the
separate file programs that are stored in a separate folder or directory.
37) What is the difference between logical and physical address space?
Logical address specifies the address which is generated by the CPU whereas physical address
specifies to the address which is seen by the memory unit.
After fragmentation
43) What is the various page replacement algorithms used for page replacement?
FIFO page replacement
Optimal page replacement
LRU page replacement
LRU approximation page replacement
Counting based page replacement
Page buffering algorithm.
44) Define TLB.
Translation Look-Aside Buffer, a table in the processors memory that contains information about
the pages in memory the processor has accessed recently. The TLB enables faster computing
because it allows the address processing to take place independent of the normal address-
translation pipeline.