0% found this document useful (0 votes)
39 views158 pages

Os Lab Record Cse

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views158 pages

Os Lab Record Cse

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 158

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

CS3461 OPERATING SYSTEM LABORATARY

RECORD BOOK

REGULATION-2021

NAME

REG.NO

CLASS / SEM
DEPARTMENTOFCOMPUTER SCIENCE AND ENGINEERING

RECORD NOTE BOOK

NAME
REGNO
YEAR / CLASS / SEC IInd YEAR / CSE / B

SUBJECT CODE / CS3461 /OPERATING SYSTEM


SUBJECT LABORATARY RECORD BOOK
DEPARTMENTOFCOMPUTER SCIENCE AND ENGINEERING

BONAFIDE CERTIFICATE

CERTIFIED THAT THIS IS THE BONAFIDE RECORD WORK DONE BY

REG.NO FOR

THE LABORATORY IN THIS INSTITUTION, AS

PRESCRIBED BY THE ANNA UNIVERSITY , FOR THE YEAR/SEMSTER

DURING THE ACADEMIC YEAR 20 - 20

STAFF IN CHARGE HEAD OF THE DEPARTMENT

SUBMITTED FOR THE ANNA UNIVERSITY PRACTICAL EXAMINATION HELD ON

INTERNAL EXAMINER EXTERNAL EXAMINER


INDEX

EX.NO DATE NAMEOFEXPERIMENT MARKS SIGN

1 Installation Of Windows Operating System

a) Basics Of Unix Commands


b) Shell Programming
i. Concatenation Of Two Strings
2
ii. Comparison Of Two Strings
iii. Maximum Of Three Numbers
iv. Fibonacci Series Case

Process Management Using System Calls : Fork, Exit, Getpid,


Wait, Close
a) Fork System Calls
3 b) Wait System Calls
c) Getpid System Calls
d) Exit System Calls
e) Close System Calls

Write C programs to implement the various CPUScheduling


Algorithms
a) Implementation Of FCFS Scheduling.
4
b) Implementation SJF Scheduling.
c) Implementation Of Priority Scheduling.
d) Implementation Round Robin Scheduling.

5 Inter Process Communication Using Shared Memory

Mutual Exclusion By Semaphore


6

7 Banker's Algorithm For Deadlock Avoidance

8 Deadlock Detection Algorithm

9 Implement Threading

paging Technique
10

Write C Programs to Implement the Following


Memory Allocation Methods
11 a) Memory Management Schemes First Fit
b) Memory Management Schemes Best Fit
c) Memory Management Schemes Worst Fit
Write C Programs to Implement the Various Page Replacement
Algorithms
12 a) Fifo Page Replacement Algorithm
b) LRU Page Replacement Algorithm
c) Optimal (LFU) Page Replacement Algorithm

Write C Programs to Implement the various file organization


techniques
13
a) Single level directory using file organization
b) Two level directory using file organization

Implement the following file allocation strategies using c


programs
14 a) Sequential file allocation
b) Indexed file allocation
c) Linked file allocation

Write C Programs to Implementation of various disk scheduling


algorithms
15 a) FCFS disk scheduling
b) SSTF disk scheduling
c) Scan disk scheduling

16 Install any guest operating system like linux using VMware


INSTITUTE VISION AND MISSION

VISION:

To emerge as a Premier Institute for developing industry ready Engineers with competency, initiative and
character to meet the challenges in global environment.

MISSION:

 To impart state-of-the-art engineering and professional education through strongtheoretical basics and
hands on training to students in their choice of field.

 To serve our students by teaching them leadership, entrepreneurship, teamwork,values, quality, ethics
and respect for others.

 To provide opportunities for long-term interaction with academia and industry.

 To create new knowledge through innovation and research.


DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

VISION

To produce the leaders in the field of Computer Science and Engineering, evolving as a Centre of
Excellence for Learning and Research.

MISSION

Computer Science and Engineering Department is committed,

• To develop globally competent engineers capable of providing secure and Out-of-the Box computing
andcutting-edge technology solutions.

• To provide state-of-art laboratories and quality learning environment.

• To educate students with ethical values and to serve society with innovative, intelligent products
andservices.
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

PROGRAM EDUCATIONAL OBJECTIVES (PEO)

PEO1: Graduates shall apply their technical competence in computer science to solve real world problems, with
technical and people leadership.

PEO2: Graduates shall have Conduct cutting edge research and develop solutions on problems of social
relevance.

PEO3: Graduates shall become leaders Work in a business environment, exhibiting team skills, work
ethics, adaptability and lifelong learning.

PROGRAM SPECIFIC OUT COMES (PSO)

PSO 1 ; Student will be able to Exhibit design and programming skills to build and automate business
solutions using cutting edge technologies.

PSO 2 ; Student will be able to Strong theoretical foundation leading to excellence and excitement towards
research, to provide elegant solutions to complex problems.

PSO 3 ; Student will be able to Ability to work effectively with various engineering fields as a team to
design, build and develop system applications.
PROGRAM OUTCOMES(PO)

Engineering Graduates will be able to:

1. Engineering knowledge: Apply the knowledge of mathematics, science, engineering fundamentals, and
an engineering specialization to the solution of complex engineering problems.

2. Problem analysis: Identify, formulate, review research literature, and analyze complex engineering
problems reaching substantiated conclusions using first principles of mathematics, natural sciences, and
engineering sciences.

3. Design/development of solutions: Design solutions for complex engineering problems and design
system components or processes that meet the specified needs with appropriate consideration for the
public health and safety, and the cultural, societal, and environmental considerations.

4. Conduct investigations of complex problems: Use research-based knowledge and research methods
including design of experiments, analysis and interpretation of data, and synthesis of the information to
provide valid conclusions.

5. Modern tool usage: Create, select, and apply appropriate techniques, resources, and modern
engineering and IT tools including prediction and modeling to complex engineering activities with
an understanding of the limitations.

6. The engineer and society: Apply reasoning informed by the contextual knowledge to assess societal,
health, safety, legal and cultural issues and the consequent responsibilities relevant to the professional
engineering practice.

7. Environment and sustainability: Understand the impact of the professional engineering solutions
insocietal and environmental contexts, and demonstrate the knowledge of, and need for sustainable
development.

8. Ethics: Apply ethical principles and commit to professional ethics and responsibilities and norms
of the engineering practice.

9. Individual and team work: Function effectively as an individual, and as a Member or leader in diverse
teams, and in multidisciplinary settings.

10. Communication: Communicate effectively on complex engineeringactivities with the engineering


community and with society at large, such as, beingable to comprehend and write effective reportsand
design documentation, make effective presentations, and give and receive clear instructions.

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.

12. Lifelong learning: Recognize the need for, an have the preparation and ability to engage in
independentand life-long learning in the broadest context of technological change.
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, Get pid, 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.
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

LABORATORY PLAN

Department : CSE Branch & Year: CSE & II Year


Laboratory : Operating System Laboratory Semester : IV
Subject : Introduction to Operating Systems Subject Code : CS 3461

Sl. Week Week Week


Name Of The Experiment Week 4 Week 5 Week 6
No. 1 2 3

1 Installation of windows operating 


system
Illustrate UNIX commands and Shell
Programming
2 
a) Basics Of Unix Commands
b) Shell Programming
Process Management using System
3 Calls : Fork, Exit, Get pid, Wait, 
Close
Write C programs to implement the
4 
various CPU Scheduling Algorithms

5 Illustrate the inter process 


communication strategy

6 Implement mutual exclusion by 


Semaphore
Sl. Week Week Week Week Week
Name Of The Experiment
No. 7 8 9 10 11

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

Write C programs to implement the


following Memory Allocation
Methods
11 
 First Fit
 Worst Fit
 Best Fit
Additional Experiments (CBS)
Week Week Week Week Week
12 13 14 15 16
Write C programs to implement the
12 various Page Replacement 
Algorithms
Write C programs to Implement the
13 various File Organization 
Techniques
Implement the following File
Allocation Strategies using C
programs
14 a. Sequential 
b. Indexed
c. Linked

Implementing Graphic Class


15 
Methods
Write C programs for the
16 implementation of various disk 
schedulingalgorithms

Date: Signature of Staff In-charge:


Name: Mrs. ANUSHA. P

Date: Signature of HOD :


Name : Dr. JUSTIN JOSE
COURSE DATA SHEET

PROGRAM: UG-COMPUTER SCIENCE AND DEGREE: B.E-CSE


ENGINEERING
COURSE: OPERATING SYSTEMS LABORATORY SEMESTER: IV CREDITS: 1.5
COURSE CODE: CS3461 REGULATION: R2021 COURSE TYPE: CORE /ELECTIVE /
BREADTH/ S&H
COURSE AREA / DOMAIN: OPERATING SYSTEMS CONTACT HOURS: 3 hours/Week.
CORRESPONDING LAB COURSE LAB COURSE NAME (IF ANY):
CODE (IF ANY): CS3461 OPERATING SYSTEMS LABORATORY

SYLLABUS:
Ex No LIST OF EXPERIMENTS HOURS

1 Installation of windows operating system 2

2 Illustrate UNIX commands and Shell Programming 3

3 Process Management using System Calls : Fork, Exit, Getpid, Wait, Close 3

4 Write C programs to implement the various CPU Scheduling Algorithms 3

5 Illustrate the inter process communication strategy 3

6 Implement mutual exclusion by Semaphore 3

7 Write C programs to avoid Deadlock using Banker's Algorithm 3

8 Write a C program to Implement Deadlock Detection Algorithm 3

9 Write C program to implement Threading 2

10 Implement the paging Technique using C program 3

11 Write C programs to implement the following Memory Allocation Methods 3


a) First Fit b) Worst Fit c) Best Fit
12 Write C programs to implement the various Page Replacement Algorithms 3

13 Write C programs to Implement the various File Organization Techniques 3

14 Implement the following File Allocation Strategies using C programs 3


a) Sequential b) Indexed c) Linked
15 Write C programs for the implementation of various 3
disk scheduling algorithms
16 Install any guest operating system like Linux using VMware. 2

TOTAL HOURS 45 Periods


TEXT/REFERENCE BOOKS:

T/R BOOK TITLE / AUTHORS / PUBLICATION

Abraham Silberschatz, Peter Baer Galvin and Greg Gagne, “Operating System Concepts”,
T
10thEdition, John Wiley and Sons Inc., 2018.
T Andrew S Tanenbaum, "Modern Operating Systems", Pearson, 5th Edition, 2022 New Delhi
T Abraham Silberschatz, Peter Baer Galvin and Greg Gagne, “Operating System Concepts”, 9th
Edition, John Wiley and Sons Inc., 2012.
R D M Dhamdhere, “Operating Systems: A Concept-Based Approach”, Second Edition,
TataMcGraw-Hill Education, 2007.

COURSE PRE-REQUISITES:

C.CODE COURSE NAME DESCRIPTION SEM

Background in computer programming for to be


GE6161 Computer Practices Lab I
familiar with programming concepts.
Learn linear data structures – list, stack, and queue and
Programming and Data exposed to sorting, searching, hashing algorithms so II
CS6202
Structures I Lab that AI problem Solving will be easier

COURSE OBJECTIVES:

1 To install windows operating systems


2 To understand the basics of Unix command and shell programming.
3 To implement various CPU scheduling algorithms.
4 To implement Deadlock Avoidance and Deadlock Detection Algorithms
5 To implement Page Replacement Algorithms
6 To implement various memory allocation methods.
7 To be familiar with File Organization and File Allocation Strategies.

COURSE OUTCOMES:
BLOOMS
PO(1..12) PSO(1,2,3)
S.NO TAXONOMY DESCRIPTION
LEVEL
MAPPING MAPPING
Remembring
C217.1 Define and implement UNIX Commands. PO1,PO3 PSO1, PSO3
(Level 1)
Analyzing Compare the performance of various CPU
C217.2 PO1,PO3,PO5 PSO1, PSO3
(level 4) Scheduling Algorithms.
Analyzing Compare and contrast various Memory
C217.3 PO3,PO6 PSO1, PSO3
(level 4) Allocation Methods.
Rememberin
Define File Organization and File
C217.4 g PO3,PO6 PSO1, PSO3
Allocation Strategies.
(Level 1)
Applying Implement various Disk Scheduling PO1, PO2,
C217.5 PSO1, PSO3
(Level 3) Algorithms. PO5
COURSE OVERALL PO/PSO MAPPING:
COURSE OUTCOMES VS POs MAPPING (DETAILED; HIGH: 3; MEDIUM: 2; LOW: 1):

PO PO PO PO PO PO PO PO PO PO PO PO PS PS PS
S.NO.
1 2 3 4 5 6 7 8 9 10 11 12 O1 O2 O3
C217.1 3 2 3 2 3 2 2 3 2 1
C217.2 3 2 3 2 3 2 2 3 3 2
C217.3 2 3 3 3 2 3 2 2 2 3
C217.4 2 3 3 2 3 3 2 2 3 2
C217.5 3 2 2 3 2 3 3 3 3 2
C217 2.5 3 3 2 3 2 3 2 2.5 2
* For Entire Course, PO & PSO Mapping

POs & PSO REFERENCE:

Exhibit design and programming


Engineering Environment & skills to build and automate
PO1 PO7 PSO1
Knowledge Sustainability business solutions using cutting
edge technologies
Strong theoretical foundation
leading to excellence and
Problem
PO2 PO8 Ethics PSO2 excitement towards research, to
Analysis
provide elegant solutions to
complex problems.

bility to work effectively with


Design & Individual & Team
PO3 PO9 PSO3 various engineering fields as a
Development Work
team to design, build and develop
system applications.
PO4 Investigations PO10 Communication Skills
Project Mgt. &
PO5 Modern Tools PO11
Finance
Engineer &
PO6 PO12 Life Long Learning
Society

