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

Introduction to Operating system

An operating system (OS) is essential software that manages computer hardware and software resources, facilitating user interaction and efficient resource utilization. It encompasses various functions such as process, memory, file, and device management, and includes types like batch, time-sharing, real-time, and network operating systems. Additionally, system calls serve as a bridge between user applications and the OS kernel, enabling secure and efficient resource management.

Uploaded by

amandwip51
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views

Introduction to Operating system

An operating system (OS) is essential software that manages computer hardware and software resources, facilitating user interaction and efficient resource utilization. It encompasses various functions such as process, memory, file, and device management, and includes types like batch, time-sharing, real-time, and network operating systems. Additionally, system calls serve as a bridge between user applications and the OS kernel, enabling secure and efficient resource management.

Uploaded by

amandwip51
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 43

2025

AMAN SINGH
COMPUTER SCIENCE 3RD
YEAR
ROLL NO – 2513703
ENROLLMENT NO-
D2210019

[ OPERATING SYSTEM
]
An operating system (OS) is software that controls a computer's resources and manages how applications
INTRODUCTION TO
Introduction to Operating system
An operating system (OS) is a software that acts as an intermediary between computer hardware
and users. It manages and coordinates the activities of the computer's hardware and software,
ensuring efficient and effective use of resources.

Main Functions of an Operating System:

1. Process Management: The OS handles the creation, scheduling, and termination of


processes. It ensures that different processes get the CPU time they need to execute
efficiently.
2. Memory Management: The OS manages the computer's memory, allocating and
deallocating memory spaces as needed by different programs. It keeps track of each byte
in a computer’s memory and ensures optimal memory utilization.
3. File System Management: The OS provides a way to store, organize, and manage data
on storage devices through file systems. It handles file creation, deletion, and access
control.
4. Device Management: The OS manages input/output devices, such as keyboards, mice,
printers, and disk drives. It provides device drivers to ensure that software can
communicate with hardware components effectively.
5. Security and Protection: The OS ensures that unauthorized users do not access the
system and that data is protected from corruption or unauthorized access. It manages user
authentication and implements security policies.
6. User Interface: The OS provides a user interface, such as a command-line interface
(CLI) or graphical user interface (GUI), allowing users to interact with the computer
system.
7. Networking: The OS enables communication between computers over networks,
managing network connections and data transfers.

Examples of Operating Systems:

 Windows
 macOS
 Linux
 Unix
 Android
 iOS

system software

System Software

System software serves as the foundation of a computer, managing hardware and enabling the
functioning of application software. It includes:
1. Operating Systems: The core software that manages hardware resources and provides
essential services, such as Windows, macOS, Linux, and Unix.
2. Device Drivers: Programs that allow the operating system to communicate with
hardware devices like printers, graphics cards, and network adapters.
3. Utilities: System maintenance tools, such as antivirus programs, disk defragmenters, and
backup software.
4. Firmware: Low-level software embedded in hardware devices, often providing basic
control and communication.

Application software

Application Software

Application software is designed to help users perform specific tasks or functions. It includes:

1. Productivity Software: Tools for creating documents, spreadsheets, presentations, and


databases, like Microsoft Office, Google Docs, and Adobe Acrobat.
2. Multimedia Software: Programs for editing and viewing media, such as Adobe
Photoshop, VLC Media Player, and iTunes.
3. Web Browsers: Applications for accessing the internet, like Google Chrome, Mozilla
Firefox, and Safari.
4. Games: Software designed for entertainment and leisure, ranging from simple mobile
games to complex computer games.
5. Specialized Software: Applications tailored for specific industries or tasks, such as
AutoCAD for engineering design or QuickBooks for accounting.

Key Differences

1. Purpose:
o System Software: Manages and controls hardware and provides a platform for
application software to run.
o Application Software: Enables users to accomplish specific tasks, such as word
processing, browsing the internet, or playing games.
2. Interaction:
o System Software: Interacts closely with hardware and performs essential
functions required by the system.
o Application Software: Interacts with system software to utilize hardware
resources for specific user tasks.
3. Necessity:
o System Software: Essential for the basic operation of a computer.
o Application Software: Not essential for basic operation, but necessary for
performing specific tasks.
4. Examples:
o System Software: Windows, macOS, Linux, device drivers, BIOS.
o Application Software: Microsoft Word, Adobe Photoshop, Google Chrome,
Candy Crush.

Different types of operating system

 Batch Operating Systems:

 Description: These systems execute batches of jobs without manual intervention. Jobs
with similar needs are grouped together and processed in a sequence.
 Example: Early mainframe systems like IBM's OS/360.
 Advantages: Efficient for large volumes of similar tasks, reduced idle time.
 Disadvantages: Lack of interactivity, long turnaround times for individual jobs.

 Time-Sharing Operating Systems:

 Description: Multiple users can access the system simultaneously by sharing time slices
of the CPU. This provides an interactive computing environment.
 Example: UNIX.
 Advantages: Improved user interaction, efficient use of resources, reduced response
time.
 Disadvantages: Complexity in managing resources, potential security issues due to
multiple users.

 Real-Time Operating Systems (RTOS):

 Description: These systems are designed to process data and events in real-time, with
strict time constraints. They are used in environments where timely execution is critical.
 Example: VxWorks, QNX.
 Advantages: Predictable behavior, high reliability and performance.
 Disadvantages: Limited multitasking capabilities, high development and maintenance
costs.

 Distributed Operating Systems:

 Description: These systems manage a group of independent computers and make them
appear to the users as a single coherent system.
 Example: Google’s MapReduce, Microsoft Azure.
 Advantages: Resource sharing, improved reliability and availability.
 Disadvantages: Network dependency, complexity in synchronization and data
consistency.

 Network Operating Systems:

 Description: These systems provide features for managing and using network resources,
allowing multiple computers to communicate and share resources.
 Example: Novell NetWare, Windows Server.
 Advantages: Centralized management, resource sharing, enhanced security.
 Disadvantages: Dependency on network infrastructure, potential bottlenecks.

 Mobile Operating Systems:

 Description: Designed for mobile devices such as smartphones and tablets, these systems
are optimized for mobile hardware and touch interfaces.
 Example: Android, iOS.
 Advantages: User-friendly interfaces, optimized for mobile use, extensive app
ecosystems.
 Disadvantages: Limited control and customization, potential security vulnerabilities

Multitasking –
Multitasking in an operating system (OS) refers to the ability to execute multiple tasks or processes
simultaneously. It allows multiple applications and processes to run concurrently, making efficient use of
the CPU and system resources.

Significance of operating system-Significance of Multitasking in an


OS:

1. Increased Productivity: By allowing multiple applications to run at the same time, users
can perform several tasks simultaneously, such as browsing the web while working on a
document or listening to music.
2. Efficient Resource Utilization: The OS allocates CPU time and system resources to
various tasks based on their priority and requirements, ensuring that resources are used
effectively.
3. Improved System Responsiveness: Multitasking allows the system to remain responsive
to user inputs and requests, even when multiple processes are running. This enhances the
overall user experience.
4. Parallel Processing: Multitasking enables parallel processing, where different parts of a
program or multiple programs can be executed simultaneously on multi-core processors,
leading to faster execution and better performance.

Network operating system


Network Operating Systems (NOS) are designed to manage and support network resources,
enabling multiple computers to communicate, share resources, and operate cohesively within a
network. These systems are essential for networking environments where resource sharing,
centralized management, and communication are critical.

Significance of NOS

 Centralized Management:
 Network administrators can manage network resources, user accounts, and security
