0% found this document useful (0 votes)
3 views21 pages

Operating System

An Operating System (OS) is system software that serves as an interface between computer hardware and users, managing resources and providing services for application programs. It can be classified into types such as batch, time-sharing, multitasking, and multiprocessing, each with distinct characteristics and functionalities. Key components include the kernel, process management, memory management, and user interfaces, while process management involves creating, scheduling, and terminating processes, utilizing methods like inter-process communication and various CPU scheduling algorithms.

Uploaded by

bmdaqeeb443
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)
3 views21 pages

Operating System

An Operating System (OS) is system software that serves as an interface between computer hardware and users, managing resources and providing services for application programs. It can be classified into types such as batch, time-sharing, multitasking, and multiprocessing, each with distinct characteristics and functionalities. Key components include the kernel, process management, memory management, and user interfaces, while process management involves creating, scheduling, and terminating processes, utilizing methods like inter-process communication and various CPU scheduling algorithms.

Uploaded by

bmdaqeeb443
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

 Example: UNIX

Definition of
Operating System 3. Multiprogramming
Operating System
An Operating System (OS) is system
software that acts as an interface between  Several programs are kept in
the computer hardware and the user. It memory at the same time.
manages computer resources and provides  CPU switches between programs to
services for application programs. maximize utilization.
 Improves system efficiency.
Definition:

An Operating System is a collection of


4. Multitasking Operating
programs that controls and coordinates the System
use of hardware resources and provides a
convenient environment for users to execute  Allows a user to run multiple
programs applications simultaneously.
 Example: Microsoft Windows,
macOS

5. Multiprocessing
Types of Operating Operating System
Systems  Uses two or more processors/CPUs.
 Increases processing speed and
An Operating System can be classified into reliability.
several types based on how it manages  Common in modern computer
resources and users. systems.

1. Batch Operating System Structure of


 Jobs are collected and processed in
batches without user interaction.
Operating System
 Suitable for large, repetitive tasks.
The Operating System Structure refers to
 Example: Early IBM systems.
the way an operating system is organized
and how its components interact with
2. Time-Sharing Operating hardware and users.
System
Basic Structure of an
 Multiple users can access the system Operating System
simultaneously.
 CPU time is divided among users. +---------------------+
 Provides quick response times. | Users |
+---------------------+  Controls file access and storage.
| Application Programs|
+---------------------+
| Operating System |
5. Device Management
+---------------------+
| Hardware |  Controls input/output devices
+---------------------+ through device drivers.

 Users interact with application 6. User Interface


programs.
 Application Programs request
 Provides interaction between users
services from the operating system.
and the system.
 Operating System manages
 Examples: Command Line Interface
hardware resources and provides
(CLI) and Graphical User Interface
services.
(GUI).
 Hardware includes CPU, memory,
storage devices, and I/O devices.

Types of Operating
Components of System Structures
Operating System
1. Simple Structure
Structure
 No clear separation between
1. Kernel components.
 Easy to design but difficult to
 Core part of the operating system. maintain.
 Manages CPU, memory, and devices.  Example: Early operating systems like
 Acts as an interface between MS-DOS.
hardware and software.
2. Layered Structure
2. Process Management
 OS is divided into layers.
 Creates, schedules, and terminates  Each layer performs a specific
processes. function.
 Handles multitasking.  Easier to debug and maintain.

3. Memory Management Layer N - User Interface


Layer N-1 - File System
Layer N-2 - Memory Management
 Allocates and deallocates memory. Layer 0 - Hardware
 Keeps track of memory usage.

4. File System Management 3. Microkernel Structure


 Organizes files and directories.
 Only essential services run in the  Create and delete processes.
kernel.  Schedule processes for CPU execution.
 Other services run in user space.  Allocate resources to processes.
 More secure and reliable.  Synchronize processes.
 Example: MINIX.  Handle communication between
processes.
 Manage deadlocks.
4. Modular Structure
 OS is divided into separate modules.
 Modules can be loaded or removed as
needed. Process States
 Example: Linux.
