0% found this document useful (0 votes)
2 views

Operating System Unit1

A system call is a method for programs to request services from the operating system's kernel, which manages system resources and facilitates interaction between software and hardware. The document outlines the features and services provided by system calls, including process management, file access, and device handling, as well as the structure and types of operating systems. It also discusses file systems, their attributes, operations, and access methods, emphasizing the importance of organization and management of data.

Uploaded by

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

Operating System Unit1

A system call is a method for programs to request services from the operating system's kernel, which manages system resources and facilitates interaction between software and hardware. The document outlines the features and services provided by system calls, including process management, file access, and device handling, as well as the structure and types of operating systems. It also discusses file systems, their attributes, operations, and access methods, emphasizing the importance of organization and management of data.

Uploaded by

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

Introduction of System Call

• A system call is a programmatic


way in which a computer program
requests a service from the kernel
of the operating system it is
executed on.
• A system call is a way for
programs to interact with the
operating system.
• A computer program makes a
system call when it requests the
operating system’s kernel.
• A kernel is the core part of an operating
system.
• It acts as a bridge between software
applications and the hardware of a
computer.
• The kernel manages system resources,
such as the CPU, memory, and devices,
ensuring everything works together
smoothly and efficiently.
• It handles tasks like running
programs, accessing files, and
connecting to devices like printers
and keyboards.
• An Operating System includes the
kernel as its core, but also provides
a user interface, file system
management, network services, and
various utility applications that allow
users to interact with the system
• System call provides the services of
the operating system to the user
programs via the Application Program
Interface(API).
• System calls are the only entry points
into the kernel system and are
executed in kernel mode.
Features of system calls
• Interface
• Protection
• Kernal Mode
• Context Switching
Saving the status of current process
and switching to the kernel mode to
execute the requested service
• Error Handling
• Synchronization
System calls can be used to
synchronize access to shared
resources such as files or
network connections
Services Provided by System Calls
• Process Creation and Management
• Main Memory Management
• File Access, Directory, and File System Management
• Device Handling(I/O)
• Protection
• Networking, etc.
• Process Control: end, abort, create, terminate, allocate,
and free memory.
• File Management: create, open, close, delete, read
files, etc.
• Device Management
• Information Maintenance
• Communication
Operating System Structure
• An operating system is a structure that
allows the user application programs to
interact with the system hardware.
• Since the operating system is such a
complex structure, it should be created with
utmost care so it can be used and modified
easily.
• An easy way to do this is to create the
operating system in parts.
• Each of these parts should be well defined
with clear inputs, outputs and functions.
Simple Structure

• There are many operating


systems that have a rather
simple structure.
• These started as small systems
and rapidly expanded much
further than their scope.
Advantages of Simple Structure
• It delivers better application
performance because of the few
interfaces between the application
program and the hardware.
• It is easy for kernel developers to
develop such an operating
system.
Types of OS structures
• Simple Structure
• Monolith Structure
• Micro-Kernel Structure
• Exo-Kernel Structure
• Layered Structure
• Modular Structure
• Virtual Machines
Monolith Structure
Micro-Kernel Structure
Exo-Kernel Structure
Layered Structure
Virtual Machines
File System
• A computer file is defined as a
medium used for saving and
managing data in the
computer system.
• The data stored in the
computer system is
completely in digital format,
although there can be various
types of files that help us to
store the data.
providing a structured way to
store, organize, and manage
data on storage devices such
as hard drives, SSDs, and USB
drives.
• Essentially, a file system acts
as a bridge between the
operating system and the
physical storage hardware,
allowing users and applications
to create, read, update, and
delete files in an organized and
• A file is a collection of similar
records. A record is a collection
of related fields that can be
treated as a unit by some
application program.
• A field is some basic element
of data. Any individual field
contains a single value. A data
base is collection of related
data.
What is a File System?
•A file system is a method
an operating system uses
to store, organize, and
manage files and
directories on a storage
device.
Some common types of file systems
include:
• FAT (File Allocation Table): An older file system
used by older versions of Windows and other
operating systems.
• NTFS (New Technology File System): A modern
file system used by Windows. It supports features
such as file and folder permissions, compression,
and encryption.
• ext (Extended File System): A file system
commonly used on Linux and Unix-based operating
systems.
• HFS (Hierarchical File System): A file system
used by macOS.
• APFS (Apple File System): A new file system
introduced by Apple for their Macs and iOS devices.
The name of the file is divided
into two parts as shown below:

• Name
• Extension, separated by a
period.
• Example:filename.docx
• Markslist.docx
FILE ATTRIBUTES
1. Name : A file is named for the
convenience of the user and is referred
by its name. A name is usually a string of
characters.
2. Identifier : This unique tag, usually a
number ,identifies the file within the file
system.
3. Type : Files are of so many types. The
type depends on the extension of the
file. Example: .exe Executable
file .obj Object file .src Source file
4. Location : This information is a
pointer to a device Eg:C:\Users\lavan\
OneDrive\Documents\Desktop
5. Size : The current size of the file (in
bytes, words,blocks).
6. Protection : Access control
information determines who can do
reading, writing, executing and so on.
7. Time, Date, User identification : This
information may be kept for creation,
last modification,last use.
FILE OPERATIONS
1.Creating a file : Two steps are
needed to create a file.
• They are: Check whether the space is
available or not.
If the space is available then
• made an entry for the new file in the
directory.
The entry includes name of the file,
path of the file,etc…
2. Writing a file : To write a file, we
have to know 2 things.
• One is name of the file and
• second is the information or data
to be written on the file, the
system searches the entire given
location for the file.
If the file is found, the system must
keep a write pointer to the location
in the file where the next write is to
take place.
3. Reading a file : To read a file,
first of all we search the
directories for the file, if the file
is found, the system needs to
keep a read pointer to the
location in the file where the
next read is to take place.
Once the read has taken place,
the read pointer is updated
4. Repositioning within a
file : The directory is
searched for the
appropriate entry and the
current file position
pointer is repositioned to
a given value.
This operation is also
called file seek.
5. Deleting a file : To delete
a file, first of all search the
directory for named file, then
released the file space and
erase the directoryentry
.6. Truncating a file : To
truncate a file, remove the
file contents only but, the
attributes are as it is.
File Access Methods

There are three ways to


access a file in a computer
system:
• Sequential-Access
• Direct Access
• Index sequential Method
•It is the simplest access method.
Sequential Access
•Information in the file is processed in order,
one record after the other.
•This mode of access is by far the most
common; for example, the editor and
compiler usually access the file in this
fashion.
•Read and write make up the bulk of the
operation on a file.
•A read operation -read next- reads the next
position of the file and automatically
advances a file pointer, which keeps track of
the I/O location.
•Similarly, for the -write next- append to the
end of the file and advance to the newly
• Eg : A file consisting of 100
records, the current position of
read/write head is 45 th record,
suppose we want to read the 75 th
record then, it access sequentially
from 45, 46, 47 …….. 74, 75.
• So the read/write head traverse all
the records between 45 to 75.
Key Points related to Sequential
Access
• Data is accessed from one record
right after another record in an
order.
• When we use the read command, it
moves ahead pointer by one.
• When we use the write command, it
will allocate memory and move the
pointer to the end of the file.
• Such a method is reasonable for
tape.
Advantages of Sequential Access Method
• It is simple to implement this file
access mechanism.
• It useslexicographic order to
quickly access the next entry.
• It is suitable for applications that
require access to all records in a
file, in a specific order.
• It is less prone to data corruption
as the data is written sequentially
and not randomly.
• It is a more efficient method
for reading large files, as it
only reads the required data
and does not waste time
reading unnecessary data.
• It is a reliable method for
backup and restore operations,
as the data is stored
sequentially and can be easily
restored if required.
Direct Access Method
• Another method is direct access
method also known as relative
access method.
• A fixed-length logical record that
allows the program to read and
write record rapidly. in no
particular order.
• The direct access is based on the
disk model of a file since disk
allows random access to any file
block.
• For direct access, the file is viewed as a
numbered sequence of block or record.
• Thus, we may read block 14 then block
59, and then we can write block 17.
• There is no restriction on the order of
reading and writing for a direct access
file.
• A block number provided by the user to
the operating system is normally
a relative block number, the first
relative block of the file is 0 and then 1
and so on.
Eg : CD consists of 10 songs, at present we are listening song
3, If we want to listen song 10, we can shift to 10.
Advantages of Direct Access
Method
• The files can be immediately
accessed decreasing the
average access time.
• In the direct access method, in
order to access a block, there
is no need of traversing all the
blocks present before it.
Disadvantages of Direct Access
Method
• Complex Implementation :
Implementing direct access can be
complex, requiring sophisticated
algorithms and data structures to
manage and locate records efficiently.
• Higher Storage Overhead : Direct
access methods often require additional
storage for maintaining data location
information (such as pointers or address
tables), which can increase the overall
storage requirements.
Index Sequential method
• It is the other method of accessing a
file that is built on the top of the
sequential access method. These
methods construct an index for the
file.
• The index, like an index in the back of
a book, contains the pointer to the
various blocks.
• To find a record in the file, we first
search the index, and then by the help
of pointer we access the file directly.
Key Points Related to
Index Sequential Method

• It is built on top of Sequential


access.
• It control the pointer by using
index.
Advantages of Index Sequential Method

• Efficient Searching : Index sequential


method allows for quick searches through
the index.
• Balanced Performance : It combines the
simplicity of sequential access with the
speed of direct access, offering a balanced
approach that can handle various types of
data access needs efficiently.
• Flexibility : This method allows both
sequential and random access to data,
making it versatile for different types of
applications, such as batch processing and
real-time querying.
• Improved Data Management :
Indexing helps in better organization
and management of data.
• It makes data retrieval faster and
more efficient, especially in large
databases.
• Reduced Access Time : By using an
index to directly locate data blocks,
the time spent searching for data
within large datasets is significantly
reduced.
manage these files grouped these
files and load one group
into one partition. Each partition is
called a directory. A directory
structure provides a
mechanism for organizing many
files in the file system.
Operation on the directories: the
various operations that can be
performed on directory
are:
 Searching for a file: we need to
search a directory structure to find
the entry for a
particular file. Since files have
symbolic names in a user-readable
form and similar
names may indicate a relationship
between files. We may want to
able to find all files
whose names match a particular
pattern.
 Create a file: new files are
created and added to the directory.
 Delete a file: when we do not

You might also like