policies from a central location. This simplifies the administration and maintenance of the
network.

 Resource Sharing:

 NOS allows multiple computers to share resources such as files, printers, and
applications. This enhances efficiency and reduces redundancy within the network.

 Security and Access Control:

 Robust security features, including user authentication, access control, and encryption,
ensure that network resources are protected from unauthorized access and potential
threats.

 File and Print Services:

 NOS provides file and print services, allowing users to access and share files and printers
across the network. This enables seamless collaboration and resource utilization.

 Network Communication:

 NOS facilitates communication between networked computers through protocols like


TCP/IP. It supports services such as email, web hosting, and remote access.

 Scalability:

 Network operating systems are designed to scale with the growth of the network. They
can accommodate an increasing number of users, devices, and resources without
compromising performance.

 Fault Tolerance and Reliability:

 NOS includes features like redundancy, backup, and failover mechanisms to ensure
network reliability and minimize downtime in case of hardware or software failures.

 User and Group Management:

 Network administrators can create and manage user accounts and groups, assigning
specific permissions and roles to control access to network resources.

Differences from Other Types of Operating Systems:

1. Purpose:
o Network Operating Systems: Focus on managing network resources, facilitating
communication, and ensuring security within a networked environment.
o Standalone Operating Systems: Primarily designed for single-user
environments, managing local resources without network-centric features.
2. Centralized vs. Decentralized Management:
o Network Operating Systems: Enable centralized management of resources, user
accounts, and security policies.
o Other Operating Systems: Management is typically decentralized, focusing on
individual devices.
3. Resource Sharing:
o Network Operating Systems: Emphasize resource sharing and collaboration
across the network.
o Other Operating Systems: Resource sharing is limited to local resources on
individual devices.
4. Security Features:
o Network Operating Systems: Implement advanced security measures to protect
network resources and data.
o Other Operating Systems: Security features are tailored to protect local
resources and user data.

Examples of Network Operating Systems:

 Windows Server
 Novell NetWare

Mobile Operating Systems:

Mobile operating systems are specialized software platforms designed for mobile devices like
smartphones, tablets, and wearable devices. These systems are optimized for the hardware and
touch interfaces commonly found on mobile devices. Some well-known mobile operating
systems include Android and iOS.

Key Features of Mobile Operating Systems:

1. User Interface:
o Optimized for touch input with gestures, swipes, and multi-touch capabilities.
o Intuitive and responsive interfaces tailored for smaller screens.
2. App Ecosystem:
o Support for a wide range of mobile applications available through app stores (e.g.,
Google Play Store, Apple App Store).
o Easy app installation and updates.
3. Connectivity:
o Built-in support for wireless connectivity options such as Wi-Fi, Bluetooth, and
cellular networks.
o Seamless integration with cloud services for data synchronization and backup.
4. Power Management:
o Advanced power management features to extend battery life and optimize
performance.
o Efficient use of resources to minimize power consumption.
5. Security:
o Enhanced security measures such as biometric authentication (fingerprint, facial
recognition) and encryption.
o Regular security updates to protect against threats and vulnerabilities.

Unique Challenges Faced by Mobile Operating Systems Compared to Desktop


Operating Systems:

1. Limited Hardware Resources:


o Mobile OS: Operate on devices with constrained hardware resources such as
limited processing power, memory, and storage.
o Desktop OS: Typically have access to more powerful hardware and larger storage
capacities.
2. Battery Life:
o Mobile OS: Must optimize power consumption to extend battery life, requiring
efficient resource management.
o Desktop OS: Power consumption is less of a concern as desktops are usually
plugged into a power source.
3. User Interface:
o Mobile OS: Designed for touch-based interaction, requiring a different approach
to UI design compared to traditional keyboard and mouse input.
o Desktop OS: Primarily designed for keyboard and mouse input, with larger
screens allowing for more complex interfaces.
4. App Development:
o Mobile OS: Developers need to consider various screen sizes, orientations, and
hardware capabilities across different devices.
o Desktop OS: Typically have more standardized hardware and screen sizes,
simplifying app development.
5. Security Concerns:
o Mobile OS: Higher risk of theft or loss, requiring robust security measures such
as remote wipe and data encryption.
o Desktop OS: Security concerns are still present but differ in nature, focusing
more on software vulnerabilities and network security.
6. Connectivity:
o Mobile OS: Need to manage seamless transitions between different network types
(e.g., Wi-Fi, cellular) and handle varying network conditions.
o Desktop OS: Usually operate on stable, high-speed internet connections.

System call –

A system call is a mechanism that allows a program to request a service from the kernel of the operating
system. It serves as a bridge between user-space applications and the operating system's core functions,
enabling programs to perform tasks that require direct interaction with the hardware or core system
resources.
Importance of System Calls in Operating Systems:

1. Resource Management: System calls facilitate efficient management of system


resources such as CPU, memory, and I/O devices, ensuring that applications can interact
with these resources without compromising system stability.
2. Abstraction: They provide an abstraction layer that simplifies the complexity of
hardware interactions, allowing developers to write applications without needing to know
the intricacies of the underlying hardware.
3. Security and Protection: By restricting direct access to hardware and sensitive
operations, system calls help maintain system security and prevent malicious or
erroneous code from causing harm.
4. Process Control: System calls enable the creation, execution, and termination of
processes, as well as communication between processes, which are fundamental aspects
of multitasking and process management in an OS.
5. File and Device Operations: System calls allow applications to perform operations on
files and devices, such as reading, writing, opening, closing, and managing file
permissions.

Examples of System Calls:

1. Process Control: fork(), exec(), wait(), exit()


2. File Management: open(), read(), write(), close()
3. Device Management: ioctl(), read(), write()
4. Information Maintenance: getpid(), alarm(), sleep()
5. Communication: pipe(), shmget(), mmap(), msgsnd(), msgrcv()

User-Space Applications

 User-space applications are programs that run outside the operating system's kernel.
Examples include web browsers, text editors, and games.
 These applications operate in user mode, which restricts direct access to hardware and
critical system resources to ensure system stability and security.

How They Interact(system call and user application)

1. Request: When a user-space application needs to perform a task that requires kernel
intervention (e.g., reading a file), it makes a system call.
2. Switch to Kernel Mode: The system call causes the CPU to switch from user mode to
kernel mode, granting the necessary privileges to execute the requested service.
3. Kernel Processing: The kernel processes the request, performing the necessary
operations (e.g., accessing the file system to read the requested data).
4. Return to User Mode: Once the kernel has completed the requested service, it switches
the CPU back to user mode and returns the results to the user-space application.
5. Application Continues: The user-space application continues execution, using the
results provided by the kernel.
Main functions of system calls are

System calls play a crucial role in an operating system, providing the interface between user-
space applications and kernel-space services. Here are the main functions of system calls:

1. Process Control:
o Creation and Termination: System calls like fork(), exec(), exit(), and
wait() are used to create, execute, and terminate processes. They enable process
management by allowing processes to be started, stopped, and synchronized.
o Scheduling: System calls manage the scheduling of processes, ensuring fair
allocation of CPU time among running processes.
2. File Management:
o Operations: System calls like open(), read(), write(), close(), and
unlink() allow user-space applications to perform operations on files and
directories. They enable file creation, reading, writing, closing, and deletion.
o Permissions: System calls also handle file permissions and access control,
ensuring that only authorized users can access or modify files.
3. Device Management:
o Communication: System calls facilitate communication between user-space
applications and hardware devices. For example, ioctl() allows applications to
send control commands to devices.
o Input/Output: System calls manage I/O operations, such as reading data from
input devices (e.g., keyboards) and writing data to output devices (e.g., printers).
4. Information Maintenance:
o Status Information: System calls like getpid(), getuid(), and alarm()
provide information about the system and processes. They allow applications to
retrieve process IDs, user IDs, and set timers.
o System Information: System calls can retrieve system information, such as
system uptime, memory usage, and hardware status.
5. Inter-Process Communication (IPC):
o Communication Mechanisms: System calls like pipe(), shmget(), msgsnd(),
and msgrcv() enable communication between processes. They facilitate data
exchange and synchronization through pipes, shared memory, message queues,
and semaphores.
6. Memory Management:
o Allocation and Deallocation: System calls like brk() and mmap() manage
memory allocation and deallocation for user-space applications. They ensure
efficient use of memory and prevent conflicts.
o Paging and Swapping: System calls handle paging and swapping, allowing
processes to use virtual memory and access data stored on disk.