COs VS POs MAPPING JUSTIFICATION:

PO/PSO LEVEL OF
S.NO JUSTIFICATION
MAPPED MAPPING
Student will be able to Apply the knowledge of mathematics,
C217.1 PO1 H science, engineering fundamentals, and an engineering
specialization to the solution of complex engineering
problems.
Student will be able to Identify, formulate, review research
C217.1 PO2 M literature, and analyze complex engineering problems
reaching substantiated conclusions using first principles of
mathematics, natural sciences, and engineering sciences.
Student will be able to Design solutions for complex
engineering problems and design system components or
C217.1 PO3 H processes that meet the specified needs with appropriate
consideration for the public health and safety, and the
cultural, societal, and environmental considerations.
Student will be able to Use research-based knowledge and
C217.1 PO4 M research methods including design of experiments, analysis
and interpretation of data, and synthesis of the information to
provide valid conclusions.
Student will be able to Create, select, and apply appropriate
C217.1 PO5 H techniques, resources, and modern engineering and IT tools
including prediction and modeling to complex engineering
activities with an understanding of the limitations.
Student will be able to Function effectively as an individual,
C217.1 PO9 M and as a member or leader in diverse teams, and in
multidisciplinary settings.
Student will be able to Communicate effectively on complex
engineering activities with the engineering community and
C217.1 PO10 M 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.
Student will be able to Demonstrate knowledge and
understanding of the engineering and management principles
C217.1 PO11 H and apply these to one’s own work, as a member and leader
in a team, to manage projects and in multidisciplinary
environments.
Student will be able to Exhibit design and programming
C217.1 PSO1 M skills to build and automate business solutions using cutting
edge technologies.
Student will be able to Ability to work effectively with
C217.1 PSO3 L various engineering fields as a team to design, build and
develop system applications.
Student will be able to Apply the knowledge of mathematics,
C217.2 PO1 H science, engineering fundamentals, and an engineering
specialization to the solution of complex engineering
problems.
Student will be able to Identify, formulate, review research
C217.2 PO2 M literature, and analyze complex engineering problems
reaching substantiated conclusions using first principles of
mathematics, natural sciences, and engineering sciences.
Student will be able to Design solutions for complex
engineering problems and design system components or
C217.2 PO3 H processes that meet the specified needs with appropriate
consideration for the public health and safety, and the
cultural, societal, and environmental considerations.
Student will be able to Use research-based knowledge and
C217.2 PO4 M research methods including design of experiments, analysis
and interpretation of data, and synthesis of the information to
provide valid conclusions.
Student will be able to Create, select, and apply appropriate
C217.2 PO5 H techniques, resources, and modern engineering and IT tools
including prediction and modeling to complex engineering
activities with an understanding of the limitations.
Student will be able to Function effectively as an individual,
C217.2 PO9 M and as a member or leader in diverse teams, and in
multidisciplinary settings.
Student will be able to Communicate effectively on complex
engineering activities with the engineering community and
C217.2 PO10 M 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
Student will be able to Demonstrate knowledge and
understanding of the engineering and management principles
C217.2 PO11 H and apply these to one’s own work, as a member and leader
in a team, to manage projects and in multidisciplinary
environments.
Student will be able to Exhibit design and programming
C217.2 PSO1 M skills to build and automate business solutions using cutting
edge technologies.
Student will be able to Ability to work effectively with
C217.2 PSO3 L various engineering fields as a team to design, build and
develop system applications.
Student will be able to Apply the knowledge of mathematics,
C217.3 PO1 H science, engineering fundamentals, and an engineering
specialization to the solution of complex engineering
problems.
Student will be able to Identify, formulate, review research
C217.3 PO2 M literature, and analyze complex engineering problems
reaching substantiated conclusions using first principles of
mathematics, natural sciences, and engineering sciences.
Student will be able to Design solutions for complex
engineering problems and design system components or
C217.3 PO3 H processes that meet the specified needs with appropriate
consideration for the public health and safety, and the
cultural, societal, and environmental considerations.
Student will be able to Use research-based knowledge and
C217.3 PO4 M research methods including design of experiments, analysis
and interpretation of data, and synthesis of the information to
provide valid conclusions.
Student will be able to Create, select, and apply appropriate
C217.3 PO5 H techniques, resources, and modern engineering and IT tools
including prediction and modeling to complex engineering
activities with an understanding of the limitations.
Student will be able to Function effectively as an individual,
C217.3 PO9 M and as a member or leader in diverse teams, and in
multidisciplinary settings.
Student will be able to Communicate effectively on complex
engineering activities with the engineering community and
C217.3 PO10 M 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.
Student will be able to Demonstrate knowledge and
understanding of the engineering and management principles
C217.3 PO11 H and apply these to one’s own work, as a member and leader
in a team, to manage projects and in multidisciplinary
environments.
Student will be able to Exhibit design and programming
C217.3 PSO1 M skills to build and automate business solutions using cutting
edge technologies.
Student will be able to Ability to work effectively with
C217.3 PSO3 L various engineering fields as a team to design, build and
develop system applications.
Student will be able to Apply the knowledge of mathematics,
C217.4 PO1 H science, engineering fundamentals, and an engineering
specialization to the solution of complex engineering
problems.
Student will be able to Identify, formulate, review research
C217.4 PO2 M literature, and analyze complex engineering problems
reaching substantiated conclusions using first principles of
mathematics, natural sciences, and engineering sciences.
Student will be able to Design solutions for complex
C217.4 PO3 H engineering problems and design system components or
processes that meet the specified needs with appropriate
consideration for the public health and safety, and the
cultural, societal, and environmental considerations.

Student will be able to Use research-based knowledge and


C217.4 PO4 M research methods including design of experiments, analysis
and interpretation of data, and synthesis of the information to
provide valid conclusions.
Student will be able to Create, select, and apply appropriate
C217.4 PO5 H techniques, resources, and modern engineering and IT tools
including prediction and modeling to complex engineering
activities with an understanding of the limitations.
Student will be able to Function effectively as an individual,
C217.4 PO9 M and as a member or leader in diverse teams, and in
multidisciplinary settings.
Student will be able to Communicate effectively on complex
engineering activities with the engineering community and
C217.4 PO10 M 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.
Student will be able to Demonstrate knowledge and
understanding of the engineering and management principles
C217.4 PO11 H and apply these to one’s own work, as a member and leader
in a team, to manage projects and in multidisciplinary
environments.
Student will be able to Exhibit design and programming
C217.4 PSO1 M skills to build and automate business solutions using cutting
edge technologies.
Student will be able to Ability to work effectively with
C217.4 PSO3 L various engineering fields as a team to design, build and
develop system applications.
Student will be able to Apply the knowledge of mathematics,
C217.5 PO1 H science, engineering fundamentals, and an engineering
specialization to the solution of complex engineering
problems.
Student will be able to Identify, formulate, review research
C217.5 PO2 M literature, and analyze complex engineering problems
reaching substantiated conclusions using first principles of
mathematics, natural sciences, and engineering sciences.
Student will be able to Design solutions for complex
engineering problems and design system components or
C217.5 PO3 H processes that meet the specified needs with appropriate
consideration for the public health and safety, and the
cultural, societal, and environmental considerations.
Student will be able to Use research-based knowledge and
C217.5 PO4 M research methods including design of experiments, analysis
and interpretation of data, and synthesis of the information to
provide valid conclusions.
Student will be able to Create, select, and apply appropriate
C217.5 PO5 H techniques, resources, and modern engineering and IT tools
including prediction and modeling to complex engineering
activities with an understanding of the limitations.
Student will be able to Function effectively as an individual,
C217.5 PO9 M and as a member or leader in diverse teams, and in
multidisciplinary settings.
Student will be able to Communicate effectively on complex
engineering activities with the engineering community and
C217.5 PO10 M 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
Student will be able to Demonstrate knowledge and
understanding of the engineering and management principles
C217.5 PO11 H and apply these to one’s own work, as a member and leader
in a team, to manage projects and in multidisciplinary
environments.
Student will be able to Exhibit design and programming
C217.5 PSO1 M skills to build and automate business solutions using cutting
edge technologies.
Student will be able to Ability to work effectively with
C217.5 PSO3 L various engineering fields as a team to design, build and
develop system applications.
Student will be able to Apply the knowledge of mathematics,
C217 PO1 H science, engineering fundamentals, and an engineering
specialization to the solution of complex engineering proble.
Student will be able to Identify, formulate, review research
C217 PO2 M literature, and analyze complex engineering problems
reaching substantiated conclusions using first principles of
mathematics, natural sciences, and engineering sciences.
Student will be able to Design solutions for complex
engineering problems and design system components or
C217 PO3 H processes that meet the specified needs with appropriate
consideration for the public health and safety, and the
cultural, societal, and environmental considerations.
Student will be able to Use research-based knowledge and
C217 PO4 M research methods including design of experiments, analysis
and interpretation of data, and synthesis of the information to
provide valid conclusions.
Student will be able to Create, select, and apply appropriate
C217 PO5 H techniques, resources, and modern engineering and IT tools
including prediction and modeling to complex engineering
activities with an understanding of the limitations.
Student will be able to Function effectively as an individual,
C217 PO9 M and as a member or leader in diverse teams, and in
multidisciplinary settings.
Student will be able to Communicate effectively on complex
engineering activities with the engineering community and
C217 PO10 M 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.
Student will be able to Demonstrate knowledge and
understanding of the engineering and management principles
C217 PO11 H and apply these to one’s own work, as a member and leader
in a team, to manage projects and in multidisciplinary
environments.
Student will be able to Exhibit design and programming
C217 PSO1 M skills to build and automate business solutions using cutting
edge technologies.
Student will be able to Ability to work effectively with
C217 PSO3 L various engineering fields as a team to design, build and
develop system applications.
Student will be able to Apply the knowledge of mathematics,
C217 PO1 H science, engineering fundamentals, and an engineering
specialization to the solution of complex engineering
problems.
GAPES IN THE SYLLABUS - TO MEET INDUSTRY/PROFESSION REQUIREMENTS, POs &
PSOs:

PROPOSED
S.NO. DESCRIPTION
ACTIONS
1 Linux commands and shell scripting ASSIGNMENT

PROPOSED ACTIONS: TOPICS BEYOND SYLLABUS/ASSIGNMENT/INDUSTRY VISIT/GUEST LECTURER/NPTEL ETC

TOPICS BEYOND SYLLABUS/ADVANCED TOPICS/DESIGN:

1 Kernel Security
2 Kernel stack overflows elimination

WEB SOURCE REFERENCES:

1 http://www.brokenthorn.com/Resources/OSDev13.html

2 http://www.osnews.com/story/24405/Hobby_OS-deving_3_Designing_a_Kernel/

3 http://nptel.ac.in/courses/106106144/

4 http://nptel.ac.in/courses/106108101/

5 http://ww5.linuxdrivers.net/

DELIVERY/INSTRUCTIONAL METHODOLOGIES:

☐ CHALK & TALK ☐ STUD. ASSIGNMENT ☐ WEB RESOURCES ☐ NPTEL/OTHERS

☐ LCD/SMART BOARDS ☐ STUD. SEMINARS ☐ ADD-ON COURSES ☐ WEBNIARS

ASSESSMENT METHODOLOGIES-DIRECT
☐ TESTS/MODEL ☐ UNIV.
☐ ASSIGNMENTS ☐ STUD. SEMINARS
EXAMS EXAMINATION

☐ STUD. LAB ☐ MINI/MAJOR ☐


☐ STUD. VIVA
PRACTICES PROJECTS CERTIFICATIONS

☐ ADD-ON COURSES ☐ OTHERS

ASSESSMENT METHODOLOGIES-INDIRECT
☐ ASSESSMENT OF COURSE OUTCOMES ☐ STUDENT FEEDBACK ON FACULTY
(BY FEEDBACK, ONCE) (TWICE)

☐ ASSESSMENT OF MINI/MAJOR PROJECTS


☐ OTHERS
BY EXT. EXPERTS
INNOVATIONS IN TEACHING/LEARNING/EVALUATION PROCESSES:

1. For detail understanding of OS fundamentals NPTEL and Tutorial point is used


2. Advanced concepts in OS are taught with presentation
3. OS issues can be visualized with video lectures
4. Real Time Example
5. Analytics of Emotions

Prepared by Approved by
ANUSHA P Dr. JUSTIN JOSE
(Assit. Prof) (HOD)
EXP No : 1
INSTALLATION OF WINDOWS OPERATING SYSTEM
DATE :

AIM

Installation of windows Operating System.

WINDOW INSTALLTION REPORT:

HOW TO MAKE USB BOOTABLE USING RUFUS

Make sure that you are using Usb Drive that is At least 4gb For The 32-Bit- Version and 8gb forthe 64-Bit
Version.

Rufus is one of several programs that allow you to create an “ISO image” on a USB drive. Tocreate a
bootable USB using Rufus, all we need is:

 ISO of our choice, e.g. Windows 10


 Any version of Rufus
 A spare USB drive (an 8GB USB should be plenty for Windows 10 but make sure youhave one that’s large
enough for the ISO you’re using)

DOWNLOADING WINDOWS ISO

STEP 1: Navigate to http://www.microsoft.com/en-us/software-download/windows 10 site &choose the

Download tool now button.


STEP 2: (a) Run the Media Creation Tool.exe. to upgrade or download Windows 10. STEP 3: At the next

screen, choose Create Installation media for another PC & pressNext.

Important Notes

1. In order to perform a clean installation of Windows 10, you must own a valid Windows 10product
key to activate Windows.