A process passes through different states
5. Hybrid Structure during its execution:

New → Ready → Running → Waiting →


 Combines features of monolithic and Ready → Running → Terminated
microkernel designs.
 Provides better performance and 1. New
flexibility.
 Examples:
 Process is being created.
o Microsoft Windows
o macOS
2. Ready

Process  Process is loaded into memory and


waiting for CPU allocation.
Management Basics 3. Running
in Operating System
 Process is currently executing on the
CPU.
Definition
4. Waiting (Blocked)
Process Management is one of the main
functions of an Operating System. It deals  Process is waiting for an event or I/O
with the creation, scheduling, execution, and operation to complete.
termination of processes.
5. Terminated
A process is a program that is currently
being executed.  Process has finished execution.

Thread
Objectives of Process A thread is the smallest unit of CPU
Management execution within a process. It is often called
a lightweight process.
Multiple threads can exist within a single Process Thread
process and share the same memory and more complex easier
resources.
More resource Less resource
Characteristics of a Thread consumption consumption
Failure of one process Failure of one thread
 Shares memory and resources with usually does not may affect the entire
other threads of the same process. affect others process
 Has its own program counter,
registers, and stack.
 Executes tasks concurrently. Process Control
Example Block (PCB) in
In a web browser: Operating System
 One thread handles user input.
 Another thread loads web pages.
Definition
 Another thread plays media.
A Process Control Block (PCB) is a data
structure maintained by the Operating
Types of Threads System that stores all information about a
process. It helps the OS manage and control
1. User-Level Threads processes during execution.

 Managed by user-level libraries. PCB is also known as a Process


 Faster to create and manage. Descriptor.
 Operating system is not aware of
them.

2. Kernel-Level Threads
Purpose of PCB
 Managed directly by the operating
system.  Keeps track of each process.
 OS schedules and controls them.  Stores process-related information.
 More reliable but slightly slower.  Helps in process scheduling and
context switching.
  Allows the operating system to
manage multiple processes efficiently.
Process Thread
Independent Smallest execution
execution unit unit
Has its own memory Shares memory with PCB Structure
space other threads
+-------------------------+
Creation is slower Creation is faster | Process ID (PID) |
Communication is Communication is +-------------------------+
| Process State |
+-------------------------+ 1. Shared Memory
| Program Counter |
+-------------------------+
| CPU Registers |  A memory region is shared among
+-------------------------+ multiple processes.
| Scheduling Information |  Processes can read and write data
+-------------------------+ directly in the shared area.
| Memory Information |  Fast communication because data
+-------------------------+
does not need to be copied
| Accounting Information |
+-------------------------+ repeatedly.
| I/O Status Information |
+-------------------------+ Advantages:

 High speed.
Inter-Process  Efficient for large amounts of data.

Communication Disadvantage:

(IPC) in Operating  Requires synchronization


mechanisms (e.g., semaphores).
System
Definition 2. Message Passing

Inter-Process Communication (IPC) is a  Processes communicate by sending


mechanism that allows processes to and receiving messages.
communicate and exchange data with each  The operating system manages
other. IPC enables processes to coordinate message transfer.
their activities and share information.
Operations:

 Send(Message)
 Receive(Message)
Need for IPC
Advantages:
 Data sharing between processes.
 Information exchange.  Easy to implement.
 Process synchronization.  Suitable for distributed systems.
 Resource sharing.
 Coordination among multiple
Disadvantage:
processes.
 Slower than shared memory.

IPC Methods CPU Scheduling in


Operating System
2. Process State
Definition
 Current state of the process:
CPU Scheduling is the process by which
o New
the Operating System selects one process
o Ready
from the ready queue and allocates the CPU o Running
to it for execution. o Waiting (Blocked)
o Terminated
The main goal of CPU scheduling is to
maximize CPU utilization and improve 3. Program Counter
system performance.
 Contains the address of the next
instruction to be executed.

Objectives of CPU 4. CPU Registers

Scheduling  Stores register values when a process