Explain the process control system calls, such as fork(), exec(), wait(), and exit().

 fork():
 Purpose: fork() is used to create a new process. This new process is called the child
process, and the process that calls fork() is the parent process.
 Behavior: When fork() is called, it creates an exact copy of the parent process,
including the code, data, and open files. The child process gets a unique process ID
(PID).
 Return Values: fork() returns twice—once in the parent process and once in the child
process. In the parent, it returns the PID of the child; in the child, it returns 0.

 exec():

 Purpose: exec() is used to replace the current process image with a new process image.
Essentially, it runs a new program within the same process.
 Behavior: There are several variants of exec(), such as execl(), execp(), and
execv(). When exec() is called, it loads the new program into the current process's
memory space, overwriting the existing program.
 Return Values: exec() does not return on success because the new program replaces the
current one. If it fails, it returns -1.

 wait():

 Purpose: wait() and its variants (such as waitpid()) are used by a parent process to
wait for the termination of its child processes.
 Behavior: When the parent calls wait(), it blocks until one of its child processes exits.
The exit status of the terminated child process can be retrieved.
 Return Values: wait() returns the PID of the terminated child process. If an error
occurs, it returns -1.

 exit():

 Purpose: exit() is used by a process to terminate itself. It performs clean-up operations,


such as closing open files and releasing allocated memory.
 Behavior: When exit() is called, the process terminates and returns an exit status to the
operating system. This status can be used by the parent process to determine how the
child process ended.
 Return Values: exit() does not return because it terminates the process. It takes an
integer argument that represents the exit status.

system calls act as interface between user applications and kernel


services

System calls are critical in providing an interface between user applications and kernel services.
They serve as the primary mechanism through which user-space applications interact with the
operating system's kernel to request various services. Here's how system calls fulfill this role:

Interface Mechanism
1. Controlled Access:
o Security and Protection: System calls provide a controlled and secure way for
user applications to access kernel services. This ensures that user applications
cannot directly access hardware or critical system resources, protecting the system
from accidental or malicious actions.
2. Transition Between Modes:
o User Mode to Kernel Mode: When a system call is invoked, the CPU transitions
from user mode to kernel mode. This switch allows the operating system to
perform tasks that require higher privileges, such as hardware access or process
management.
o Kernel Mode to User Mode: After the kernel completes the requested service,
the CPU transitions back to user mode, returning control to the user application.

Different categories of system calls

System calls can be categorized into several groups based on their functionality and the services
they provide. Here are the main categories of system calls:

1. Process Control

System calls in this category manage processes, including their creation, execution,
synchronization, and termination.

 fork(): Creates a new process by duplicating the calling process.


 exec(): Replaces the current process image with a new process image.
 exit(): Terminates a process and returns an exit status to the parent process.
 wait(): Waits for a child process to terminate and retrieves its exit status.

2. File Management

These system calls handle file operations, such as creating, reading, writing, and deleting files.

 open(): Opens a file and returns a file descriptor.


 read(): Reads data from a file into a buffer.
 write(): Writes data from a buffer to a file.
 close(): Closes an open file descriptor.
 unlink(): Deletes a file.

3. Device Management

System calls in this category manage communication between user applications and hardware
devices.

 ioctl(): Performs device-specific input/output operations.


 read(): Reads data from a device.
 write(): Writes data to a device.
4. Information Maintenance

These system calls provide information about the system and processes.

 getpid(): Returns the process ID of the calling process.


 getuid(): Returns the user ID of the calling process.
 alarm(): Sets a timer to send a signal after a specified number of seconds.

5. Inter-Process Communication (IPC)

System calls in this category enable communication and synchronization between processes.

 pipe(): Creates a unidirectional communication channel between processes.


 shmget(): Allocates a shared memory segment.
 msgsnd(): Sends a message to a message queue.
 msgrcv(): Receives a message from a message queue.
 semop(): Performs operations on semaphores.

6. Memory Management

These system calls manage memory allocation and deallocation for processes.

 brk(): Changes the location of the program break, increasing or decreasing the amount of
memory allocated to a process.
 mmap(): Maps files or devices into memory, providing efficient file I/O.

file system-

A file system is a method and data structure that the operating system uses to control
how data is stored, organized, and retrieved on storage devices like hard drives,
SSDs, and USB drives. It provides a way for users and applications to store and
access files in a structured and efficient manner.

Main function of file system are as follows

Main Functions of a File System:

1. Data Storage and Retrieval:


o The file system allows data to be stored on a storage device and retrieved when
needed. It organizes data into files and directories, making it easy to locate and
access specific pieces of information.
2. File Organization:
o The file system organizes files into a hierarchical structure of directories (also
known as folders). This structure helps users and applications to navigate and
manage files efficiently.
3. File Naming:
o The file system provides a way to name files and directories, allowing users to
identify and access them using meaningful names. It supports various naming
conventions and ensures that file names are unique within a directory.
4. Access Control:
o The file system implements access control mechanisms to regulate who can read,
write, or execute a file. This ensures data security and prevents unauthorized
access to sensitive information.
5. File Metadata Management:
o The file system maintains metadata for each file, such as its name, size, creation
date, modification date, and permissions. Metadata helps in managing and
organizing files efficiently.
6. Space Management:
o The file system manages the allocation and deallocation of storage space on the
device. It keeps track of free and used space, ensuring that storage is utilized
efficiently and avoiding fragmentation.
7. Data Integrity and Reliability:
o The file system ensures data integrity and reliability by implementing
mechanisms to detect and recover from errors. It may include features like
journaling, checksums, and redundant storage to protect data from corruption.
8. File Operations:
o The file system provides a set of operations for manipulating files, such as
creating, opening, reading, writing, renaming, and deleting files. These operations
enable users and applications to interact with files in a standardized way.

File
 Definition: A file is a collection of data or information that is stored on a storage device.
Files can contain various types of data, such as text, images, videos, executables, and
more.
 Purpose: Files are used to store and organize data for specific tasks or applications.
 Naming: Each file has a unique name and often an extension (e.g., .txt, .jpg, .exe)
that indicates the type of data it contains.
 Examples: A document (report.docx), an image (photo.jpg), a video (movie.mp4), a
program (game.exe).

Directory
 Definition: A directory (or folder) is a special type of file that can contain other files and
directories. It provides a way to organize and manage files in a hierarchical structure.
 Purpose: Directories are used to group related files and subdirectories together, making it
easier to navigate and manage the file system.

 Naming: Each directory has a unique name within its parent directory. Unlike files,
directories do not have extensions.

 Examples: A directory named Documents containing files like resume.pdf and


cover_letter.docx, or a directory named Photos containing subdirectories for different events
(e.g., Vacation, Birthday).

Difference between File and Folder:


S.No
. Comparison File Folder