2. If you bought a pre-installed Windows 10 computer (on which the OS was pre-installed fromthe
computer manufacturer), then the product key is stored in BIOS and it will be retrieved automatically (from
BIOS) during Windows installation.

3. If you’re currently running Windows 8.1 or Windows 7 SP1 (already activated), and you wantto
upgrade your computer to Windows 10 select “Upgrade this PC now” at the next screen & then follow the
onscreen instruction to upgrade your OS to Windows 10.

STEP 4: Choose the Windows 10 Edition that you want to download and click Next.Important Notes

1. If you want to install Windows 10 on the current PC, leave the Use the recommendedoptions for this PC
box checked. At this case the Media Creation Tool will create a Windows 10 installation disk with the same
language, edition, and architecture as thecurrent PC.
STEP 7: Choose the destination location (where the ISO file will be saved/stored) & press Save.

STEP 8: When the Windows 10 ISO download is completed then:

1. Click Open DVD burner and place a blank DVD disk on the DVRW tray in order to createimmediately a
bootable Windows 10 DVD installation/repair disk, or

2. Click Finish.
EXP No : 2a
BASICS OF UNIX COMMANDS
DATE :

AIM:

To study and execute the commands in unix.

COMMAND:

1. Date Command:

This command is used to display the current data and time.

Syntax:

Sdate Sdate +chOptions:

a = Abbrevated weekday. A = Full weekday.

B Abbrevated month. B = Full month.C Current day and time.

C = Display the century as a decimal number.D = Day of the month.

D Day in mm/dd/yy? Formath = Abbrevated month day. H Display the hour.

L = Day of the year.

M = Month of the year.M = Minute.

P = Display AM or PM
S = Seconds

T= HH:MM:SS formatu = Week of the year.

Y= Display the year in 2 digit.Y = Display the full year.

Z = Time zone

To change the format:

Syntax:

$date “+%H-%M-%S”

2. Calender Command:

This command is used to display the calendar of the year or the particular month of calendaryear.

a. $cal <year>

b. $cal <month><year>

Here the first syntax gives the entire calendar for given year & the second Syntax gives thecalendar of
reserved month of that year.
3. Echo Command:

This command is used to print the arguments on the screen.

Syntax: Secho <text>

Multi line echo command:

To have the output in the same line, the following commands can be used

Syntax Secho
<text>text

To have the output in different line, the following command can be used.

Syntax: Secho ?text

>line2

>line3?

4. ‘who’ Command:
It is used to display who are the users connected to our computer currently.

Syntax: $who-option’s

Options:-

H-Display the output with headers.

b-Display the last booting date or time or when the system was lastely rebooted.

5. ‘who am i’ Command:
Display the details of the current working directory.

Syntax: $who am i

6. ‘tty’ Command:
It will display the terminal name.

Syntax:$tty

7. ‘Binary’ Calculator Command:


It will change the “$” mode and in the new mode, arithmetic operations such as +,-,*,/,%,n,sqrt(),
length(),=, etc can be performed. This command is used to go to the binary calculus mode.

$bc operations

^d

$
1 base- inputbase

O base- outputbase are used for base conversions.

Base:

Decimal = 1 Binary = 2 Octal = 8 Hexa = 16

8. ‘CLEAR’ Command:
It is used to clear the screen.

Syntax: Sclear

9. ‘MAN’ Command:
It helps us to know about the particular command and its options & working. It is like “help”command in
windows.

Syntax: Sman <command name>

10. MANIPULATION Command:


It is used to manipulate the screen.Syntax: Stput <argument> Arguments:

1. Clear to clear the screen.

2. Longname – Display the complete name of the terminal.


3. SMSO background become white and foreground become black color.

4. rmso – background become black and foreground becomes white color.


11. LIST Command:

It is used to list all the contents in the current working directory.

Syntax: $ is options <argument>

If the command does not contain any argument means it is working in the Currentdirectory.

Options:
a. used to list all the files including the hidden files.
c-list all the files columnwise.
d- list all the directories.
m-list the files separated by commas.
p- list files include “/” to all the directories.
r- list the files in reverse alphabetical order.
f-list the files based on the list modification date.
x-list in column wise sorted order.
DIRECTORY RELATED COMMANDS:

1. Present Working Directory Command:


To print the complete path of the current working directory.

Syntax: $pwd

2. MKDIR Command:
To create or make a new directory in a current directory.

Syntax:$mkdir <directory name>

3. CD Command:
To change or move the directory to the mentioned directory.

Syntax: $ed <directory name>

4. RMDIR Command:
To remove a directory in the current directory & not the current directory itself.

Syntax: $rmdir <directory name>

FILE RELATED COMMANDS:

1. CREATE A FILE:

To create a new file in the current directory we use CAT command.

Syntax: $cat filename

The > symbol is redirectory we use cat command.

2. DISPLAY A FILE:

To display the content of file mentioned we use CAT command without “>” operator.

Syntax:$cat 18ilename

3. COPYING CONTENTS:

To copy the content of one file with another. If file doesnot exist, a new file is created and if thefile exists
with some data then it is overwritten.

$cat <filename source>>><destination filename>

$cat <source filename>>><destination filename> it is avoid overwriting.

Options:-

-n content of file with numbers included with blank lines.

Syntax:

$cat ?n <filename>
4. SORTING A FILE:
To sort the contents in alphabetical order in reverse order.

Syntax:

$sort<filename>

5. COPYING CONTENTS FROM ONE FILE TO ANOTHER:


To copy the contents from source to destination file. So that both contents are same.

Syntax:

$ep <source filename><destination filename>

6. MOVE Command:
To completely move the contents from source file to destination file and to remove the sourcefile.

Syntax:

$ my <source filename><destination filename>

7. REMOVE Command:
To permanently remove the file we use this command.

Syntax:

$em <filename>

8. WORD Command:
To list the content count of no of lines, words, characters.\

Synatx:

$uc <filename>

Option –to display no of characters.

- display only the lines. W-to display the no of words.

9. LINE PRINTER:
To print the line through the printer, we use Ip command.

$lp <filename>

10. PAGE Command:


This command is used to display the contents of the file page wire & next page can be wed bypressing the
enter key.

Syntax:

$pg <filename>
11. FILTERS AND PIPES:
HEAD: It is used to display the top ten lines of file.

Syntax: $head-<filename>

TAIL: This command is used to display the last ten lines of file.

Syntax: $tail<filename>

PAGE: This command shows the page by page a screen full of information is displayed her which the page
command displays a prompt and passes for the user to strike the enter key tocontinue scrolling.

MORE: It also displays the file page by page. To continue scrolling with more command, pressthe space
bar key.

Syntax: $more<filename>

GREP: This command is used to search and print the specified patterns from the file.

Syntax: $grep [aption] pattern <filename>

SORT: This command is used to sort the data in some order.Syntax: $sort<filename>

PIPE: It is a mechanism by which the output of one command can be channeled into the inputof another
command.

Syntax: $who | we –l

TR: The tr filter is used to translate one set of characters from the standard inputs to another.Syntax: $tr “[a-

z]”“[A-Z]”

COMMUNICATION THROUGH UNIX COMMANDS

1. Commmand:MESG
Description: The message command is used to give permission to other users send message toyour terminal.

Syntax: $mesg y

2. Command: WRITE
Description: This command is used to communicate with other users, who are logged in at thetime.

In at the same time.

Syntax: $write <user name>


3. Command: WALL
Description: This command sends message to all users those who are logged in using the unixserver.
Syntax: $wall <message>
4. Command: MAIL
Description: It refers to textual information, which can be transferred from one user to another

Syntax: $mail <user name>

5. Command: REPLY
Description: It is used to send reply to specified user.

Syntax: $reply<user name>

Result:

Thus the basic unix commands has been studied and executed successfully.
EXP No : 2b(i)
SHELL PROGRAMMING - CONCATENATION OF TWO STRINGS
DATE :

AIM:

To write a simple shell programs using unix commands.2

ALGORITHM:

Step1: Define two strings to be concatenated, say "string1" and "string2".

Step2 : To concatenate the two strings and store the result in a new variable,

say" theconcatenated string is ":

Step3: Print the concatenated string using the "echo" command.

Step 4:Stop.
PROGRAM:

echo "enter the first string"

read str1

echo "enter the second string"

read str2

echo "the concatenated string is" $strl $str2

OUTPUT:

Enter first string: Hello Enter first string: World

The concatenated string is Hello World.


EXP No : 2b(ii)
SHELL PROGRAMMING - COMPARISON OF TWO STRINGS
DATE :

AIM:

To write a simple shell programs using unix commands.2

ALGORITHM:

Step 1:Define the two strings as str1,str2.

Step 2:if [$str1=$str2]

Print strings are equal

Step 3: else

Print strings are not equal

Step 4: Stop
PROGRAM:

echo "enter the first string"

read strl

echo "enter the second string"

read str2

if [ $strl = $str2]

then

echo "strings are equal"

else

echo "strings are unequal"

fi

OUTPUT:

SAMPLE 1:

Enter first string: hai

Enter second string: hai.

The two strings are equal

SAMPLE 2:

Enter first string: hai

Enter second string: cse

The two strings are not equal


EXP No : 2b(iii)
SHELL PROGRAMMING - MAXIMUM OF THREE NUMBERS
DATE :

AIM:

To write a simple shell programs using unix commands.2

ALGORITHM:

Step 1: Prompt the user to enter a values for A ,B,C using the `echo`
command.

Step 2:Read the values of A,B ,C using the `read` command and store it in the
variable`a`,’b’,’c’.

Step 3: Compare the values of A, B, and C using if-elif-else statements:

Step 3.1: If A is greater than both B and C, output "A is greater" using the `

echo` command.

Step 3.2:Else if B is greater than both A and C, output "B is greater" using

the `echo` command.

Step 3.3: Else, output "C is greater" using the `echo` command.

Step 4:Stop.
PROGRAM:

echo "Enter A:"

read a

echo "Enter B:"

read b

echo "Enter C:"

read c

if [ $a -gt $b ] && [ $a -gt $c ];

then

echo "A is greater"

elif [ $b -gt $a ] && [ $b -gt $c ];

then

echo "B is greater"

else

echo "C is greater"

fi

OUTPUT:

Enter A:23

Enter B:45

Enter C:67

C is greater
EXP No : 2b(iv)
SHELL PROGRAMMING - FIBONACCI SERIES
DATE :

AIM:

To write a simple shell programs using unix commands.2

ALGORITHM:

Step 1:Start.

Step 2:Declare variables i, a,b , show.

Step 3:Initialize the variables, a=0, b=1, and show =0.

Step 4:Enter the number of terms of Fibonacci series to be printed.

Step 5:Print First two terms of series.

Step 6:Use loop for the following steps

Step 6.1: show=a+b

Step 6.2: a=b

Step 6.3:b=show

Step 6.4:increase value of i each time by 1

Step 6.5:print the value of show

Step 7:End
PROGRAM:

echo “enter the number”

read n

a=-1
b=1
i=0

while [ $i ?le $n ]
do

t=’expr $a +$b’
echo $t
a=$b
b=$t
i=’expr $i + 1

done

OUTPUT:

Enter the no: 5

0
1
1
2
3
5
EXP No : 2b(v)
SHELL PROGRAMMING - ARITHMETIC OPERATIONS
USING CASE
DATE :

AIM:

To write a simple shell programs using unix commands.2

ALGORITHM:

Step 1: Start

Step 2: Read the two Numbers.

Step 3: Get the operation choice from the User


Step 4: Give the expressions for each case and solve them.

Step 5: Print the Result

Step 6: Stop
PROGRAM:

echo “ 1.Addition”

echo “2.Subraction”

echo “ 3.Multiplication”

echo “ 4.Division”

echo “enter your choice”

read a

echo “enter the value of b”

read b

echo “enter the value of c”

read c

echo” b is $b c is $c

”case $a in

Id='expr $b+ $c’ 1)

echo “the sum is $d”

::

2) d='expr $b -$c
echo” the difference is $d”

::

3) d='expr $b \ $c
echo “the product is $d”

::

4) d='expr $b / $c
echo “the quotient is $d”

::

esac
OUTPUT:

1.Addition

2.Subraction

3.Multiplication

4.Division

Enter your choice:1

Enter the value of b:3

Enter the value of c:4

b is 3 c is 4

the sum is 7

RESULT:

Thus the given shell programs are implemented and output is verified successfully.
EXP No : 3(a)
PROCESS MANAGEMENT USING SYSTEM CALLS: FORK
DATE :

AIM:

To create a process management using system calls :fork,exit,getid,wait close.

FORK:

ALGORITHM:

Step 1: Declare a variable x to be shared by both child and parent.

Step 2: Create a child process using fork system call.

Step 3: If return value is -1 then

Print "Process creation unsuccessfull"Terminate using exit system call.

Step 4: If return value is 0 thenPrint "Child process"

Print process id of the child using getpid system callPrint value of x

Print process id of the parent using getppid system call

Step 5: Otherwise
Print "Parent process"

Print process id of the parent using getpid system callPrint value of x

Print process id of the shell using getppid system call.

Step 6: Stop
PROGRAM:

#include<stdio.h>

#include<stdlib.h>

#include <unistd.h>

#include<sys/types.h>

int main(int argc, char **argv)

pid_t pid:

pid = fork();

if (pid==0)

printf("It is the child process and pid is %d\n".getpid());

exit(0);

else if(pid > 0)

printf("It is the parent process and pid is %d\n".getpid());

else

printf("Error while forking\n");

exit(EXIT_FAILURE);

return 0;

}
OUTPUT:

It is the parent process and pid is 2528

It is the child process and pid is 2529


EXP No : 3(b)
WAIT SYSTEM CALL
DATE :

AIM:

To create a process management using system calls :fork,exit,getid,wait close.