is interrupted.
 Maximize CPU utilization.
 Increase system throughput. 5. CPU Scheduling Information
 Reduce waiting time.
 Reduce turnaround time.  Process priority.
 Reduce response time.  Scheduling queue pointers.
 Ensure fair allocation of CPU  Other scheduling parameters.
resources.

Types of CPU Scheduling


1. Non-Preemptive Scheduling

 Once a process gets the CPU, it keeps Scheduling Criteria


it until completion or it enters the
waiting state. Scheduling criteria are the parameters used
 Simple but may cause long waiting to evaluate the performance of CPU
times. scheduling algorithms.

2. Preemptive Scheduling Types of Scheduling Criteria

 The operating system can interrupt a Throughput


running process and allocate the CPU
to another process. Throughput is the number of processes
 Provides better responsiveness. completed in a given period of time. Higher
throughput indicates better system
1. Process ID (PID)
performance.

 Unique identifier assigned to each Turnaround Time


process.
Turnaround Time is the total time taken by a ❖ Its implementation is based on FIFO
process from arrival to completion. queue.

Formula: ❖ Poor in performance as average wait


time is high.
Turnaround Time = Completion Time –
Arrival Time ❖ First Come First Serve Scheduling
Waiting Time Algorithm Wait time of each process is as
follows –
Waiting Time is the time a process spends
waiting in the ready queue. Example
Formula:
Consider the following processes:
Waiting Time = Turnaround Time – Burst
Time Arrival Time Burst Time
Process
(AT) (BT)
Operating System
P1 0 5
Scheduling algorithms
P2 1 3
A Process Scheduler schedules different
processes to be assigned to the CPU based on P3 2 2
particular scheduling algorithms.

There are six popular process scheduling Gantt Chart:


algorithms which we are going to discuss in | P1 | P2 | P3 |
0 5 8 10
this chapter –

1. First-Come, First-Served (FCFS)


Scheduling Calculation
2. 2. Shortest-Job-Next (SJN) Scheduling
3. [Link] Scheduling Completion Time (CT)
4. 4. Round Robin(RR) Scheduling
 P1 = 5
1)First Come First Serve 

P2 = 8
P3 = 10
(FCFS)
Waiting Time (WT)
❖ Jobs are executed on first come, first
serve basis. Formula:

❖ It is a non-preemptive, pre-emptive WT = Turnaround Time - Burst Time


scheduling algorithm.
Process TAT BT WT
❖ Easy to understand and implement
Process TAT BT WT Arrival Time Burst Time
Process
(AT) (BT)
P1 5 5 0
P4 3 5
P2 7 3 4

P3 8 2 6 Step 1: Select Process

 At time 0, only P1 is available, so P1


Average Waiting Time executes first.
(0+4+6)/3=3.33(0+4+6)/3 =  After P1 completes, choose the
3.33(0+4+6)/3=3.33 shortest burst time among remaining
processes.
 Order: P1 → P3 → P2 → P4
Average Waiting Time = 3.33 ms

SJN (Shortest Job Next)


Gantt Chart
Definition
| P1 | P3 | P2 | P4 |
SJN (Shortest Job Next), also known as 0 6 8 11 16
Shortest Job First (SJF), is a CPU
scheduling algorithm in which the process
with the smallest burst time is selected first Completion Time (CT)
for execution.
Process CT
It is a non-preemptive scheduling algorithm
(in its basic form).
P1 6

P3 8

Example P2 11

Consider the following processes: P4 16

Arrival Time Burst Time


Process
(AT) (BT) Waiting Time (WT)
P1 0 6 Formula:

P2 1 3 WT = TAT - BT

P3 2 2 Process TAT BT WT
Process TAT BT WT Process Burst Time (BT) Priority

P1 6 6 0 P1 5 3

P2 10 3 7 P2 3 1

P3 6 2 4 P3 4 2

P4 13 5 8 P4 2 4

Average Waiting Time Assume lower number = higher priority.