Folders does not have any


1. Extensions Files can have extensions.
extensions.

Serial, sequential, indexed Single directory per user


2. Organizations sequential and direct file and multiple directory per
organizations. user organization.

Contain other
3. No. Yes.
same entity

A place to store a group of


4. Basic Collection of data.
related files and folders.

Space There is a specific size of a Folder does not consume


5.
consumption file. space in the memory.

It has Name, Extension, Date,


It has Name, Date, Time
6. Properties Time, Length and Protection
and Protection attributes.
attributes.

After creation, We can open, After creation, We can


7. After Creation save, rename, print, email move, rename and delete
and modify file content. folders.

Share on We can not share file on We can share folder on


8.
Network network. network.
Different types of file system
. FAT (File Allocation Table)

 Characteristics:
o Simple and widely supported by various operating systems, including Windows,
macOS, and Linux.
o Suitable for small storage devices like USB flash drives and memory cards.
o Limited file and volume size (FAT32 supports files up to 4GB and volumes up to
2TB).
 Variants: FAT12, FAT16, FAT32.
 Use Cases: Portable storage devices, compatibility across different platforms.

2. NTFS (New Technology File System)

 Characteristics:
o Developed by Microsoft for Windows operating systems.
o Supports large file and volume sizes, with built-in security features like file
permissions and encryption.
o Provides features like journaling, which helps recover data in case of a system
crash, and support for large storage devices.
o Efficient space management and file compression.
 Use Cases: Windows-based systems, internal and external hard drives.

3. ext4 (Fourth Extended File System)

 Characteristics:
o Developed for Linux operating systems.
o Supports large file and volume sizes, journaling, and file system snapshots.
o Extents-based file allocation, which improves performance and reduces
fragmentation.
o Backward compatible with ext3 and ext2 file systems.
 Use Cases: Linux-based systems, internal and external storage devices.

4. HFS+ (Hierarchical File System Plus)

 Characteristics:
o Developed by Apple for macOS.
o Supports large file and volume sizes, journaling, and Unicode file names.
o Efficient space management and support for file system quotas.
 Use Cases: macOS-based systems, internal and external storage devices.

5. APFS (Apple File System)

 Characteristics:
o The successor to HFS+, designed for modern storage technologies like SSDs.
o Features include strong encryption, space sharing, snapshots, and fast directory
sizing.
o Optimized for performance and reliability.
 Use Cases: macOS, iOS, and other Apple devices.

6. exFAT (Extended File Allocation Table)

 Characteristics:
o Developed by Microsoft, designed to address the limitations of FAT32.
o Supports large files and volumes, without the limitations of FAT32.
o Compatible with both Windows and macOS.
 Use Cases: Portable storage devices, cross-platform compatibility.

file system in disk space allocation


A file system manages disk space allocation to ensure efficient storage, organization, and
retrieval of data on storage devices. Here are the main methods and techniques used by file
systems to manage disk space allocation:

1. Contiguous Allocation

 Description: Files are stored in contiguous blocks of disk space. Each file occupies a
continuous sequence of blocks.
 Advantages: Simple to implement, efficient for sequential file access.
 Disadvantages: Can lead to fragmentation, making it difficult to find contiguous free
space for new files.

2. Linked Allocation

 Description: Files are stored as linked lists of disk blocks. Each block contains a pointer
to the next block in the file.
 Advantages: Eliminates fragmentation issues, allows files to grow easily.
 Disadvantages: Slower access time due to pointer traversal, overhead of storing pointers.

3. Indexed Allocation

 Description: Each file has an index block that contains pointers to the data blocks of the
file. The index block provides direct access to the file's data blocks.
 Advantages: Fast random access to file data, supports dynamic file growth.
 Disadvantages: Overhead of storing index blocks, limited by the size of the index block.

4. Extent-Based Allocation
 Description: Files are stored in extents, which are contiguous blocks of disk space. A file
may consist of multiple extents.
 Advantages: Efficient for large files, reduces fragmentation.
 Disadvantages: More complex to manage compared to simple contiguous or linked
allocation.

5. Free Space Management

File systems also manage free disk space using various techniques to keep track of available
space:

 Free List: A linked list of free disk blocks. Each entry in the list points to a free block.
 Bitmap: A bitmap where each bit represents a disk block. A bit value of 0 indicates a free
block, while a bit value of 1 indicates an occupied block.
 Grouping: Free blocks are grouped together, and each group contains a pointer to the
next group of free blocks.
 Counting: Instead of listing all free blocks, the file system keeps track of the first free
block and the number of contiguous free blocks following it

The purpose of a directory structure in an operating system

The directory structure in an operating system serves several important purposes, ensuring
efficient data management and organization. Here are the main functions:

1. Organization of Files

 Hierarchy: The directory structure provides a hierarchical organization of files and


directories (folders), making it easier to locate and manage data. This hierarchy helps
users navigate the file system and categorize files logically.
 Grouping: Related files can be grouped together in directories, facilitating better
organization and quick access.

2. Navigation and Path Resolution

 Pathnames: The directory structure allows the use of pathnames to locate files and
directories. Absolute paths specify the location from the root directory, while relative
paths specify the location relative to the current directory.
 Efficient Access: Users can navigate the file system using directory commands (e.g., cd,
ls, mkdir), making file access efficient and intuitive.

3. File Management

 Creation and Deletion: The directory structure enables the creation, deletion, and
renaming of files and directories, providing a systematic way to manage data.
 Storage Organization: Directories help in organizing storage space by segmenting it
into manageable sections, reducing clutter and improving file management.
4. Access Control

 Permissions: The directory structure supports file and directory permissions, allowing
users and administrators to control access to data. Permissions can be set to restrict or
grant read, write, and execute access.
 Security: By organizing files into directories with specific permissions, the system can
enhance data security and prevent unauthorized access.

5. Resource Allocation

 Space Management: The directory structure assists in managing disk space allocation. It
keeps track of free and used space, ensuring efficient storage utilization and preventing
fragmentation.
 Metadata Management: Directories store metadata about files, such as creation date,
modification date, size, and permissions, helping in efficient resource allocation.

6. Support for File Operations

 File Operations: The directory structure provides a framework for file operations like
copying, moving, and searching files. It enables commands and functions that operate on
files and directories to work effectively.

Different types of directory

Directory structures in an operating system can be organized in various ways, each with its own
characteristics and use cases. Here are the main types:

1. Single-Level Directory

 Description: All files are stored in a single directory at the same level.
 Advantages: Simple to implement and easy to understand.
 Disadvantages: Not suitable for systems with a large number of files, as it can become
cluttered and difficult to manage. No way to group related files together.

2. Two-Level Directory

 Description: Each user has a separate directory at the top level, and within each user's
directory, files are stored.
 Advantages: Provides a way to segregate files by user, improving organization and
security.
 Disadvantages: Does not allow for further structuring within a user's directory. Users
cannot share files easily without complex permissions.

3. Hierarchical Directory
 Description: The directory structure is organized as a tree, with a root directory at the
top, and subdirectories branching out.
 Advantages: Supports a complex, organized, and scalable file system. Allows for easy
navigation and grouping of related files.
 Disadvantages: More complex to implement and manage compared to single-level or
two-level directories.

4. Acyclic Graph Directory

 Description: Similar to a hierarchical directory, but allows shared files and directories
using links, forming an acyclic graph (no cycles).
 Advantages: Facilitates sharing of files and directories without duplication. Efficient use
of storage.
 Disadvantages: Can become complex to manage links and ensure that the structure
remains acyclic.

5. General Graph Directory

 Description: An extension of the acyclic graph directory that allows cycles, meaning