ALGORITHM:

Step 1:Define the main function with an integer return type and two arguments: argc` and
`argv`.

Step 2:Declare a variable `pid` of type `pid_t` to store the process ID returned by the fork()system call.

Step 3:Call the `fork()` system call to create a new process. The return value of `fork()` will be0 in the child
process and a positive integer (the child's PID) in the parent process. If `fork()` returns a negative value,
print an error message and exit the program with a failure status.

Step 3.1:If `pid` is equal to 0, the code inside the `if` block will be executed in the child process.Print a
message indicating that it is the child process and print its process ID using `getpid()`.

Step 4:Use a for loop to print the numbers from 0 to 7.

Step 5:Exit the child process with a status of 0 using the `exit()` function. If `pid` is greater than0, the code
inside the `else if block will be executed in the parent process. Print a message indicating that it is the
parent process and print its process ID using `getpid()`.

Step 6:Declare a variable `status` of type `int` to store the exit status of the child process.

Step 7:Call the `wait()` system call to wait for the child process to terminate and store its exitstatus in
`status`.

Step 8:Print a message indicating that the child process has been reaped.

Step 9:If `fork()` returns a negative value, print an error message and exit the program with afailure status.

Step 10:Return 0 to indicate success.


PROGRAM:

#include<stdio.h> // printf()

#include<stdlib.h> // exit()

#include<sys/types.h> // pid_t

#include<sys/wait.h> // wait()

#include <unistd.h> // fork


int main(int argc, char **argv)

{pid_t pid

; pid = fork():
if(pid==0)

printf "It is the child process and pid is %d\n".getpid());

int i;
for(i=0;i<8;i++)

{ printf("%d\n",i);

) exit(0);

} else if(pid > 0)

printf("It is the parent process and pid is %d\n",getpid());

int status;
wait(&status);
printf("Child is reaped\n");
}
else
{printf("Error in forking..\n")
;exit(EXIT_FAILURE);
}
return 0;
}
OUTPUT:

It is the parent process and pid is 2535

It is the child process and pid is 2536 0


1

Child is reaped
EXP No : 3(c)
GETPID SYSTEM CALL
DATE :

AIM:

To create a process management using system calls :fork,exit,getid,wait close.

ALGORITHM:

Step 1:Define the main function with an integer return type.

Step 2:Use an `if` statement to call the `fork()` system call.

Step 3:If the return value of `fork()` is less than 0, print an error message indicating that theprocess ID
could not be obtained and exit the program with a status of 1.
Step 4:If the return value of `fork()` is greater than or equal to 0, continue to the next step.

Step 5:In the parent process, call the `getpid()` system call to obtain the process ID and store itin an integer
variable `pid_t`.

Step 6:Print the process ID using `printf`.

Step 7:Print a message indicating that the process ID was obtained.

Step 8:Call the 'sleep() function for 1 second to delay the execution of the program.

Step 9:Exit the parent process with a status of 0.

Step 10:Return 0 to indicate success.


PROGRAM:

#include <stdio.h>

#include <sys/types.h>

int main(void)

if((fork())<0)

printf("process id is not obtained\n");

exit(1);

else

int pid_t= getpid();

printf("Process id is %d\n",pid_1):

printf("process id is greater than 0. It is obtained.\n");

sleep(1);

exit(0);
}

return 0;

}
EXP No : 3(d)
EXIT SYSTEM CALL
DATE :

AIM:

To create a process management using system calls :fork,exit,getid,wait close.

ALGORITHM:

Step 1:Declare two integer variables `` and `num`.

Step 2:Prompt the user to enter the last number and read the input using `scanf`.

Step 3:Use a `for loop to iterate from 1 to `num-1`.

Step 4:Inside the loop, use an `if` statement to check if the value of `` is equalto 6.

Step 5:If the condition is true, terminate the program using the `exit()` function with anargument of 0 to
indicate successful termination.

Step 6:If the condition is false, print the value of `i using `printf`.

Step 7:After the loop, return 0 to indicate success.

Step 8:Add another `exit(0)` statement after the return statement to ensure thatthe program always

terminates with an exit status of 0.


PROGRAM:

#include <stdio.h>

#include <stdlib.h>i

nt main()

declaration of the variables

int i, num;

printf("Enter the last number: ");

scanf("%d", &num);

for (i = 1; i<num; i++)

// use if statement to check the condition

if (i == 6)

/*use exit () statement with passing 0 argument to show termination of the program without anyerror
message. */

exit(0):

else

printf("\n Number is %d", i);

return 0;

}
OUTPUT:

Parent process id is 2545

Process id is greater than 0.

It is obtained.

Child process id is 2546


EXP No : 3(e)
CLOSE SYSTEM CALL
DATE :

AIM:

To create a process management using system calls :fork,exit,getid,wait close.

ALGORITHM:

Step 1:Declare a variable `filedesc` of type `size_t` to store the file descriptor returned by the
`open system call.

Step 2:Call the `open` system call with the filename "testfile.txt" and the flags `0_WRONLY`(to open the
file for writing only) and `0_CREAT` (to create the file if it does not exist).

Step 3: Check if the return value of `open` is less than 0. If it is, return 1 to indicate failure. Callthe `close`
system call with the file descriptor returned by `open`.

Step 4:Check if the return value of `close` is less than 0. If it is, return 1 to indicate failure.

Step 5:Return 0 to indicate success.


PROGRAM:

#include <stdlib.h>

#include <fcntl.h>

int main(){

size_1 filedesc = open("testfile.txt". O_WRONLY | O_CREAT);

if(filedesc < 0)

return 1;

if(close(filedesc) < 0)

return 1;

return 0;

}
OUTPUT:

RESULT:

Thus the program process management using system calls: fork, exit, getpid wait ,closehas been
implemented and output is verified successfully.
EXP No : 4(a)
IMPLEMENTATION OF FCFS SCHEDULING
DATE :

AIM:

To implement a FCFS scheduling by the c programming.

ALGORITHM:

Step 1:Initialize variables and arrays.

Step 2:Take input for the number of processes (n), burst times (b), and arrival times(a).

Step 3:Calculate the completion time (g) for each process.

Write a regular expression for an identifier and number.Calculate the waiting time (w) for eachprocess by
subtracting the arrival time from the completion time.

Step 5:Calculate the turnaround time (t) for each process by subtracting the arrival time fromthe completion
time.

Step 6:Calculate the average waiting time (awt) and average turnaround time (att) by summingup the
respective values for all processes and dividing by the

Step 7:number of processes.

Step 8:Print the waiting time and turnaround time for each process and the average waiting timeand

average turnaround time.


PROGRAM:

#include<stdio.h>

main()
int n,a[10].b[10],t[10],w[10].g[10].i.m;

floatatt=0,awt=0;

for(i=0;i<10;i++)
{

a[i]=0; b[i]=0; w[i]=0; g[i]=0;


}

printf("enter the number of process");

scanf("%d", &n):
printf("enter the burst times");
for(i=0;i<n;i++)
scanf("%d",&b[i]);
printf("\nenter the arrival times");
for(i=0;i<n;i++)
scanf("%d",&a[i]):
g[0]=0;

for(i=0;i<10;i++)

g[i+1]=g[i]+b[i]:
for(i=0;i<n;i++)
{
w[i]=g[i]-a[i]:
[i]=g[i+1]-a[i]:

awt=awi+w[i];

att=att+1/i];
}

awt #awt/n;

att=att/n;
printf("process waiting time\turnaround time\n");
for(i=0;i<n;i++)
{

printf("\tp%d\\%d %d\n",i,w[i],t[i]);
printf("the average waiting time is %fn",awt);
printf("the average turn around time is %n",att);
}
OUTPUT:

enter the number of process 4

enter the burst times

4983

enter the arrival times

0243
Process Waiting time Turn around time

0 0 4

p1 2 11

p2 9 17

p3 18 21

the average waiting time is 7.250000

the average turn around time is 13.250000

RESULT:

Thus the program FCFS scheduling is implemented and output is verified successfully.
EXP No : 4(b)
IMPLEMENTATION OF SJF SCHEDULING
DATE :

AIM:

To implement the sjf scheduling by c programming.

ALGORITHM:

Step 1:Define an array of structure process with members pid,btime,wtime&ttime.

Step 2: Get length of the ready queue,i.e.,number of process(say n)

Step 3: Obtain btime for each process.

Step 4: Sort the process according to their btime in ascending order.

If two process have same btime,then FCFS is used to resolve the tie.

Step 5: The wtime for first process is 0.

Step 6: Compute average wtime and ttime for each process as:wtimei+1=wtimei+btimei

ttimei=wtimei+btimei

Step 7: Compute average waiting time awat and average turn around tine atur.

Step 8: Display btime,ttime and wtime for each process

.Step 9:Display GANTT chart for the above scheduling.

Step 10:Display awat and atur.

Step 11:Stop.
PROGRAM:

#include<stdio.h>

int main()

int nj,temp,templ,temp2,pr[10],[10],[10],[10],p[10],I;

float att=0,awt=0;

for(i=0;i<10;i++)
{
b[i]=0;w[i]=0;
}

printf "enter the number of process");

scanf("%d",&n);
printf("enter the burst times");
for(i=0;i<n;i++)
{
scanf("%d",&b[i]);
p[i]=i;

for(i=0;i<n;i++)

for(j=i;j<n;j++)

if(b[i]>b[j])
{

temp=b[i];

templ=p[i];

p[i]=p[j];
b[j]=temp;

p[j]=templ;
}

w[0]=0;

for(i=0;i<n;i++)

w[i+1]=w[i]+b[i];

for(i=0;i<n;i++)

t[i]=w[i]+b[i];

awt=awt+w[i];

att=att+t[i];
}

awt=awt/n;

att=att/n;
printf("\t process \t waiting time \ t turn around time \n");
for(i=0;i<n;i++)
printf("\t p[%d] \t%d \t\t %d\n",p[i],w[i],t[i]);
printf("the average waitingtime is %f",awt);
printf("the average turn around time is %f\n",att);
return 1;
}
OUTPUT:

Enter the number of process 5enter the burst times

24568

waiting time turn around time


process

p[0] 0 2

p[1] 2 6
p[2] 6 11

p[3] 11 17

p[4] 17 25

the average waiting time is 7.200000

the average turn around time is 12.200000

RESULT:

Thus the program sjf scheduling has been implemented and output is verifiedsuccessfully.
EXP No : 4(c)
IMPLEMENTATION OF PRIORITY SCHEDULING
DATE :

AIM:
To implement the priority scheduling using c programming.

ALGORITHM:

Step 1:Define an array of structure process with members pid, btime, pri, wtime & time,

Step 2: Get length of the ready queue, i.e., number of process (say n)

Step 3:Obtain brime and pri for each process.

Step 4: Sort the processes according to their pri in ascending order.

a. If two process have same pri, then FCFS is used to resolve the tie.

Step 5: The wrime for first process is 0.

Step 6:Compute wrime and time for each process as:

a. wtimei+1 = wtimei+btimeib.ttimei = wtimei+btimei

Step 7: Compute average waiting time away and average turn around time atur

Step 8: Display the brime, pri, time and wtime for each process.

Step 9: Display GANTT chart for the above scheduling

Step 10:Display awat and atur

Step 11: Stop


PROGRAM:

#include<stdio.h>

int main()

int bt[20],p[20],wt[20], tat[20],pr[20],i,j.n,total=0,pos,temp,avg_wt,avg_tat;


printf "Enter Total Number of Process:")

scanf("%d", &n);

printf("Enter Burst Time and Priority");

for(i=0;i<n;i++)

printf(“\nP[%d]\n”,i+1);

printf("Burst Time:");

scanf(“%d”,&bt[i]);

printf "Priority:")

scanf("%d",&pr[i]);

p[i]=i+1; //contains process number

//sorting burst time, priority and process number in ascending order using selection sort

for(i=0;i<n;i++)

pos=i;

for(j=i+1:j<n;j++)

if(pr[j]<pr[pos])

pos=j;
}

temp=pr[i];

pr[i]=pr[pos];

pr[pos]=temp;

temp=bt[i];
bt[i]=bt[pos];

bt[pos]=temp;

temp=p[i];
p[i]=p[pos];
p[pos]=temp;
wt[0]=0; //waiting time for first process is zero

//calculate waiting time

for(i=1;i<n;i++)

wt[i]=0;

for(j=0;j<i;j++)

wt[i]+=bt[j];

total+=wt[i];
}

avg_wt=total/n;

total=0;
//average waiting time

printf("\nProcess\t Burst Time\tWaiting Time Turnaround Time");

for(i=0;i<n;i++)

tat[i]=bt[i]+wt[i]; //calculate turnaround timetotal+=tat[i];

printf("\nP[%d]\t\t %d\t\t %d\t\t\t %d",p[i],bt[i],wt[i],tat[i]);

avg_tat=total/n; //average turnaround time

printf("\n\nAverage Waiting Time=%d",avg_wt);

printf("\nAverage Turnaround Time=%d\n",avg_tat);

return 0;

}
OUTPUT:

Enter Total Number of Process:4

Enter Burst Time and Priority

P[1]

Burst Time:6

Priority:3

P[2]

Burst Time:2

Priority:2

P[3]

Burst Time:14

Priority: 1

P[4]

Burst Time:6

Priority:4

process Burst time waiting time turn around time

p[3] 14 0 14

p[2] 2 14 16
p[3] 6 16 22

p[4] 6 22 28

Average Waiting Time=13

Average Turnaround Time=20


RESULT:

Thus the program priority scheduling has been implemented and output is verifiedsuccessfully.
EXP No : 4(d)
IMPLEMENTATION OF ROUND ROBIN SCHEDULING
DATE :

AIM:

To implement the round robin scheduling using c programming.

ALGORITHM:

Step 1: Get length of the ready queue, i.e., number of process (say n) .

Step 2: Obtain Burst time B, for each processes Pi.

Step 3: Get the time slice per round, say TS.

Step 4: Determine the number of rounds for each process.

Step 5: The wait time for first process is 0.

Step 6: If Bi> TS then process takes more than one round. Therefore turnaround and waitingtime should
include the time spent for other remaining processes in the same round.

Step 7: Calculate average waiting time and turn around time

Step 8: Display the GANTT chart that includes

a. order in which the processes were processed in progression of rounds

b. Turnaround time Ti for each process in progression of rounds.

Step 9 : Display the burst time, turnaround time and wait time for each process (in order ofrounds they were

processed).

Step 10: Display average wait time and turnaround time

Step11: Stop
PROGRAM:

#include<stdio.h>

int main(){
int count,j,n,time,remain,flag=0,time quantum;

int wait_time=0,turnaround_time=0,at[10],bt[10],rt[10];

printf("Enter Total Process:\t ");


scanf("%d", &n);
remain=n;
for(count=0;count<n; count++)
{

printf("Enter Arrival Time and Burst Time for Process Process Numbered %d:"count+1);
scanf("%d",&at[count]);
scanf("%d", &bt[count]);
rt[count]=bt[count];
}

printf("Enter Time Quantum:\t");

scanf("%d", &time_quantum);
printf("\n\nProcess\r| TurnaroundTime| Waiting Time\n\n");
for(time=0,count=0; remain!=0;)
{
if(rt[count]<=time_quantum&&rt[count]>0)
{
time+=rt[count]:
rt[count]=0;
flag=1;
}

else if(rt[count]>0)

rt[count]-time quantum;

time+time quantum;
}
if(rt[count]==0 && flag==1)

remain--;

printf( "P[%d] \t|\t%d\t|\t%d\n",count +1,time-at[count], time-at[count]-bt[count]);

wait_time+=time-at[count]-bt[count];
turnaround_ time+=time-at[count];
flag=0;
if(count ==n-1)
count=0;
else if(at[count+1]<=time)
count++;
else
count=0;
}

printf("\nAverage Waiting Time= %f", wait_time*1.0/n);

printf("Avg Turnaround Time = %f",turnaround_time*1.0/n);

return 0;

OUTPUT:

Enter Total Process: 4

Enter Arrival Time and Burst Time for Process Process Number 1:0

Enter Arrival Time and Burst Time for Process Process Number 2:1

Enter Arrival Time and Burst Time for Process Process Number 3:2

Enter Arrival Time and Burst Time for Process Process Number 4 :3

Enter Time Quantum:5


Process Turn Arround Time Waiting Time

P[2] 9 4

P[3] 11 8

P[4] 14 10

P[1] 21 12

Average Waiting Time= 8.500000

Avg Turnaround Time = 13.750000

RESULT:

Thus the program round robin schedling has been impelemented and output is verified
successfully.
EXP No : 5
INTER PROCESS COMMUNICATION USING SHARED
MEMORY
DATE :

AIM:

To implement inter process communication using shared memory.

ALGORITHM:

Step 1:ftok(): is use to generate a unique key.

Step 2:shmget(): int shmget(key_t,size_tsize,intshmflg); upon successful completion, shmget() returns


an identifier for the shared memory segment.

Step 3:shmat(): Before you can use a shared memory segment, you have to attach yourself
to it using shmat(). void *shmat(int shmid ,void *shmaddr ,int shmflg);
shmid is shared memory id. shmaddr specifies specific address to use but we should set
it to zero and OS will automatically choose the address

Step 4: shmdt(): When you’re done with the shared memory segment, your program should
detach itself from it using shmdt(). int shmdt(void *shmaddr);

Step 5: shmctl(): when you detach from shared memory,it is not destroyed. So, to destroy
shmctl() is used. shmctl(int shmid,IPC_RMID,NULL);
PROGRAM:

#include<stdio.h>

#include<sys/types.h>

#include<sys/shm.h>

#include<sys/ipc.h>

int main(){

int child, shmid,i;

char *shmptr;

child=fork();

if(!child)

shmid=shmget(2041,32,IPC_CREAT|0666);

shmptr=shmat(shmid,0,0);

printf(" Parent writing\n");

for(i=0;i<10;i++)

shmptr[i]='a'+i; putchar(shmptr[i]);

}
printf("\n\n %s", shmptr);

wait(NULL);

else

shmid=shmget(2041,32,0666);

shmptr=shmat(shmid,0,0);

printf("n Child is reading\n");

for(i=0;i<10;i++)
putchar(shmptr[i]);
shmdt(NULL);
shmctl(shmid,IPC_RMID,NULL);
}

return 0;

}
OUTPUT:

[cse2@localhost ~]$ cc share.c

[cse2@localhost ~]$ ./a.out

Parent writing

abcdefghij

Child is reading

abcdefghij

RESULT:

Thus the program inter process communication using shared memory and output isverified
successfully.
EXP No : 6
MUTUAL EXCLUSION BY SEMAPHORE
DATE :

AIM:

To implement the mutual exclusion by semaphore.

ALGORITHM:

Step 1: 2 threads are being created, one 2 seconds after the first one.

Step 2: But the first thread will sleep for 4 seconds after acquiring the lock.

Step 3: Thus the second thread will not enter immediately after it is called, it will enter 4 – 2 = 2secs after
it is called.

Step 4: Stop.
PROGRAM:

#include <stdio.h>

int mutex=1,full=0,empty=3,x=0;

int main(){
int n

void producer();

void consumer();

int wait(int);
int signal(int);
printf(“\nl.Producern2.Consumer\n3.Exit”);
while(1)
{
printf("\nEnter your choice:");
scanf("%d",&n);
switch(n)
{
case 1: if((mutex==1)&&(empty!=0))
producer();
else

printf("Buffer is full!!"):

break;
case 2: if(mutex==1)&&(full!=0))
consumer();
else

printf("Buffer is empty!!");

break;
case 3:exit(0);
break;
}

return 0;

int wait(int s)

return (--s);

int signal(ints)
{

return(++s);
}

void producer()
{

mutex=wait(mutex);

full=signal(full);

empty=wait(empty);

x++;
printf("nProducer produces the item %d",x);
mutex=signal(mutex);
}

void consumer()

mutex=wait(mutex):

full=wait(full);

empty=signal(empty);

printf("Consumer consumes item %d",x);


x--;
mutex=signal(mutex);

}
OUTPUT:

1.Producer

2.Consumer

3.Exit

Enter your choice: 1

producer produces the item

Enter your choice: 1

producer produces the item 2

Enter your choice:1

Producer produces the item 3

Enter your choice:2

Consumer consumes item 3

Enter your choice:2

Consumer consumes item 2

RESULT:

Thus the program mutual exclusion by semaphore is implemented and output is verified
successfully.
EXP No : 7
BANKERS ALGORITHM FOR DEAD LOCK AVOIDANCE
DATE :

AIM:

To implement the bankers algorithm for dead lock avoidance by c programming.

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 its 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 or not if we allow therequest.

Step 9. Stop.
PROGRAM:

#include<stdio.h>

void main(){
int r[1][10],av[1][10];

int all[10][10],max[10][10],ne[10][10],w[10],safe[10];

int i=0,j=0,k=0,l=0,np=0,nr=0,count=0,cnt=0;

printf("enter the number of processes in a system");

scanf("%d",&np);

printf("enter the number of resources in a system");

scanf("%d",&nr);
for(i=1;i<=nr;i++)
{

printf(“ enter the number of instances of resource R%d ",i);

scanf("%d",&r[0][i]);
av[0][i]=r[0][i];

for(j=1;j<=nr;j++) all[i][j]=ne[i][j]=max[i][j]=w[i]=0;

printf("\nEnter the allocation matrix");

for(i=1;i<=np;i++)
{
printf("\n");
for(j=1;j<=nr;j++)
{
scanf("%d",&all[i][j]);
av[0][j]=av[0][j]-all[i][j];

printf("Enter the maximum matrix");for(i=1;i<=np;i++)


{
printf("\n");
for(j=1;j<=nr;j++)
{

scanf("%d",&max[i][j]);

}
}

for(i=1;i<=np;i++)

for(j=1;j<=nr;j++)

ne[i][j]=max[i][j]-all[i][j];

for(i=1;i<=np;i++)

printf("pocess P%d",i);

for(j=1;j<=nr;j++)
{

printf("n allocated %d",all[i][j]);

printf("maximum d",max[i][j]);

printf("need %d",ne[i][j]);

printf("\n _ \n”);

printf("\nAvailability");
for(i=1;i<=nr;i++)
printf("R%d %d\t",i,av[0][i]);
printf("\n _ \n”);
printf("\n safe sequence");
for (count=1:count<=np:count++)

for(j=1;j<=nr:j++)
{

cnt=0;

for(j=1;j<=nr:j++)

if(ne[i][j]<=av[0][j] && w[i]==0)

cnt++;
if(cnt==nr)

k++;
safe[k]=i;
for(l=1;1<=nr;1++)
av[0][1]=av[0][1]+all[i][l];
printf("n P%d ",safe[k]);
printf("\n Availability");
for(l=1;1<=nr;I++)
printf("R%d %d",lav[0][1]);
w[i]=1;
}

getch();

}
OUTPUT:

enter the number of processes in a system 3

enter the number of resources in a system 3

enter no. of instances of resource R1 10

enter no. of instances of resource R2 7

enter no. of instances of resource R3 7

Enter the allocation matrix

321

112

412

Enter the maximum matrix

444

345

524

pocess P1

allocated 3

maximum 4

need 1

allocated 2

maximum 4

need 2

allocated 1

maximum 4

need 3
RESULT:

Thus the program bankers algorithm has been implemented and output is verifiedsuccessfully.
EXP No : 8
DEADLOCK DETECTION ALGORITHM
DATE :

AIM:

To implement the deadlock detection algorithm by c programming.

ALGORITHM:

Step1:Mark each process that has a row in the Allocation matrix of all zeros.

Step 2:Initialize a temporary vectorW to equal the Available vector.

Step 3:Find an index i such that process i is currently unmarked and the i th row of Qis less thanor equal to
W. That is, Q ik... Wk, for 1 ... k... m. If no such row is found, terminate the algorithm.

Step 4: If such a row is found, mark processi and add the corresponding row of the allocationmatrix to W.
That is, set Wk = Wk + Aik, for 1 ... k... m. Return to step 3.
PROGRAM:

#include<stdio.h>

static int mark[20];

int i,j,np.nr;
int main()

int alloc[10][10],request[10][10], avail[10],r[10],w[10];

printf("Enter the no of process: ");


scanf("%d", &np);

printf("Enter the no of resources: ");

scanf("%d", &nr);

for(i=0;i<nr;i++){
printf("Total Amount of the Resource R%d: ",i+1);
scanf("%d", &r[i]);
}

printf ("\nEnter the request matrix ");

for(i=0;i<np;i++)
for(j=0;j<nrp;j++)
scanf("%d",&request[i][j]);
printf("Enter the allocation matrix:");

for(i=0;i<n;i++)
for(j=0;j<nr;j++)
scanf("%d",&alloc[i][j]);
/*Available Resource calculation*/
for(j=0;j<nr;j++)
{

avail[j]=r[j];

for(i=0;i<np:i++)
{

avail[j]-=alloc[i][j];

// marking processes with zero allocation

for(i=0;i<np;i++)
{

int count=0;
for(j=0;j<nr;j++)

if alloc[i][j]==0)
count++;
else break;
}

if(count==nr)

mark[i]=1;
// initialize W with avail
for(j=0;j<nr;j++)
w[j]=avail[j];
//mark processes with request less than or equal to W
for(i=0;i<n;i++)
int canbeprocessed=0;
if(mark[i]!=1)
{

for(j=0;j<nr:j++)

if request[i][j]<=w[j])canbeprocessed=1;

else

canbeprocessed=0;

break;
}

if(canbeprocessed)

{
mark[i]=1;

for(j=0;j<nr;j++)

w[j]+=alloc[i][j];

}
//checking for unmarked processes

int deadlock=0;
for(i=0;i<np;i++)
if(mark[i]!=1)
deadlock=1;
if(deadlock)
printf("n Deadlock detected");

else

printf(" No Deadlock possible");

}
OUTPUT:

Enter the no of process: 4

Enter the no of resources: 5

Total Amount of the Resource RI: 2

Total Amount of the Resource R2: 1

Total Amount of the Resource R3: 1

Total Amount of the Resource R4: 2

Total Amount of the Resource R5: 1

Enter the request matrix:

01001
00101

00001

10101

Enter the allocation matrix:1011011000

00010

00000

Deadlock detected

RESULT:

Thus the program deadlock detection algorithm has been implemented and output isverified
successfully.
EXP No : 9
IMPLEMENT THREADING
DATE :

AIM:

To write a program for implementation of thead by c programming.

ALGORITHM:

Step 1:Crete two threads

Step 2 : Let the threads share a common resource,say counter.

Step 3: Even if thread 2 is scheduled to start while thread was not done,access to shared

Step 4:Once thread 1 completes,thread 2 starts execution

Step 5:Stop.
PROGRAM:

Thread creation

#include <unistd.h>

//header file for sleep

#include<stdio.h>

#include<stdlib.h>

#include<pthread.h>

void *mythread(void *vargp)

sleep(1);

printf("welcome!\n");

return NULL;

int main()

pthread_t tid;

printf("before thread");

pthread_create(&tid.NULL.mythread.NULL);

pthread_join(tid.NULL);

exit(0);

}
OUTPUT:

To Compile

cc filename.c -1 pthread

To Run

./a.out

RESULT:

Thus the program threading has been implemented and output is verified successfully.
EXP No : 10
PAGING TECHNIQUE
DATE :

AIM:

To implement the page technique by c programming.

ALGORITHM:

Step1: Start.

Step 2: Get process size.

Step 3: Compare no. of pages available and display it.Step 4: Determine the corresponding page.

Step 5: Display page table.

Step 6 : Display the physical address.Step 7 : Stop.


PROGRAM:

#include<stdio.h>

int main()

int ms, ps, nop, np, rempages, i, j, x, y, pa, offset;

int s[10]. fno[10][20];

clrscr();

printf("Enter the memory size --");

scanf("%d",&ms);

printf("Enter the page size --");

scanf("%d",&ps);

nop = ms/ps;
printf("\nThe no. of pages available in memory are %d ",nop):

printf("Enter number of processes -- ");

scanf("%d",&np);

rempages= nop;

for(i=1;i<=np;i++)

printf("Enter no. of pages required for p[%d] –“,i);

scanf(“%d”,&s[i]);

if(s[i] >rempages)

printf("\nMemory is Full");

break;

Rempages = rempages - s[i];

printf("Enter pagetable for p[%d] ---“,i);

for(j=0;j<s[i];j++)

scanf("%d",&fno[i][j]);
printf("Enter Logical Address to find Physical Address -- ");

printf("Enter process no. and pagenumber and offset -- ");

scanf("%d %d %d", &x,&y, &offset);

if(x>np || y>=s[i] || offset>=ps)

printf("\nInvalid Process or Page Number or offset");

else

{
pa=fno[x][y]*ps+offset;

printf("The Physical Address is --%d",pa);


}

}
OUTPUT:

Enter the memory size --4

Enter the page size – 3

The no. of pages available in memory are –1

Enter number of processes -- 4

Enter no. of pages required for p[1]-- 2

Memory is Full

RESULT:

` Thus the program paging technique has been implemented and output is verifiedsuccessfully.
EXP No : 11(a)
MEMORY MANAGEMENT SCHEMES FIRST FIT
DATE :