(0+7+4+8)/4=4.75(0+7+4+8)/4 =
4.75(0+7+4+8)/4=4.75 Execution Order:

Average Waiting Time = 4.75 ms Priority order:

Priority Scheduling P2 → P3 → P1 → P4

Waiting Time (WT)


Definition Gantt Chart
Priority Scheduling is a CPU scheduling | P2 | P3 | P1 | P4 |
algorithm in which the CPU is allocated to 0 3 7 12 14
the process with the highest priority first.

Each process is assigned a priority value.


The process with the highest priority gets
Completion Time (CT)
executed before other processes.
Process CT
 It can be preemptive or non-
preemptive. P2 3
 In some systems, a smaller priority
number means higher priority. P3 7

P1 12

P4 14
Example
Consider the following processes:

Process Burst Time (BT) Priority


Formula:
WT = Turnaround Time - Burst Time Process Burst Time (BT)

Process TAT BT WT P3 2
P2 3 3 0
P3 7 4 3
Time Quantum = 2 ms
P1 12 5 7
P4 14 2 12

Average Waiting Time:


Execution Order
(0+3+7+12)/4=5.5(0+3+7+12)/4 =
Step-by-step:
5.5(0+3+7+12)/4=5.5

Average Waiting Time = 5.5 ms  P1 runs for 2 ms → remaining time =


3
 P2 runs for 2 ms → remaining time =
Round Robin (RR) 2
 P3 runs for 2 ms → completes
 P1 runs for 2 ms → remaining time =
Definition 1
 P2 runs for 2 ms → completes
Round Robin (RR) is a CPU scheduling  P1 runs for 1 ms → completes
algorithm in which each process gets a fixed
amount of CPU time called a time quantum
or time slice.

After the time quantum expires, the process


Gantt Chart
is moved to the end of the ready queue, and
| P1 | P2 | P3 | P1 | P2 | P1 |
the next process gets the CPU. 0 2 4 6 8 10 11

It is a preemptive scheduling algorithm.

Completion Time (CT)


Process CT
Example
P1 11
Consider the following processes:
P2 10
Process Burst Time (BT)
P3 6
P1 5

P2 4
Waiting Time (WT)
Formula: do {
Entry Section
Critical Section
WT = TAT - Burst Time Exit Section
Remainder Section
Process TAT BT WT } while (true);

P1 11 5 6 1. Entry Section
P2 10 4 6
P3 6 2 4  Requests permission to enter the
critical section.
Average Waiting Time:
2. Critical Section
(6+6+4)/3=5.33(6+6+4)/3 =
5.33(6+6+4)/3=5.33  Executes code that accesses shared
resources.
Average Waiting Time = 5.33 ms
3. Exit Section

Critical Section  Releases the resource after execution.

Problem in 4. Remainder Section

Operating System  Executes the remaining code.

Definition Synchronization in
The Critical Section Problem is a problem Operating System
in Operating Systems that occurs when
multiple processes or threads access and
modify shared resources at the same time. Definition
A critical section is a part of a program Process Synchronization is a technique
where a process accesses shared data or used by the Operating System to control the
resources. execution of multiple processes or threads
that access shared resources at the same
Example: Multiple processes updating the time.
same bank account balance or shared file.
It ensures that data remains consistent and
prevents problems caused by concurrent
execution.

Structure of a Process
Types of Synchronization
A process using a critical section generally
has four parts: 1. Process Synchronization
Bounded Buffer problem is also
called producer consumer
problem. This problem is One set of data is shared among a
generalized in terms of the number of processes.
Producer-Consumer problem.
Solution to this problem is, Once a writer is ready, it performs its
creating two counting semaphores
write. Only one writer may write at a
“full” and “empty” to keep track of
the current number of full and time.
empty buffers respectively.
Producers produce a product and
consumers consume the product,
Handling Deadlocks
but both use of one of the containers
each time Definition of Deadlock
[Link] philosopher problem: A deadlock is a situation in an Operating
System where two or more processes are
The Dining Philosopher Problem states unable to continue execution because each
that K philosophers seated around a process is waiting for a resource held by
circular table with one chopstick between another process.
each pair of philosophers. There is one
chopstick between each philosopher. A Example:
philosopher may eat if he can pickup the
 Process P1 holds Resource R1 and