directories can be linked in a way that forms a loop.
 Advantages: Provides maximum flexibility for linking and organizing files and
directories.
 Disadvantages: Complexity in managing and maintaining the directory structure.
Potential issues with navigation and file access due to cycles.

Directory
Description Advantages Disadvantages
Structure
Simple, easy to Not scalable, cluttered with
Single-Level All files in a single directory
understand many files
Separate directory for each Organized by user, Limited structure within user
Two-Level
user improved security directories
Tree-like structure with root Organized, scalable,
Hierarchical More complex to manage
and subdirectories easy navigation
Tree structure with shared Efficient sharing, no Complex link management,
Acyclic Graph
files using links (no cycles) duplication maintain acyclic structure
Allows cycles, maximum Flexible file and Complex, potential
General Graph
flexibility in linking directory linking navigation and access issues

Physical structure of disc drive

Tracks, Sectors, and Cylinders

1. Tracks:
o Description: Tracks are concentric circular paths on the surface of the disk
platters where data is magnetically recorded and read.
o Function: Each track holds a portion of the data, and tracks are numbered
sequentially from the outer edge to the inner edge of the disk platter.
2. Sectors:
o Description: Tracks are divided into smaller units called sectors. Each sector
typically holds 512 bytes or 4096 bytes of data.
o Function: Sectors are the smallest units of storage on the disk. The combination
of tracks and sectors forms a grid-like structure on the disk surface, enabling
precise data retrieval.
3. Cylinders:
o Description: A cylinder is a set of tracks located at the same position on each
disk platter. Imagine a stack of disks, where each disk has tracks aligned
vertically. A cylinder includes all tracks at a specific radial distance from the
center, across all platters.
o Function: Cylinders are used to simplify the addressing and data management on
the disk. When the read/write heads are positioned over a cylinder, they can read
or write data on all the platters simultaneously without moving.

Visualization-
Physical Disk Structure

The physical disk structure refers to the actual hardware components and the way data is
organized on the storage medium. It includes:

1. Platters: Circular disks coated with magnetic material, where data is stored.
2. Tracks: Concentric circles on the surface of each platter where data is recorded.
3. Sectors: Smallest units of data storage within a track. Each sector typically holds 512
bytes or 4096 bytes of data.
4. Cylinders: A set of tracks located at the same position on each platter, forming a
cylindrical shape.
5. Read/Write Heads: Mechanisms that move across the platters to read and write data.
6. Spindle: The axis that rotates the platters.

Logical Disk Structure

The logical disk structure refers to the way the operating system organizes and manages data on
the disk. It abstracts the physical structure and presents a logical view to the users and
applications. It includes:

1. Partitions: Logical divisions of the disk, which can be formatted with different file
systems. Each partition can act as a separate logical disk.
2. File Systems: Structures that define how data is stored, organized, and accessed on the
disk (e.g., FAT, NTFS, ext4).
3. Directories and Files: Hierarchical structures that organize data into files and folders.
4. Logical Blocks: Units of data storage managed by the file system. Logical blocks map to
physical sectors on the disk.

Key Differences

Aspect Physical Disk Structure Logical Disk Structure


Abstract representation of data
Actual hardware components and data
Definition organization managed by the operating
organization on the storage medium.
system.
Platters, tracks, sectors, cylinders, Partitions, file systems, directories, files,
Components
read/write heads, spindle. logical blocks.
Visibility Low-level hardware view. High-level user and application view.
Managed by disk hardware and Managed by the operating system and file
Management
firmware. system.
Purpose Physical storage of data on the disk. Logical organization and access to data.
No abstraction; direct interaction with Abstracts physical structure for ease of
Abstraction
hardware. use and management.
Inter-Process Communication (IPC) system calls are used to enable communication and data
sharing between processes. Processes often need to cooperate, synchronize, or exchange data,
and IPC mechanisms facilitate this interaction in a controlled and efficient manner.

Common IPC Mechanisms and System Calls

1. Pipes:
o Description: A pipe is a unidirectional communication channel that allows data to
flow from one process to another.
o System Calls: pipe()
o Usage: Useful for parent-child process communication. The parent process
creates a pipe and both processes can read from or write to it.
2. Named Pipes (FIFOs):
o Description: Similar to pipes, but have a name in the file system and can be used
for communication between unrelated processes.
o System Calls: mkfifo()
o Usage: Allows unrelated processes to communicate through a named pipe in the
file system.
3. Message Queues:
o Description: Message queues allow processes to exchange messages in a queued
manner, providing asynchronous communication.
o System Calls: msgget(), msgsnd(), msgrcv(), msgctl()
o Usage: Suitable for complex communication scenarios where multiple processes
need to send and receive messages.
4. Shared Memory:
o Description: Shared memory allows multiple processes to access the same
memory space, enabling fast and direct data exchange.
o System Calls: shmget(), shmat(), shmdt(), shmctl()
o Usage: Efficient for large data transfers, as it avoids copying data between
processes.
5. Semaphores:
o Description: Semaphores are synchronization tools used to control access to
shared resources and prevent race conditions.
o System Calls: semget(), semop(), semctl()
o Usage: Useful for managing access to shared resources, ensuring mutual
exclusion and coordination among processes.
6. Sockets:
o Description: Sockets provide communication between processes over a network
or on the same machine.
o System Calls: socket(), bind(), listen(), accept(), connect(), send(),
recv()
o Usage: Essential for network communication, enabling processes to send and
receive data over TCP/IP or other protocols.

How IPC System Calls Facilitate Communication


1. Data Exchange:
o IPC mechanisms like pipes, message queues, and shared memory enable
processes to exchange data efficiently. For example, a producer process can write
data to a shared memory segment, and a consumer process can read it.
2. Synchronization:
o Semaphores and other synchronization tools help processes coordinate their
actions and access shared resources without conflicts. For instance, semaphores
can ensure that only one process accesses a critical section of code at a time.
3. Coordination:
o IPC system calls allow processes to signal each other and wait for events. For
example, a process can use message queues to send a signal to another process,
indicating that a certain task is complete.
4. Resource Sharing:
o Shared memory and semaphores enable multiple processes to share resources like
memory and I/O devices. This allows for efficient use of resources and improved
performance.

Process management in operating system

A process and a program are related concepts in computing, but they have distinct differences.

Program

 Definition: A program is a set of instructions written in a programming language, stored


on disk in an executable file. It is a passive entity, meaning it is just the code that exists
as a file on the disk.
 State: A program is static; it does not change unless modified by a programmer.
 Example: A text editor application (e.g., notepad.exe), a web browser (e.g.,
chrome.exe).

Process

 Definition: A process is an instance of a program that is being executed by the operating


system. It is an active entity, meaning it includes the program's code as well as its
execution context, such as the current values of the program counter, registers, and
variables.
 State: A process is dynamic; it changes as the program runs, and its state includes the
current activity, resource usage, and execution context.
 Example: When you open a text editor, a process is created to run notepad.exe. If you
open multiple instances of the text editor, each instance is a separate process.
Key Differences

Aspect Program Process

Nature Passive entity (static) Active entity (dynamic)


Exists in memory (execution
Storage Stored on disk (executable file)
context)
State Does not change during execution Changes dynamically as it runs
Multiple instances can run
Instance Single instance on disk
simultaneously
Example notepad.exe Multiple running instances of
notepad.exe

Life cycle of process

. New

 Description: The process is in the creation phase. The operating system is setting up the
process control block (PCB) and allocating necessary resources.
 State Transition: Once the process is ready to be executed, it transitions to the ready
state.