AIM:

To implement the memory management schemes first fit by c programming.

ALGORITHM:

Step 1:Declare structures hole and process to hold information about set of holes andprocesses
respectively.

Step 2:Get number of holes, say nh.

Step 3: Get the size of each hole

Step 4: Get number of processes, say np.

Step 5: Get the memory requirements for each process.

Step 6: Allocate processes to holes, by examining each hole as follows:

a. If hole size > process size then

i. Mark process as allocated to that hole.

ii. Decrement hole size by process size.

b. Otherwise check the next from the set of hole

Step 7: Print the list of process and their allocated holes or unallocated status.

Step 8: Print the list of holes, their actual and current availability.

Step 9: Stop
PROGRAM:

#include<stdio.h>

#include<conio.h>

#define max 25

void main()

int frag[max],b[max]f[max],i,j,nb,nf,temp,highest=0;

static int bf[max]ff[max];

clrscr();

printf(“\n\t Memory Management Scheme Worst Fit");

printf("\nEnter the number of blocks: ");

printf("\nEnter the number of files:");

scanf("%d",&nf);

printf "Enter the size of the blocks:-\n");

for(i=1;i<=nb;i++){

printf ("Block%d:",i);

scanf("%d",&b[i]);

printf ("\nEnter the size of the files :-\n");

for(i=i;i<=nf;i++)
{

printf "File %d:"i):

scanf("%d",&f[i]);

for(i=1;i<=nf;i++)

for(j=1;j<=nb;j++)
{

if(bf[j]!=1)//if bf[i] is not allocated


{
temp=b[j]-f[i]:

if(temp>=0)

if( highest<temp)

ff[i]=j:

highest=temp;

frag[i]=highest:

bf[ff[i]]=1;

highest=0;

printf("\nFile_no:\File_size \Block_no:\Block_size:\Fragement");

for(i=1;i<=nf;i++)

printf("\n%d\t\t%d\t\t%d\t\t%d\\%d",i,f[i],ff[i],b[ff[i]].frag[i]);

getch();
}
OUTPUT:

Enter the number of blocks: 3

Enter the number of files: 2

Enter the size of the blocks:-

Block 1: 5

Block 2: 2

Block 3: 7
Enter the size of the files:-
File 1:1
File 2:4

File No File Size Block No Block Size Fragment

1 1 3 7 6

2 4 1 5 1

RESULT:

Thus the program memory management schemes first fit has been implemented andoutput is
verified successfully.
EXP No : 11(b)
MEMORY MANAGEMENT SCHEMES BEST FIT
DATE :

AIM:

To implement the memory management schemes best fit by c programming.

ALGORITHM:

Step 1: Declare structures hole and process to hold information about set of holes and processes
respectively.

Step 2: Get number of holes, say nh.

Step 3: Get the size of each hole

Step 4: Get number of processes, say np.

Step 5: Get the memory requirements for each process.

Step 6: Allocate processes to holes, by examining each hole as follows:

a. If hole size > process size then


I. Mark processes to as allocated to that hole.
II. Decrement hole size by process size.
b. Otherwise check the next from the set of hole
Step 7: Print the list of process and their allocated holes or unallocated status.

Step 8: Print the list of holes, their actual and current availability.

Step 9: Stop
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];

clrscr();

printf(“ Enter the number of blocks: ");

scanf "%d",&nb);

printf("Enter the number of files:");

printf "Enter the size of the blocks:-\n");

for(i=1;i<=nb;i++)

printf "Block d:",i);

scanf "%d",&b[i]);

printf("Enter the size of the files :-\n");

for(i=1;i<=nf;i++)
{

printf( "File %d:",i);

scanf(“%d”,&f[i]);

for(j=1;j<=nb;j++)

if(bf[j]!=1)

temp=b[j]-f[i];
if(temp>=0)
if(lowest>temp)
{
ff[i]=j;

lowest=temp;
}

frag[i]=lowerst;

bf[ff[i]]=1;

lowest=10000;
}

printf("\nFile_no:\tFile_size\t Block_no: \tBlock_size:\tFragement");

for(i=1;i<=nf &&ff[i]!=0;i++)

printf("\n%d\t\t%d\t\t%d\t\t%d\t\t%d",i,ƒ[i],ff[i],b[ff[i]],frag[i]);

getch();
}
OUTPUT:

Enter the number of blocks: 3

Enter the number of files: 2

Enter the size of the blocks:-

Block 1: 5

Block 2: 2

Block 3: 7

Enter the size of the files:-

File 1:1

File 2:4

File No File Size Block No Block Size Fragment

1 1 2 2 1

2 4 1 5 1

RESULT:

Thus the program memory management schemes best fit has been implemented andoutput is
verified successfully.
EXP No : 11(c)
MEMORY MANAGEMENT SCHEMES WORST FIT
DATE :

AIM:

To implement the memory management schemes worst by c programming.

ALGORITM:

Step 1: Declare structures hole and process to hold information about set of holes and processes
respectively.

Step 2: Get number of holes, say nh.

Step 3: Get the size of each hole

Step 4: Get number of processes, say np.

Step 5: Get the memory requirements for each process.

Step 6: Allocate processes to holes, by examining each hole as follows:

c. If hole size > process size then


III. Mark processes to as allocated to that hole.
IV. Decrement hole size by process size.
d. Otherwise check the next from the set of hole

Step 7: Print the list of process and their allocated holes or unallocated status.

Step 8: Print the list of holes, their actual and current availability.

Step 9: Stop
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(“ Enter the number of blocks: ");

scanf "%d",&nb);

printf("Enter the number of files:");

printf "Enter the size of the blocks:-\n");

for(i=1;i<=nb;i++)

printf "Block d:",i);

scanf "%d",&b[i]);

printf("Enter the size of the files :-\n");

for(i=1;i<=nf;i++)

printf( "File %d:",i);

scanf(“%d”,&f[i]);

for(j=1;j<=nb;j++)

if(bf[j]!=1)

temp=b[j]-f[i];
if(temp>=0)

{
ff[i]=j;

break;

}
}
}

frag[i]=temp;

bf[ff[i]]=l;

printf("\nFile_no:\tFile_size\t Block_no: \tBlock_size:\tFragement");

for(i=1;i<=nf;i++)

printf("\n%d\t\t%d\t\t%d\t\t%d\t\t%d",i,ƒ[i],ff[i],b[ff[i]],frag[i]);

getch( );

}
OUTPUT:

Enter the number of blocks: 3

Enter the number of files: 2

Enter the size of the blocks:-

Block 1: 5

Block 2: 2

Block 3: 7

Enter the size of the files:-File 1: 1

File No File Size Block No Block Size Fragment

1 1 1 5 4

2 4 3 7 3

RESULT:

Thus the program memory management schemes worst has been implemented and isverified
successfully.
EXP No : 12(a)
FIFO PAGE REPLACEMENT ALGORITHM
DATE :

AIM:

To implement the FIFO page replacement algorithm using C program.

ALGORITHM:

Step 1 : Start.

Step 2 : Get length of the reference string,say 1.

Step 3 : Get reference string and store it in an array,say rs.

Step 4 : Get number of frames ,say nf.

Step 5 : Initialize frame array upto length nf to -1.

Step 6 : Initialize position of the oldest page,say j to 0.

Step 7 : Initialize no.of page faults,say count to 0.

Step 8 : For each page in reference string in the given order,examine:

a.Check whether page exist in the frame array.


b.If it does not exist then
i. Replace page in position j.
ii. Compute page replacement position as (j+1) modulus nf.
iii. Increment count by 1.
iv. Display page in frame array.

Step 9 : Print count.

Step 10 : Stop.
PROGRAM:

#include<stdio.h>
#include<conio.h> i
nti,j,nof,nor,flag=0,ref[50],frm[50],pf=0,victim=-1;
void main()
{

clrscr();

printf(“\n \t\t\t fifo page replacement algorithm”);

printf(“\n enter no.of frames….”);

scanf(“%d”,&nof);
printf(“\n enter number of reference string..\n”);
scanf(“%d”,&nor);
printf(“\n enter the reference string..”);
for(i=0;i<nor;i++)
scanf(“%d”,&ref[i]);
printf(“\n the given reference string:”);
for(i+0;i<nor;i++)
printf(“%4d”,ref[i]);
for(i=1;i<=nof;i++)
frm[i]=-1;

printf(“\n”); for(i=0;i<nor;i++)
{

flag=0;

printf(“\n\t reference np%d->\t’,ref[i]);

for(j=0;j<nof;j++)
{

if(frm[j]==ref[i])

flag=1;
break;
}
}

if(flag==0)

{
pf++;

victim++;
victim=victim%nof;
frm[victim]=ref[i];
for(j=0;j<nof;j++)
printf(“%4d”,frm[j]);
}

printf(“\n\n\t\t no.of pages faults…%d”,pf);

getch();
}
OUTPUT:

FIFO PAGE REPLACEMENT ALGORITHM

Enter the no of Frames 4


Enter number of reference string…
6
Enter the Reference String..
5 6 4 1 2 3
The Given reference string.:

……………………………
5 6 4 1 2 3
Reference np5-> 5 -1 -1 -1

Reference np6-> 5 6 -1 -1

Reference np4-> 5 6 4 -1
Reference np1-> 5 6 4 1
Reference np2-> 2 6 4 1
Reference np3-> 2 3 4 1

No.of pages faults…6

RESULT:

Thus the program FIFO page replacement algorithm has been implemented and output isverified
successfully.
EXP No : 12(b)
LRU PAGE REPLACEMENT ALGORITHM
DATE :

AIM:

To implement the lru page replacement algorithm by c programming.

ALGORITHM:

Step 1: Get length of the reference string, say l.

Step 2: Get reference string and store it in an array, say rs.

Step 3: Get number of frames, say nf.

Step 4: Initialize frame array upto length nf to -1.

Step 5: Initialize position of the oldest page, say j to 0.

Step 6: Initialize no. of page faults, say count to 0.

Step 7: For each page in reference string in the given order, examine:

a. Check whether page exit in the frame array


b. If it does not exit then
I. Replace page in position j.
II. Compute page replacement position as (j+1) modulus nf.
III. Increment count by 1.
IV. Display pages in frame array.
Step 8: Print count.

Step 9: Stop.
PROGRAM:

#include<stdio.h>

#include<conio.h>

int i,j,nof,nor,flag=0,ref[50],frm[50],pf=0,victim=-1;

int recent[10],lrucal[50],count=0;

int lruvictim();

void main()

clrscr();

printf("\n\t\t\t LRU PAGE REPLACEMENT ALGORITHM");

printf(“\n Enter no.of Frames ......... ");

scanf("%d",&nof);

printf("Enter no.of reference string..");

scanf("%d",&nor);

printf("\n Enter reference string..");

for(i=0;i<nor;i++)

scanf("%d",&ref[i]):

printf("\n\n\t\tLRU PAGE REPLACEMENT ALGORITHM "):

printf("\n\t The given reference string: ");

printf("n............................................................ ”);

for(i=0;i<nor;i++)

printf("%4d".reflil);

for(i=1;i<=nof;i++)

frm[i]=-1;
Irucal[i]=0;

for(i=0;i<10;i++)

recent[i]=0;

printf("\n");
for( i=0;i<nor;i++)

flag=0;

printf(“\n\t Reference NO %d->reflil);

for(j=0;j<nof;j++)

if(frm[j]==ref[i])

flag=1;

break;

if flag==0)

count++;

if(count<=nof)

victim++;

else victim=lruvictim();

pf++;

frm/victim]=ref[i];

for(j=0;j<nof:j++)

printf("%4d" frm[j]);

recent[ref[i]]=i;

printf(" \n\n\tNo.of page faults... %d",pf);