two chopsticks adjacent to him. One
waits for R2.
chopstick may be picked up by any one of  Process P2 holds Resource R2 and
its adjacent followers but not both. This waits for R1.
problem involves the allocation of limited  Both processes wait forever
resources to a group of processes in a
deadlock-free and starvation-free Methods for Handling
manner. Deadlocks
2. Readers and Writers Problem:
1. Deadlock Prevention
Suppose that a database is to be shared
among several concurrent processes.  Ensures that at least one deadlock
condition never occurs.
Some of these processes may want only
 Techniques:
to read the database, whereas others o Allow resource sharing.
may want to update (that is, to read o Request all resources at once.
and write) the database. We o Allow resource preemption.
distinguish between these two types of
Disadvantage: May reduce resource
processes by referring to the former as
utilization.
readers and to the latter as writers.
Precisely in OS we call this situation as
the readerswriters problem. Problem
parameters: 2. Deadlock Avoidance
 The OS checks whether resource Contiguous Non-Contiguous
allocation keeps the system in a safe Allocation Allocation
state.
 A common method is: block multiple blocks
Simple Complex
Banker’s Algorithm implementation implementation
Causes external Reduces
 Used to avoid deadlocks by checking fragmentation fragmentation
safe resource allocation. Less memory Better memory
utilization utilization
Example: Fixed Example: Paging,
partitioning Segmentation
3. Deadlock Detection and
Recovery Page Replacement
The OS allows deadlocks to occur, then
Algorithms
detects and removes them.
Definition
Detection:
Page Replacement Algorithm is a
 Uses resource allocation graphs. technique used by the Operating System to
 Checks for circular waiting. decide which page should be removed from
main memory when a new page needs to be
Recovery Methods: loaded and the memory is full.

 Terminate one or more processes. It is used in virtual memory management.


 Take resources from processes.
 Restart processes.

Types of Page Replacement


4. Deadlock Ignorance Algorithms
(Ostrich Algorithm)
 The OS ignores deadlocks if they 1. FIFO (First In First Out)
occur rarely.
 Used in some general-purpose
systems. Explanation
  The oldest page in memory is
replaced first.
Contiguous Non-Contiguous  It works like a queue.
Allocation Allocation
Process stored in one Process stored in Example
Reference string: Frames = 3

1 2 3 4 Memory:

Frames = 3 [1 2 3]

Steps: When page 4 comes:

1 → [1]  Replace the page that is needed


farthest in the future.
2 → [1 2]

3 → [1 2 3] 3. LRU (Least Recently


Used)
4 → [4 2 3] (1 is removed because it came
first)
Explanation
Advantages:
 Replaces the page that has not been
 Simple and easy to implement. used for the longest time in the past.

Disadvantages: Example
 May remove frequently used pages. Reference string:
 Can cause Belady’s anomaly.
1 2 3 1 4

Frames = 3
2. Optimal Page
Before page 4 arrives:
Replacement
[1 2 3]
Explanation
Page 2 was used least recently, so:
 Replaces the page that will not be
[1 4 3]
used for the longest time in the
future.
Advantages:
 Gives the minimum possible page
faults.
 Performs better than FIFO.
 Uses past behavior for prediction.
Example
Disadvantages:
Reference string:
 Requires tracking page usage.
1 2 3 4 1
Advantages:
 Best performance. Memory Management in
Disadvantages: Linux
 Future requests are unknown, so it is Definition
difficult to implement.
Memory Management in Linux is the
function of the Linux Operating System that
manages the allocation, usage, and release of
4. LFU (Least Frequently main memory (RAM) for processes and
system operations.
Used)
Linux uses efficient memory management
Explanation techniques to provide better performance
and support multitasking.
 Replaces the page that has not been
used for the longest time in the past.

Example Features of Linux Memory