2. Ready

 Description: The process is in the ready queue, waiting for CPU time. It has all the
resources it needs, but it's not currently executing.
 State Transition: When the scheduler selects the process, it transitions to the running
state.

3. Running

 Description: The process is currently being executed by the CPU. It is actively


performing its instructions.
 State Transition:
o If the process needs to wait for an event (e.g., I/O operation), it transitions to the
waiting state.
o If the process completes its execution, it transitions to the terminated state.
o If the process is preempted by the scheduler (e.g., another process with higher
priority), it transitions back to the ready state.

4. Waiting (Blocked)
 Description: The process is waiting for an event to occur (e.g., I/O completion, signal). It
cannot continue execution until the event is resolved.
 State Transition: Once the event occurs, the process transitions back to the ready state.

5. Terminated

 Description: The process has completed its execution and is being removed from
memory. All resources allocated to the process are released.
 State Transition: The process no longer transitions to any other state, as it has finished
its lifecycle.

Visualization of Process States

Summary

 New: Process creation phase.


 Ready: Process waiting for CPU time.
 Running: Process being executed.
 Waiting: Process waiting for an event.
 Terminated: Process has completed execution.

Context switching-
Context switching is the process by which the operating system saves the state of
a currently running process and restores the state of another process. This allows
multiple processes to share a single CPU and appear to execute concurrently.

Steps in Context Switching

1. Saving the State:


o The CPU state of the currently running process (such as the values of registers,
program counter, and other critical information) is saved into its Process Control
Block (PCB).
2. Loading the State:
o The state of the next process to be executed is loaded from its PCB into the CPU
registers.
3. Switch Execution:
o The CPU starts executing the newly loaded process.

Why Context Switching is Important

1. Multitasking:
o Context switching enables multitasking by allowing multiple processes to share
the CPU. It ensures that each process gets a fair share of CPU time, making the
system responsive to user inputs.
2. Efficient CPU Utilization:
o By rapidly switching between processes, the CPU can maximize its utilization and
minimize idle time, improving overall system performance.
3. Process Isolation:
o Context switching helps in maintaining process isolation and security. Each
process operates in its own virtual environment, preventing interference from
other processes.
4. Responsiveness:
o It enhances system responsiveness by allowing high-priority processes to be
executed promptly, such as responding to user inputs or handling real-time tasks.

Process control block


A Process Control Block (PCB) is a data structure used by the operating system to store and
manage information about a process. The PCB is essential for the process management system,
as it contain
Memory management in operating system

Virtual memory

Virtual memory is a memory management technique that allows an operating system to use
more memory than what is physically available on the system. It creates an illusion for users that
there is unlimited memory available, by using disk space as an extension of RAM. This enables
efficient and seamless execution of programs, even when the physical RAM is insufficient.

How Virtual Memory Works

 Paging: The operating system divides both physical memory (RAM) and virtual memory
into fixed-size blocks called pages. When a program needs to access data that is not
currently in RAM, a page fault occurs, and the operating system retrieves the required
page from disk and loads it into RAM.
 Segmentation: Memory is divided into segments of variable sizes, each representing a
logical unit such as a function or data array. Segmentation provides a way to protect and
manage memory allocation at a higher level of abstraction.

Benefits of Virtual Memory

1. Efficient Memory Utilization:


o Virtual memory allows multiple processes to share the physical memory
efficiently. It enables the operating system to allocate memory dynamically based
on the needs of each process.
2. Isolation and Protection:
o Each process operates in its own virtual address space, providing isolation and
protection. This prevents one process from accessing or modifying the memory of
another process, enhancing system stability and security.
3. Larger Address Space:
o Virtual memory extends the address space beyond the physical limits of RAM.
This allows programs to use more memory than what is physically available,
enabling the execution of larger and more complex applications.
4. Multitasking:
o Virtual memory facilitates multitasking by allowing multiple processes to run
concurrently. It ensures that each process gets the memory it needs, while the
operating system manages the allocation and swapping of pages between RAM
and disk.
5. Program Execution:
o Programs can be loaded and executed even if they are partially present in RAM.
Virtual memory allows the operating system to load only the necessary parts of a
program into memory, reducing the overall memory footprint.
Key Differences between pagin

Key difference between paging and segmentation

Aspect Paging Segmentation


Division Fixed-size pages and frames Variable-sized segments
Logical division based on program
Purpose Simplifies memory management
structure
Fragmentation Internal fragmentation External fragmentation
Addressing Page number and offset Segment number and offset
Efficient memory use, no external
Advantages Logical view, easy sharing, protection
fragmentation
External fragmentation, complex
Internal fragmentation, overhead for
Disadvantages management
page tables

Thrashing
Thrashing is a condition in which a system spends most of its time swapping pages in and out of
memory, rather than executing actual processes. This typically occurs when there is insufficient
physical memory (RAM) to accommodate all the active processes, leading to excessive paging
and a significant drop in system performance.

How to Avoid Thrashing:

1. Adjust Degree of Multiprogramming:


o Limit the number of active processes to ensure that there is enough memory for
each process. This can be achieved through job scheduling or load balancing
techniques.
2. Increase Physical Memory:
o Adding more RAM to the system can help accommodate larger working sets and
reduce the need for frequent paging.
3. Use Efficient Paging Algorithms:
o Implementing efficient page replacement algorithms (e.g., Least Recently Used -
LRU, Optimal Page Replacement) can help reduce the frequency of page faults.
4. Monitor and Tune System Performance:
o Regularly monitoring system performance and tuning memory management
parameters can help identify and mitigate thrashing. Tools like performance
monitors and system profilers can be used for this purpose.
5. Use Working Set Model:
o The working set model keeps track of the active pages for each process and
ensures that enough memory is allocated to hold the entire working set, reducing
page faults and preventing thrashing.
memory allocation and deallocation in operating system

The operating system manages memory allocation and deallocation using various techniques and
strategies to ensure efficient use of memory resources and to maintain system stability. Here are
the key concepts and methods involved:

Memory Allocation

Memory allocation refers to the process of assigning memory blocks to processes or programs.
There are two main types of memory allocation:

1. Static Allocation:
o Description: Memory is allocated at compile-time and remains fixed throughout
the program's execution.
o Example: Global variables and static variables.
2. Dynamic Allocation:
o Description: Memory is allocated at runtime based on the program's needs. This
allows for more flexible and efficient use of memory.
o Example: Dynamic memory allocation using functions like malloc(), calloc(),
and realloc() in C.

Memory Management Techniques

The operating system employs various techniques to manage memory allocation and
deallocation:

1. Paging:
o Description: Memory is divided into fixed-size pages, and the physical memory
is divided into fixed-size frames. Pages are mapped to frames using a page table,
allowing non-contiguous memory allocation and eliminating external
fragmentation.
o Benefits: Simplifies memory allocation, enables efficient use of memory, and
supports virtual memory.
2. Segmentation:
o Description: Memory is divided into variable-sized segments based on the logical
divisions of a program, such as functions or data structures. Each segment has its
own base address and limit.
o Benefits: Provides a logical view of memory, facilitates sharing and protection,
and enables efficient use of memory.
3. Buddy System:
o Description: Memory is divided into blocks of varying sizes that are powers of
two. When a block is allocated, it is split into smaller blocks if necessary. When a
block is deallocated, it is merged with its "buddy" block if possible.
o Benefits: Reduces fragmentation and allows efficient memory allocation and
deallocation.
Memory Allocation Strategies

The operating system uses different strategies to allocate memory to processes:

1. First Fit:
o Description: Allocates the first available memory block that is large enough to
accommodate the request.
o Advantages: Simple and fast.
o Disadvantages: Can lead to fragmentation.
2. Best Fit:
o Description: Allocates the smallest available memory block that is large enough
to accommodate the request.
o Advantages: Reduces wasted memory.
o Disadvantages: Can lead to fragmentation and longer allocation times.
3. Worst Fit:
o Description: Allocates the largest available memory block that is large enough to
accommodate the request.
o Advantages: Reduces the chance of small fragmented blocks.
o Disadvantages: Can lead to inefficient memory use.

Memory Deallocation

Memory deallocation refers to the process of releasing memory blocks that are no longer needed
by a program. The operating system uses various techniques to manage deallocation:

1. Garbage Collection:
o Description: An automated process that identifies and reclaims memory that is no
longer in use by the program.
o Example: Java's garbage collector.
2. Manual Deallocation:
o Description: The programmer explicitly frees memory using functions like
free() in C.
o Advantages: Gives the programmer control over memory management.
o Disadvantages: Can lead to memory leaks and dangling pointers if not managed
correctly.
File system in operating system

A file system is a crucial component of an operating system that manages how data is stored,
organized, and retrieved on a storage device, such as a hard drive, SSD, or USB drive. It
provides a systematic way to store, access, and manage files, ensuring efficient data
management.

Main Responsibilities of a File System:

1. Data Storage and Retrieval:


o The file system is responsible for storing data on the storage device in a structured
manner. It ensures that data can be retrieved quickly and efficiently when needed.
2. File Organization:
o Files are organized into directories (folders) to create a hierarchical structure. This
organization makes it easier to navigate, manage, and locate files.
3. File Naming and Metadata Management:
o The file system allows for the naming of files and directories, ensuring unique and
meaningful names. It also manages file metadata, such as file size, creation date,
modification date, and permissions.
4. Space Management:
o The file system manages the allocation and deallocation of storage space on the
device. It keeps track of free and used space, ensuring efficient use of the
available storage and preventing fragmentation.
5. Access Control and Security:
o The file system enforces access control mechanisms to regulate who can read,
write, or execute a file. This ensures data security and prevents unauthorized
access to sensitive information.
6. File Operations:
o The file system provides a set of operations for creating, opening, reading,
writing, renaming, and deleting files and directories. These operations enable
users and applications to interact with files in a standardized way.
7. Data Integrity and Reliability:
o The file system implements mechanisms to detect and recover from errors,
ensuring data integrity and reliability. Features like journaling, checksums, and
redundant storage help protect data from corruption.

File access control

File access control is a security mechanism used to regulate and manage who can read, write,
execute, or otherwise interact with a file or directory in a file system. It ensures that only
authorized users or processes can access certain files or perform specific operations on them.

Key Components of File Access Control

1. Permissions:
o Read (r): Allows the user to view the contents of a file.
o Write (w): Allows the user to modify or delete the contents of a file.
o Execute (x): Allows the user to execute the file if it is a program or script.
2. Access Control Lists (ACLs):
o Description: ACLs provide a more granular way of specifying permissions. They
list individual users or groups and their specific permissions for a file or directory.
3. User and Group Ownership:
o User: The owner of the file.
o Group: A group of users who have certain permissions for the file.

Importance of File Access Control

1. Data Security:
o File access control helps protect sensitive data from unauthorized access, ensuring
that only authorized users can view or modify it.
2. Privacy:
o It ensures that personal or confidential information is kept private and is not
accessible to unauthorized individuals.
3. Integrity:
o By restricting write access, file access control helps maintain the integrity of data,
preventing unauthorized modifications or deletions.
4. Compliance:
o Many industries have regulatory requirements for data protection. File access
control helps organizations comply with these regulations by enforcing access
policies.
5. Resource Management:
o It prevents unauthorized users from consuming system resources, ensuring that
only legitimate users can access and use them.

File Attributes

File attributes are properties or characteristics of a file that provide information about its state
and how it should be treated by the operating system and applications. Common file attributes
include:

1. Read-Only:
o Description: Indicates that the file can be read but not modified. Useful for
protecting important files from accidental changes.
2. Hidden:
o Description: Prevents the file from being displayed in standard directory listings.
Hidden files are often system or configuration files.
3. System:
o Description: Marks the file as a system file, which is essential for the operating
system's operation. These files are usually protected from user access.
4. Archive:
o Description: Indicates that the file has been modified since the last backup. Used
by backup software to identify files that need to be saved.
5. Executable:
o Description: Indicates that the file can be executed as a program or script.

File Metadata

File metadata is data that provides information about a file's properties, content, and structure.
Metadata helps the operating system and applications manage, organize, and access files
efficiently. Common file metadata includes:

1. File Name:
o Description: The name of the file, which is used to identify it in the file system.
2. File Size:
o Description: The amount of data contained in the file, usually measured in bytes.
3. Creation Date:
o Description: The date and time when the file was created.
4. Modification Date:
o Description: The date and time when the file was last modified.
5. Access Date:
o Description: The date and time when the file was last accessed (read).
6. File Permissions:
o Description: Information about who can read, write, or execute the file (e.g.,
owner, group, others).
7. File Type:
o Description: The format of the file, often indicated by the file extension
(e.g., .txt, .jpg, .exe).
8. Location:
o Description: The path to the file in the file system hierarchy.

A hierarchical file system structure

A hierarchical file system structure organizes files and directories in a tree-like structure, with
directories containing other directories and files. This organization offers several key benefits:

1. Organization and Manageability

 Logical Grouping: Files are logically grouped into directories and subdirectories,
making it easier to organize and manage data.
 Hierarchical Navigation: The tree-like structure allows users to navigate through the file
system efficiently, locating and accessing files with ease.

2. Scalability
 Large Volume Support: The hierarchical structure can accommodate a large number of
files and directories, making it suitable for systems with extensive data storage needs.
 Expandable: New directories and files can be added to the structure without disrupting
existing organization.

3. Access Control and Security

 Granular Permissions: Different levels of access control can be applied to individual


directories and files, enhancing security. Users can set specific permissions for reading,
writing, and executing files.
 Isolation: Sensitive data can be isolated within specific directories, reducing the risk of
unauthorized access.

4. Data Retrieval

 Efficient Search: The hierarchical structure supports efficient file searches, as the search
scope can be limited to specific directories or subdirectories.
 Path Resolution: Using absolute and relative paths, users and applications can quickly
locate and access files.

5. Backup and Recovery

 Targeted Backups: Backups can be performed on specific directories, ensuring critical


data is preserved without backing up the entire file system.
 Easy Recovery: In the event of data loss, specific directories can be restored without
affecting other parts of the file system.

6. Resource Management

 Quota Management: Storage quotas can be applied to specific directories or users,


ensuring fair allocation of resources and preventing any single user from consuming
excessive storage.
 Disk Usage Monitoring: Administrators can monitor disk usage at different levels of the
hierarchy, identifying areas of high consumption and optimizing storage utilization.

Space Allocation

Disk Space Allocation


Security and protection in operating system

Primary goals of operating system security

the primary goals:

1. Confidentiality

 Description: Ensuring that sensitive data is accessible only to authorized users and
processes.
 Techniques: Encryption, access controls, and user authentication mechanisms.

2. Integrity

 Description: Ensuring that data and system resources are accurate, consistent, and
protected from unauthorized modification.
 Techniques: Checksums, digital signatures, and integrity verification mechanisms.

3. Availability

 Description: Ensuring that system resources and services are available to authorized
users when needed.
 Techniques: Redundancy, failover mechanisms, and denial-of-service (DoS) protection.