getch();

}
int lruvictim()

int i,j,templ,temp2;

for(i=0;i<nof;i++)

templ=frm[i]:

lrucal[i]=recent[templ];

temp2=lrucal[0];

for(j=1;j<nof;j++)

if(temp2>lrucal[j])

temp2=lrucal[j];

for(i=0;i<nef;i++)

if (ref[temp2]==frm[i])

return i;

return 0;

}
OUTPUT:

LRU PAGE REPLACEMENT ALGORITHM

Enter no.of Frames....... 3

Enter no.of reference string 6

Enter reference string 6 5 4 2 3 1

LRU PAGE REPLACEMENT ALGORITHM

The given reference string:

……………………6 5 4 2 3 1

Reference NO 6-> 6 -1 -1

Reference 6 5 -
NO 5-> 1
Reference 6 5 4
NO 4->
Reference 2 5 4
NO 2->
Reference 2 3 4
NO 3->
Reference 2 3 1
NO 1->
No.of page
faults...6

RESULT:

Thus the program LRU page replacement algorithm has been implemented and output isverified
successfully.
EXP No : 12(c)
OPTIMAL (LFU) PAGE REPLACEMENT ALGORITHM
DATE :

AIM:

To implement optimal (lfu) page replacement algorithm by c programming.

ALGORITHM:
1. Step 1: Get length of the reference string, say len.
2. Step 2:Get reference string and store it in an array, say rs.
3. Step 3: Get number of frames, say nf.
4. Step 4: Create access array to store counter that indicates a measure of recent usage.
5. Step 5: Create a function arrmin that returns position of minimum of the given array.
6. Step 6: Initalize frame array upto length nf to -1.
7. Step 7:Initialize position of the page replacement, say / to 0.
8. Step 8: Initialize freq to 0 to track page frequency
9. Step 9: Initialize no. of page faults, say count to 0.

10. Step 10: For each page in reference string in the given order, examine:
a. Check whether page exist in the frame array.
b. If page exist in memory then
i. Store incremented freq for that page position in access array.
c. If page does not exist in memory then
i. Check for any empty frames.
ii. If there is an empty frame,
 Assign that frame to the page
 Store incremented freq for that page position in access array.
 Increment count.

iii. If there is no free frame then


 Determine page to be replaced using arrmin function.
 Store incremented freq for that page position in access array.
 Increment count.

iv. Display pages in frame array.

11. Step 11: Print count.

12. Step 12: Stop


PROGRAM:

#include<stdio.h>

#include<conio.h>
int i,j,nof,nor, flag=0,ref[50],frm[50],pf=0,victim=-1;
int recent[10].optcal[50].count=0;
int optvictim();
void main()
{
clrscr();
printf(“\n OPTIMAL PAGE REPLACEMENT ALGORITHN");
printf("\n........................................................... ”);
printf ("\n Enter the no.of frames");
scanf("%d",&nof);
printf("Enter the no.of reference string"):
scanf("%d",&nor);
printf("Enter the reference string");
for(i=0;i<nor;i++)
scanf("%d",&ref[i]):
clrscr();
printf("\n OPTIMAL PAGE REPLACEMENT ALGORITHM"):
printf("...................................................................... ”);

printf("\nThe given string");

printf("\n................................. ”);
for(i=0;i<nor;i++)
printf("%4d".ref[i]);
for(i=0;i<nof;i++)
{
frm[i]=-1;
optcal[i]=0;
}

for(i=0;i<10;i++)

recent[i]=0;

printf("\n");

for(i=0;i<nor;i++)

flag=0
printf("\n\tref no %d ->\"ref[i]);
for(j=0;j<nof;j++)
{
if(frm[j]==ref[i])
{
flag=1;
break;
}

if flag==0){ count++;
if(count<=nof)
victim++;
else victim=optvictim(i);
pf++;
frm[victim]=ref[i];
for(j=0;j<nof;j++)
printf("%4d" frm[j]);
}
}
printf("n Number of page faults: %d",pf);
getch();
}
int optvictim(int index)
{
int i,j,temp,notfound;
for(i=0;i<nof;i++)
{
notfound=1;
for(j=index;j<nor;j++)
if(frm[i]==ref[j])
{
notfound=0;
optcal[i]=j;
break;
}
if (notfound==1)
return i;
}
temp=optcal[0];
for(i=1;i<nof;i++)
if temp<optcal[i])
temp=opical[i];
for(i=0;i<nof;i++)
if frm[temp]==frm[i])

return i;
return 0;

}
OUTPUT:

OPTIMAL PAGE REPLACEMENT ALGORITHM

Enter no.of Frames....... 3

Enter no.of reference string 6

Enter reference string 6 5 4 2 3 1

OPTIMAL PAGE REPLACEMENT ALGORITHM

The given reference string:

……………………6 5 4 2 3 1

Reference NO 6-> 6 -1 -1

Reference 6 5 -
NO 5-> 1
Reference 6 5 4
NO 4->
Reference 2 5 4
NO 2->
Reference 2 3 4
NO 3->
Reference 2 3 1
NO 1->

No.of page faults...6

RESULT:

Thus the program optimal page replacement algorithm has been implemented and outputis verified
successfully.
EXP No : 13(a)
SINGLE LEVEL DIRECTORY USING FILE ORGANIZATION
DATE :

AIM:

To implement the single level directory using file organization.

ALGORITM:

Step 1 : Start

Step 2 : Get name of directory for the user to store all the files

Step 3 : Display menu

Step 4 : Accept choice

Step 5 : If choice = 1 then

Accept filename without any collisionStore it in the directory

Step 6 : If choice = 2 then

Accept filename

Remove filename from the directory array

Step 7 : If choice = 3 then

Accept filename

Check for existence of file in the directory array

Step 8: If choice= 4 then

List all files in the directory array

Step 9 : If choice = 5 then Stop


PROGRAM:

#include<stdio.h>

Struct

{
char dname[10]fname[10][10];
int fcnt;
}dir;

void main()

int i,ch;
char f[30];
clrscr();
dir.fcnt = 0;
printf("Enter name of directory --");
scanf("%s", dir.dname);
while(1)
{

printf("\n\n l. Create File \t2. Delete File\t3. Search File \n4. Display Files \t5. Exit\nEnter yourchoice--");
scanf("%d", &ch);
switch(ch)
{
case 1:

printf("Enter the name of the file --");

scanf("%s",dir.fname[dir.fcnt]);

dir.fcnt++:
break;

case 2:

printf(“\n Enter the name of the file --");

scanf("%s",f);
for(i=0;i<dir.fcnt;i++)
{
if(strcmp(f,dir.fname[i])==0)
{
printf("File %s is deleted ",f);
strcpy(dir.fname[i],dir.fname[dir.fcnt-1]);
break;
}

if(i==dir.fcnt)

printf("File %s not found" f);


else
dir.fcnt

--

break;

case 3:
printf("\n Enter the name of the file"--");
scanf("%s" f);
for(i=0;i<dir.fcnt;i++)
{
if(strcmp(f, dir.fname[i])==0)
printf("File %s is found ", f);
break;
}

printf("File %s not found".f);

break;
case 4:
if(dir.fcnt==0)
printf("nDirectory Empty");
else
{
printf("\nThe Files are --");
for(i=0;i<dir.fcnt; i++)
printf("%s",dir.fname[i]);
}

break;

default;exit(0);
}

getch();

}
OUTPUT:

Enter name of directory --CSE

1. Create File

2. Delete File 3. Search File

4. Display Files
5. Exit
Enter your choice -1

Enter the name of the file --A

1. Create File

2. Delete File 3. Search File


4. Display Files

5. Exit
Enter your choice -1

Enter the name of the file --B

1. Create File

2. Delete File 3. Search File

4. Display Files
5. Exit
Enter your choice -1

Enter the name of the file --C

1. Create File

2. Delete File 3. Search File

4. Display Files

5. Exit
Enter your choice -4The Files are -A B C1.Create File

2. Delete File

3. Search File
4. Display Files

5. Exit
Enter your choice -3

Enter the name of the file -ABCFile ABC not found

1. Create File

2. Delete File

3. Search File

4. Display Files

5. Exit
Enter your choice -2

Enter the name of the file -BFile B is deleted

1. Create File
2. Delete File
3. Search File

4. Display Files
5. Exit
Enter your choice -5

RESULT:

Thus the program has been implemented and output is verified successfully.
EXP No : 13(b)
TWO LEVEL DIRECTORY USING FILE ORGANIZATION
DATE :

AIM:

To implement the two level directory using file organization.

ALGORITHM:

Step 1: Display menu

Step 2:Accept choice

Step 3: If choice =1 then

Accept directory name

Create an entry for that directory

Step 4: If choice =2 then

Get directory name

If directory exist then accept filename without collision else report error

Step 5: If choice =3 then

Get directory name

If directory exist then Get filename

If file exist in that directory then delete entry else report error

Step 6: If choice =4 then

Get directory name

If directory exist then Get filename

If file exist in that directory then Display filename else report error

Step 7: If choice =5 then Display files directory-wise

Step 8: If choice =6 then Stop


PROGRAM:
#include<stdio.h>

Struct

char dname[10],fname[10][10];

int fcnt;

}dir[10];

void main()

int i,ch,dcnt,k;

char f[30], d[30];

clrscr();

dcnt=0;

while(1)

printf("\n\nl. Create Directory \t2. Create File \t 3. Delete File");

printf("\n4. Search File\t\t5. Display \t6. Exit \tEnter your choice --");

scanf("%d", &ch);

switch(ch)

case 1:

printf("Enter name of directory --");

scanf("%s", dir[dcnt].dname);

dir[dcnt].fcnt=0;

dcnt++;

printf("Directory created");

break;

case 2:
printf("Enter name of the directory --");

scanf("%s",d):

for(i=0;i<dcnt;i++)

if(strcmp(d.dir[i].dname)==0)
{

printf("\n Enter name of the file--");

scanf("%s",dir[i].fname[dir[i]_fcnt]);

dir[i].fcnt++;

printf ("File created");

break;

if(i==dcnt)

printf ("Directory %s not found",d);

break;

case 3:

printf ("\nEnter name of the directory --");

scanf( "%s",d);

for(i=0;i<dcnt;i++)

if (strcm

p(d,dir[i].dname)==0)
{

printf( "Enter name of the file --");

scanf ("%s" ,d);

for(k=0;k<dir[i], fcnt;k++)

{
if stremp(f, dir[i].fname[k])==0)

printf ("Files %s is deleted ",f);

dir[i].fcnt--;

strcpy(dir[i].fname[k],dir[i].fname[dir[i].fcnt]);

goto jmp;
}
}

printf("File %s not found" f);

goto jmp;

}
}

printf("Directory %s not found",d);

jmp: break;

case 4:

printf("\n Enter name of the directory --");

scanf("%s",d);

for(i=0;i<dcnt;i++)

if(strcmp(d,dir[i].dname)==0)

printf( "Enter the name of the file --");

for(k=0;k<dir[i].fcnt;k++)

if(strcmp(f,dir[i].fname[k])==0)

printf("File %s is found "f);

goto jmp1;

}
}

printf("File %s not found",f);

goto jmp 1;

printf ("Directory %s not found",d); jmpl:

break;
case 5:

if(dcnt==0)

printf( "\nNo Directory's ");

else

printf ("\tDirectory \tFiles");

for(i=0;i<dent;i++)

printf ("\t%s",dir[i].dname);

for(k=0;k<dir[i].fent;k++)

printf ("\t%s", dir[i].fname[k]);

break;

default:exit(0);

getch();

}
OUTPUT:

1. Create Directory
2. Create File
3. Delete File

4. Search File

5. Display
6. Exit
Enter your choice --1

Enter name of directory --DIRIDirectory created

1. Create Directory

2. Create File
3. Delete File

4. Search File

5. Display
6. Exit
Enter your choice --1

Enter name of directory -DIR2Directory created

1. Create Directory

2. Create File

3. Delete File
4. Search File

5. Display

6. Exit
Enter your choice -2
Enter name of the directory –DIRIEnter name of the file--Al

File created
1. Create Directory
2. Create File 3. Delete File
4. Search File

5. Display
6. Exit
Enter your choice --2

Enter name of the directory -DIRIEnter name of the file--A2

File created

1. Create Directory
2. Create File

3. Delete File
4. Search File
5. Display

6. Exit
Enter your choice --2

Enter name of the directory -DIRIEnter name of the file--A2

File created

1. Create Directory

2. Create File
3. Delete File

4. Search File

5. Display

6. Exit
Enter your choice –2

Enter name of the directory -DIR2Enter name of the file--BI

File created
1. Create Directory

2. Create File
3. Delete File

4. Search File
5. Display

6. Exit
Enter your choice --5Directory Files

DIR1

Al A2 DIR2BI

1. Create Directory

2. Create File

3. Delete File
4. Search File
5. Display

6. Exit
Enter your choice --4

Enter name of the directory -DIRDirectory not found

1. Create Directory

2. Create File

3. Delete File

4. Search File
5. Display

6. Exit
Enter your choice --3

Enter name of the directory -DIRIEnter name of the file --A2

File A2 is deleted
1. Create Directory

2. Create File

3. Delete File

4. Search File
5. Display

6. Exit
Enter your choice –6

RESULT:

Thus the program two level directory using file organization has been implemented andoutput is
verified successfully.
EXP No : 14(a)
SEQUENTIAL FILE ALLOCATION
DATE :

AIM:

To implement the sequential file allocation by c programming.

ALGORITHM:

Step 1:Assume no. of blocks in the disk as 20 and all are free.

Step 2: Display the status of disk blocks before allocation.

Step 3: For each file to be allocated:

a. Get the filename, start address and file length