Reference string:
Management
1 2 3 1 4 1. Virtual Memory

Frames = 3  Linux uses virtual memory to give


processes the illusion of having large
Before page 4 arrives: memory.
 It uses both RAM and disk space
[1 2 3] (swap area).

Page 2 was used least recently, so: 2. Paging

[1 4 3]  Memory is divided into fixed-size


blocks called pages.
 Physical memory is divided into
frames.
Advantages:  Pages are loaded into frames when
required.
 Keeps frequently used pages.
3. Demand Paging
Disadvantages:
 Pages are loaded into memory only
when they are needed.
 Needs counters to track usage.
 Reduces memory usage.
4. Swapping 4. Location

 Moves inactive processes/pages from  Specifies where the file is stored on


RAM to disk (swap space). the storage device.
 Frees RAM for active processes.  Contains information about file path
and memory location.
5. Memory Allocation
5. Size
Linux provides memory allocation
mechanisms:  Indicates the amount of storage space
occupied by the file.
 malloc() – allocates user memory.  Usually measured in KB, MB, or GB.
 free() – releases memory.
 kmalloc() – allocates kernel memory. 6. Protection

File Attributes  Defines access permissions for the


file.
 Controls who can read, write, or
Definition execute the file.

File attributes are the properties or 7. Time and Date Information


information associated with a file that the
Operating System uses to manage and Stores:
control files.
 Creation time
 Last modification time
Common File Attributes  Last access time

1. Name 8. Owner/User Identification

 The name used to identify a file.  Stores information about the user
 Example: [Link] who owns the file.

2. Identifier

 A unique number or ID assigned to a


file by the OS.
File Operations in
 Helps in file identification. Operating System
3. Type
Definition
 Indicates the type of file.
 Example: File operations are the actions performed
o Text file (.txt) by the Operating System to create, access,
o Image file (.jpg) modify, and manage files stored on
o Executable file (.exe) secondary storage devices.
9. Copy

Creates a duplicate of a file.


Common File Operations 

10. Move
1. Create

 Creates a new file. File Access Methods


 Allocates space and stores file
information.
Definition
2. Open
File access methods define the way data is
 Opens a file for reading or writing.
read from or written to a file. The Operating
 The OS checks permissions before System provides different methods to access
allowing access. file contents efficiently.

3. Read

 Retrieves data from a file. Types of File Access


 Transfers data from storage to
memory.
1. Sequential Access
4. Write
 Data is accessed in a sequential order,
 Stores data into a file. from beginning to end.
 Updates the file contents.  Records are processed one after
another.
5. Append  Commonly used for text files and log
files.
 Adds new data at the end of an Operations:
existing file.

6. Close  Read next


 Write next
 Rewind
 Closes an opened file.
 Releases system resources.
Advantages:
7. Delete
 Simple and easy to implement.
 Suitable for large files.
 Removes a file from storage.
 Frees the allocated space. Disadvantages:
8. Rename  Slow when accessing data in the
middle of a file.
 Changes the name of a file.
2. Direct (Random) Access A directory structure is a way of
organizing and managing files and folders
on a storage device. It helps the Operating
 Allows data to be accessed directly at
any location in the file.
System locate, store, and access files
 Uses a file pointer to jump to required efficiently.
positions.

Operations:
Types of Directory
 Read at position
 Write at position Structures
 Seek
1. Single-Level Directory
Advantages:
 All files are stored in one single
 Faster access to specific data. directory.
 Suitable for databases.  Simple but causes naming conflicts.

Disadvantages: Example:

 More complex than sequential access. Directory


├── [Link]
├── [Link]
└── [Link]

3. Indexed Access 2. Two-Level Directory


 Uses an index table that stores
pointers to file blocks.  Each user has a separate directory.
 The index helps locate data quickly.  Avoids file name conflicts between
users.
Advantages:
Master Directory
├── User A
 Fast searching and accessing. │ ├── file1
 Supports large files. └── User B
├── file2
Disadvantages:
3. Tree-Structured Directory
 Requires extra storage for index