4. Authentication

 Description: Verifying the identity of users and processes before granting access to
resources.
 Techniques: Passwords, multi-factor authentication (MFA), biometrics, and secure
tokens.

5. Authorization

 Description: Granting or denying permissions to access specific resources based on the


authenticated identity.
 Techniques: Access control lists (ACLs), role-based access control (RBAC), and policy-
based access controls.

6. Auditing and Accountability

 Description: Monitoring and recording user activities and system events to ensure
accountability and detect potential security breaches.
 Techniques: Audit logs, security information and event management (SIEM) systems,
and regular security audits.
7. Non-Repudiation

 Description: Ensuring that users cannot deny their actions or transactions.


 Techniques: Digital signatures, cryptographic hashes, and secure logging mechanisms.

8. Resilience and Recovery

 Description: Ensuring the system can recover from security incidents and continue to
operate securely.
 Techniques: Backup and recovery solutions, incident response plans, and disaster
recovery procedures.

User authentication and its common methods

Common Methods of User Authentication

1. Password-Based Authentication:
o Description: Users provide a username and a secret password to gain access. The
system checks the credentials against a stored database of user information.
o Advantages: Simple and widely used.
o Disadvantages: Can be vulnerable to attacks like brute force, phishing, and
password guessing if passwords are weak or not managed properly.
2. Multi-Factor Authentication (MFA):
o Description: Combines two or more authentication factors to enhance security.
These factors can be something the user knows (password), something the user
has (smartphone or token), or something the user is (biometric).
o Advantages: Provides an additional layer of security.
o Disadvantages: Can be more complex to implement and use.
3. Biometric Authentication:
o Description: Uses unique physical characteristics of the user, such as fingerprints,
facial recognition, retina scans, or voice recognition.
o Advantages: Difficult to forge, convenient for users.
o Disadvantages: Requires special hardware, privacy concerns.
4. Token-Based Authentication:
o Description: Users are provided with a token (physical or digital) that they use to
authenticate. Examples include hardware tokens, software tokens, and one-time
passwords (OTPs) sent to a mobile device.
o Advantages: Secure, especially when used in conjunction with other methods.
o Disadvantages: Tokens can be lost or stolen.
5. Certificate-Based Authentication:
o Description: Uses digital certificates issued by a trusted certificate authority
(CA). The user's identity is verified by validating the certificate.
o Advantages: Highly secure, suitable for secure communications and transactions.
o Disadvantages: Requires a public key infrastructure (PKI) and certificate
management.
6. Smart Card Authentication:
o Description: Uses a smart card containing embedded integrated circuits to store
authentication data. Users insert the card into a reader and provide a PIN.
o Advantages: Secure and portable.
o Disadvantages: Requires smart card readers and card management.
7. Single Sign-On (SSO):
o Description: Allows users to authenticate once and gain access to multiple
systems or applications without needing to re-enter credentials.
o Advantages: Enhances user experience, reduces password fatigue.
o Disadvantages: If compromised, it can provide access to multiple resources.

virus, worm, and Trojan horse

Key Differences

Aspect Virus Worm Trojan Horse


Malicious program Self-replicating program Malicious program
Definition
attaching to files exploiting networks disguised as legitimate
Requires user action
Propagation Requires user action Spreads independently
(deception)
Corrupts/deletes data, Consumes bandwidth, Steals info, creates
Damage
slows system disrupts networks backdoors
Zeus Trojan
Example ILOVEYOU virus Blaster worm

Security policy

Operating systems enforce security policies through a combination of mechanisms and tools
designed to protect data and resources. Here are some of the key methods:

1. Access Control

 User Authentication: Verifying the identity of users through methods like passwords,
biometrics, and multi-factor authentication (MFA).
 Authorization: Granting or denying permissions to access specific resources based on
the authenticated identity using access control lists (ACLs) or role-based access control
(RBAC).

2. File and Resource Permissions

 File Permissions: Setting read, write, and execute permissions for files and directories to
control access.
 Resource Access Controls: Regulating access to system resources like memory, CPU,
and network interfaces to prevent unauthorized usage.
3. Auditing and Monitoring

 Audit Logs: Recording user activities and system events to monitor for suspicious
behavior and ensure accountability.
 Intrusion Detection Systems (IDS): Monitoring network and system activities for
potential security breaches or malicious activity.

4. Encryption

 Data Encryption: Protecting data at rest and in transit using encryption algorithms to
ensure confidentiality and integrity.
 Secure Communication: Implementing protocols like SSL/TLS to secure
communication between devices and services.

5. Security Policies and Configurations

 Security Policies: Defining and enforcing security policies that outline acceptable use,
access controls, and security requirements.
 Configuration Management: Ensuring systems are securely configured and updated to
prevent vulnerabilities.

6. User and Group Management

 User Accounts: Creating and managing user accounts with appropriate access levels and
permissions.
 Group Management: Organizing users into groups to simplify permission management
and enforce group-based security policies.

7. Patch Management

 Software Updates: Regularly applying patches and updates to operating systems and
applications to fix security vulnerabilities and improve defenses.

8. Malware Protection

 Antivirus Software: Detecting and removing malicious software (viruses, worms,


Trojans) to protect the system.
 Real-Time Protection: Continuously monitoring for malware and other security threats.

9. Firewall and Network Security

 Firewalls: Controlling incoming and outgoing network traffic based on predefined


security rules.
 Network Segmentation: Dividing the network into segments to limit the spread of
potential security breaches and isolate sensitive data.
1. Contiguous Allocation:
o Description: Files are stored in contiguous blocks of disk space. Each file
occupies a continuous sequence of blocks.
o Advantages: Simple to implement, efficient for sequential file access.
o Disadvantages: Can lead to fragmentation, making it difficult to find contiguous
free space for new files.
2. Linked Allocation:
o Description: Files are stored as linked lists of disk blocks. Each block contains a
pointer to the next block in the file.
o Advantages: Eliminates fragmentation issues, allows files to grow easily.
o Disadvantages: Slower access time due to pointer traversal, overhead of storing
pointers.
3. Indexed Allocation:
o Description: Each file has an index block that contains pointers to the data blocks
of the file. The index block provides direct access to the file's data blocks.
o Advantages: Fast random access to file data, supports dynamic file growth.
o Disadvantages: Overhead of storing index blocks, limited by the size of the index
block.
4. Extent-Based Allocation:
o Description: Files are stored in extents, which are contiguous blocks of disk
space. A file may consist of multiple extents.
o Advantages: Efficient for large files, reduces fragmentation.
o Disadvantages: More complex to manage compared to simple contiguous or
linked allocation.

Free Space Management

File systems also manage free disk space using various techniques to keep track of available
space:

1. Free List:
o Description: A linked list of free disk blocks. Each entry in the list points to a
free block.
o Advantages: Simple to implement, easy to traverse.
o Disadvantages: Can become inefficient with large lists.
2. Bitmap:
o Description: A bitmap where each bit represents a disk block. A bit value of 0
indicates a free block, while a bit value of 1 indicates an occupied block.
o Advantages: Efficient for tracking large amounts of free space.
o Disadvantages: Requires additional memory for the bitmap.
3. Grouping:
o Description: Free blocks are grouped together, and each group contains a pointer
to the next group of free blocks.
o Advantages: Reduces the overhead of managing free space.
o Disadvantages: Can be complex to implement.
4. Counting:
o Description: Instead of listing all free blocks, the file system keeps track of the
first free block and the number of contiguous free blocks following it.
o Advantages: Efficient for managing large contiguous free spaces.
o Disadvantages: Less flexible for non-contiguous free space.

You might also like