b. If start+ length > 20, then goto step 2.

c. Check to see whether any block in the range (start, start + length-1) is allocated. If so,
then go to step 2.

d. Allocate blocks to the file contiguously from start block to start + length - 1.

Step 4 :Display directory entries.

Step 5:Display status of disk blocks after allocation

Step 6:Stop
PROGRAM:

#include<stdio.h>

#include<conio.h>

int n,i,j,b[20],sb[20],t[20],x,c[20][20];

clrscr();

printf ("Enter no.of files:");

scanf("%d",&n);

for(i=0;i<n;i++){

printf ("Enter no. of blocks occupied by file%d",i+1);

scanf("%d",&b[i]);

printf("Enter the starting block of file%d",i+1);

for(j=0;j<b[i];j++)

c[i][j]=sb[i]++;

printf ("Filename \tStart block \tlength\n");

for(i=0;i<n;i++)

printf("%d\t %d \t%d\n",i+1.t[i].b[i]);

printf(“Enter file name:”);

scanf("%d",&x);

printf("File name is: %d",x);

printf("length is: %d".b[x-1]);

printf("blocks occupied:");

for(i=0;i<b[x-1];i++)

printf("%4d",c[x-1][i]);

getch();

}
OUTPUT:

Enter no.of files: 2

Enter no. of blocks occupied by filel 4

Enter the starting block of filel 2

Enter no. of blocks occupied by file 2 10

Enter the starting block of file 2 5

Filename Start block length

File name Start block length

1 2 4

2 5 10

Enter file name: rajesh

File name is:12803 length is:0blocks occupied.

RESULT:

Thus the program sequential file allocation has been implemented and output is verified
successfully.
EXP No : 14(b)
INDEXED FILE ALLOCATION
DATE :

AIM:

To implement the indexed file allocation by c programming.

ALGORITHM:

Step 1: Get no. of files

Step 2:Accept filenames and no, of blocks fo each fileStep 3: Obtrain start block for each file

Step 4: Obtain other blocks for each file

Step 5: Check block availability before allocation

Step 6:If block is unavailable then report error

Step 7: Accept file name

Step 8: Display linked file allocation blocks for that file

Step 9: Stop
PROGRAM:

#include<stdio.h>

#include<conio.h>

main(){

int ,n,m[20],i,j,sb[20],s[20],b[20][20],x;

printf("Enter no. of files:");

scanf("%d",&n);

for(i=0;i<n;i++){

printf( "Enter starting block and size of file%d:",i+1);

scanf("%d %d",&sb[i],&s[i]);

printf("Enter blocks occupied by file%d:",i+1);

scanf("%d",&m[i]);

printf("enter blocks of file%d:",i+1);

for(j=0;j<m[i];j++)

scanf("%d",&b[i][j]);

printf("\nFile\t index\length\n");for(i=0;i<n;i++){

printf("%d\t %d\t %d\n",i+1,sb[i],m[i]);

printf("\n Enter file name:");

scanf("%d", &x);

printf("file name is: %d\n",x);

i=x-1;

printf("Index is:%d",sb[i]);

printf("Block occupied are:");

for(j=0;j<m[i];j++)

printf("%3d",b[i][j]);

getch();

}
OUTPUT:

Enter no. of files: 2

Enter starting block and size of filel: 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 file2: 3 4

Enter blocks occupied by file2:5

enter blocks of file 2: 2 3 4 5 6

File index length

1 2 10

2 3 5

RESULT:

Thus the program indexed file allocation has been implemented and output is verified
successfully.
EXP No : 14(c)
LINKED FILE ALLOCATION
DATE :

AIM:

To implement the linked file allocation by c programming.

ALGORITHM:

Step 1: Get no. of files

Step 2:Accept filenames and no, of blocks fo each file

Step 3: Obtrain start block for each file

Step 4: Obtain other blocks for each file

Step 5: Check block availability before allocation

Step 6:If block is unavailable then report error

Step 7: Accept file name

Step 8: Display linked file allocation blocks for that file

Step 9: Stop
PROGRAM:

#include<stdio.h>

#include<conio.h>

struct file

char frame[10];

int start,size,block[10];

}f[10];

printf ("Enter no. of files:");

scanf ("%d",&n);

for(i=0;i<n;i++){

printf("Enter file name:");

scanf("%s",&f[i].fname);

printf ("Enter starting block:");

scanf("%d",&f[i].start);

f[i].block[0]=f[i].start;

printf( "Enter no.of blocks: ");

scanf("%d",&f[i].size);

printf("Enter block numbers: ");

for(j=1;j<=f[i].size;j++){

scanf("%d",&f[i].block[j]);

printf("File\tstart\tsize\tblock\n");

for(i=0;i<n;i++)
{

printf("%s\t%d\t%d\t" f[i].fname,f[i].start.f[i].size);

for(j=1;j<=f[i].size-1;j++)

printf(“%d--->”f[j]);

printf(“%d”f[i].block[j]);

printf(“\n);

getch();

}
OUTPUT:

Enter no of files:2
Enter file name:venkat
Enter starting block:20
Enter no.of blocks:6
Enter block numbers: 4
12

15

45

32

25

Enter file name:rajesh

Enter starting block:12

Enter no.of blocks:5

Enter block numbers:6


5
4
3
2

File start size block


venkat 20 6 4--12----15---45-32-->25

rajesh 12 5 6--5---4---3--->2

RESULT:

Thus the program linked file allocation has been implemented and output is verifiedsuccessfully.
EXP No : 15(a)
FCFS DISK SCHEDLING
DATE :

AIM:

To implement the fcfs disk scheduling by c programming.

ALGORITHM:

Step 1.Define an array of structure process with members pid, btime, wtime & ttime

.Step 2.Get length of the ready queue, i.e., number of process (say n).

Step 3. Obtain brime for each process.

Step 4. The wtime for first process is 0.

Step 5. Compute wtime and time for each process as:

a. wtimei+1= wtime,+btimei

b. ttime =wtimei+btimei
Step 6. Compute average waiting time awat and average turnaround time atur

Step 7. Display the btime, ttime and wtime for each

process.

Step 8. Display GANTT chart for the above scheduling

Step 9. Display awat time and atur

Step 10. Stop


PROGRAM:

#include<stdio.h>

#include<stdlib.h>

int main()

int RQ[100],i,n,TotalHeadMoment=0,initial;

printf("Enter the number of Requests\n");

scanf("%d",&n);

printf("Enter the Requests sequence\n")

;for(i=0;i<n;i++)

scanf("%d",&RQ[i]);

printf("Enter initial head position\n");

scanf("%d",&initial);

// logic for FCFS disk scheduling

for(i=0;i<n;i++)

TotalHeadMoment=TotalHeadMoment+abs(RQ[i]-initial);

initial=RQ[i];

printf("Total head moment is %d",TotalHeadMoment);

return 0;

}
OUTPUT:

Enter the number of Request

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 program FCFS disk scheduling has been implemented and output is verifiedsuccessfully.
EXP No : 15(b)
SSTF DISK SCHEDULING
DATE :

AIM:

To implement the sstf disk scheduling by c programming.

ALGORITHM:

Step 1.Define an array of structure process with members pid, btime, wtime & ttime.

Step 2.Get length of the ready queue, i.e., number of process (say n).

Step 3. Obtain brime for each process.

Step 4. The wtime for first process is 0.

Step 5. Compute wtime and time for each process as:

a. wtimei+1= wtime,+btimei

b. ttime =wtimei+btimei
Step 6. Compute average waiting time awat and average turnaround time atur

Step 7. Display the btime, ttime and wtime for each

process.

Step 8. Display GANTT chart for the above scheduling

Step 9. Display awat time and atur

Step 10. Stop


PROGRAM:

#include<stdio.h>

#include<stdlib.h>

int main()
int RQ[100],in, TotalHeadMoment=0,initial,count=0;
printf ("Enter the number of Requests\n");
scanf(“%d”,&n);

printf ("Enter the Requests sequence\n");for(i=0;i<n;i++)


scanf(“%d”&RQ[i]);

printf ("Enter initial head position\n");

scanf ("%d",&initial);

//logic for ssf disk scheduling

/*b loop will execute until all process is completed*/

while(count!=n)

int min=1000,d,index;

for(i=0;i<n;i++)

if(min>d)

min=d;

index=i:

TotalHeadMoment=TotalHeadMoment+min;
initial=RQ[index]:

// 1000 is for max

// you can use any numberRQ[index]=1000;

count++;

}
printf ("Total head movement is %d”,TotalHeadMoment);

return 0;
OUTPUT:

Enter the number of Request

Enter Request Sequence

95 180 34 119 11 123 62 64

Enter initial head Position

RESULT:

Thus the program sstf disk scheduling has been implemented and output is verifiedsuccessfully.
EXP No : 15(c)
SCAN DISK SCHEDULING
DATE :

AIM:

To implement the scan disk scheduling using c programming.

ALGORITHM:

Step 1.Define an array of structure process with members pid, btime, wtime & ttime.

Step 2.Get length of the ready queue, i.e., number of process (say n).

Step 3. Obtain brime for each process.

Step 4. The wtime for first process is 0.

Step 5. Compute wtime and time for each process as:

a. wtimei+1= wtime,+btimei

b. ttime =wtimei+btimei

Step 6. Compute average waiting time awat and average turnaround time atur

Step 7. Display the btime, ttime and wtime for each

process.

Step 8. Display GANTT chart for the above scheduling

Step 9. Display awat time and atur

Step 10. Stop


PROGRAM:

#include<stdi o.h>

#include<math.h>

int main()

int queue[20],n,head, i,j,k seck = 0, mat,diff, temp, queue1[20],


queue2[20], temp1 = 0, temp2 = 0;

float avg;

printf(“Enter the max range of disk\n”);

scanf(“%d”,&max);

printf(“Enter the initial head position\n”);

scanf(“%d”, &head);

printf(“Enter the size of queue request\n”);

scanf(“%d”,&n);

printf(“Enter the queue of disk position to be read\n”);for (i =


1; i<= n; i++)

Scanf(“%d”,&tem

p);

if (temp >= head)

queue1[temp1] = temp;
temp1++;

else

queue2[temp2] =

temp;temp2++;
}

for (i =0; I < temp1 – 1; i++)


{

for(j =i + l; j< temp1; j++)

{
If (queue l[i]> queue l [j])

temp = queue 1[i];

queue1[i]

=queue1[j];

queue1[j] =temp;

for(i = o; I < temp2 – 1; i++)

for (j = I + 1; j<temp2; j++)

if(queue2[i]< queue2[j])

temp = queue2[i];

queue2[i] =

queue2[i];queue2[j]

= temp;

}}

for (i = l, j=0; j<temp1; i++,j++)

queue[i] = queue1[j];

queue[i] = max;
for (i=templ + 2, j = 0;

j = 0; j< temp2; i++,j++)


queue[i] = queue2[j];
queue[i] = 0;
queue[0] =
head;

for(j = 0; j<=n + 1; j++)

diff = abs(queue[j + 1] – queue[j]);

seek += diff;

printf(Disk head moves from %d to %d with seek %d\n”, queue[j],queue[j + 1],

diff);

printf(“Total seek time is %d\n”,seek);

avg = seek / (float)n;

printf(“Average seek time is %f\n”,avg);

return 0;

}
OUTPUT:

Enter the max range of disk


220
Enter the initial head position
100
Enter the size of queue request
3
Enter the queue of disk position to be read
14
140
156
Disk head moves from 100 to 140 with seek 40
Disk head moves from 140 to 156 with seek 16
Disk head moves from 156 to 0 with seek 156
Disk head moves from 0 to 14 with seek 14
Disk head moves from 14 to 0 with seek 14
Total seek time is 240
Average seek time is 80.000000

RESULT:

Thus the program scan disk scheduling has been implemented and output is verifiedsuccessfully.
EXP No : 16
INSTALL ANY GUEST OPERATING SYSTEM LIKE LINUX USING
VMWARE
DATE :

AIM

To Install any Guest Operating System like Linux using VM wareSteps

to install and configure VMWare :

ALGORITHM:

Step 1: Download the VMWare workstation. Set up is around 307 MB. Currently, version 12 isavailable.
Please note we have set up screens on version 11.

Step2: Install VMWarre on your machine. Setup is simple and requires clicking NextButton a couple of
times.
Step3: After installation open the VMWare workstation by using either the start menu orshortcut created
on the desktop.

Step4: Click on “Create a New Virtual Mcahine”.

Step5: With default “Typical” selected click on the Next button.

Step6: Specify the path of the operating system setup file.

Step7: In the Next step you need to specify a key or a serial number of the operating system.If you are
using the version then that part can be skipped.

Step8: Enter the names for the virtual machine and specify a path to the directory where you want to
create your virtual machine. It is recommended that the drive you’re selecting to install avirtual machine
should have sufficient space.

Step9: Specify the amount of disk space you want to allocate for a virtual machine.

Allocate disk space according to the size of the software you are going to install on the virtualmachine.

Step10:On the next screen it will show the configuration you selected for a virtual machine.
Step11:It will allocate Hardware according to the default setting but you can change it byusing Customize
button in the above screen.

You can specify what amount of RAM. A processor has to be allocated for a virtual machine. Do not
allocate complete RAM or a complete Processor for a virtual machine. Also, donot allocate very little
RAM or processor. Leave default setting or allocate in such a way that your application should be able to
run on the virtual machine. Else it will result in a show virtualmachine.

Step12:Click on the Finish button to create the virtual machine at the specified location andwith specified
resources.

If you have specified a valid file (.iso, .rar., .nrg) for the operating system it will take standard
time to complete the operating system setup on the virtual machine, and then it will be ready to use your
regular OS

You might also like