blocks.
 Directory is organized like a tree.
 Supports subdirectories.
Directory Structure
Root
Definition |
├── Documents
| └── [Link]
|
└── Images 2. SSTF (Shortest Seek Time First)
└── [Link]

 Selects the request closest to the


4. Acyclic Graph Directory current disk head position.
 Reduces seek time.
 Allows sharing of files and directories. 3. SCAN (Elevator Algorithm)
 Does not contain cycles.
 Disk head moves in one direction
servicing requests, then reverses
5. General Graph Directory direction.

4. C-SCAN (Circular SCAN)


 Allows links between directories.
 Can contain cycles.
 Requires special handling by OS.  Disk head moves in one direction
only.
 After reaching the end, it returns to
the beginning.

Disk Scheduling in 5. LOOK

Operating System  Similar to SCAN but the head reverses


before reaching the physical end if no
requests exist.
Definition
Disk Scheduling is the method used by the
Security and Protection
Operating System to decide the order in
which disk I/O requests are processed. Definition
The goal is to reduce disk access time and Security and Protection in Operating
improve performance. System refers to the mechanisms used by
the OS to protect data, programs, hardware
resources, and users from unauthorized
access, misuse, or attacks.
Disk Scheduling
Algorithms
1. FCFS (First Come First Serve) Protection in
 Requests are handled in the order Operating System
they arrive.
 Simple but slow.
Definition
Protection is the method of controlling Common permissions:
access to system resources such as files,
memory, and devices by authorized users  Read
and processes.  Write
 Execute
Goals of Protection
4. File Protection
 Prevent unauthorized access.
 Ensure correct use of resources.  Protects files using access
 Maintain data integrity. permissions.
 Isolate processes from each other.
5. Encryption

 Converts data into a secure format.


Security in Operating System  Prevents unauthorized users from
reading information.

Definition Threads and Attacks


OS Security is the process of defending the
system against threats such as viruses, 1. Threads in Operating
malware, unauthorized users, and data theft. System
Definition

Security and Protection A thread is the smallest unit of CPU


Mechanisms execution within a process. A process can
contain multiple threads that share the same
1. Authentication memory and resources.

Threads are also called lightweight


 Verifies the identity of users.
 Examples: processes.
o Username and password
o Biometrics Types of Threads
o Multi-factor authentication
1. User-Level Threads
2. Authorization
 Managed by user-level libraries.
 Determines what actions a user is  Faster to create and manage.
allowed to perform.  Kernel is not directly aware of them.
 Controls access to files and resources.
2. Kernel-Level Threads
3. Access Control
 Managed by the Operating System.
 Defines permissions for users and  Kernel schedules and controls
processes. execution.
2. Attacks Feature Linux Windows
Personal
Servers, C
Common Use computers,
programming A
Definition gaming, office
Mo
An OS attack is an attempt to gain
Cloud OS Mobile OS
unauthorized access, damage, or misuse
computer resources by exploiting system Runs mainly on cloud
Runs on mobile devices
vulnerabilities. servers
Requires internet Can work offline for
access many tasks
Runs on m
Focuses on cloud Focuses on mobile apps
Common Types of OS Attacks services and storage and hardware
Used on cloud-based Used on smartphones
1. Virus Attack devices and tablets
Example: ChromeOS Example: Android, iOS
 A malicious program that attaches to
files and spreads when executed. Can work o
tasks
2. Worm Attack Focuses on
and hardwa
 A self-replicating program that Used on sm
spreads through networks without tablets
user action.
Example: A
3. Trojan Horse

 A harmful program disguised as


legitimate software.

Feature Linux Windows macOS


Open-source
Developer Microsoft Apple
community
Included with
Cost Mostly free Paid
Mac devices
Source Code Open Closed Closed
Simple and
User Interface Customizable Easy to use
polished
Security High Moderate High
Limited to good
Gaming Excellent Limited
depending on setup
Customization Very high Medium Low
Hardware Apple devices
Wide Very wide
Support only

You might also like