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

Operating System Functions Explained

Basic of OS

Uploaded by

rutujadaule8
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 views58 pages

Operating System Functions Explained

Basic of OS

Uploaded by

rutujadaule8
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

Operating System Components

and Services
Chapter 1
Operating System
⚫ An Operating System (OS) is a software
layer between the user and the computer
hardware.
⚫ It manages hardware resources (CPU,
memory, storage, devices) and provides
services so applications can run smoothly.
⚫ The OS is the manager of your computer
system.
Real Life Examples for better
Understanding(Traffic
Management )
Real Life Examples for better
Understanding(Hotel Reception)
Functions of Operating System
1. Process Management
⚫ This is the OS's job of managing all the
running programs, also known as processes.
⚫ The OS allocates resources like CPU time and
memory to each process. It ensures that
multiple programs can run at the same time
without interfering with each other.
⚫ OS creates, schedules, and terminates
processes.
⚫ Handles multitasking (running many apps at
once).

Example: You are playing music 🎵 while


Example: You are playing music 🎵 while browsing
the web 🌐 and downloading a file 📥 → OS divides
CPU time among them.
2. Memory Management
⚫ OS keeps track of which program is using
which part of RAM.
⚫ Allocates and frees memory when
processes start and end.
⚫ Prevents one program from overwriting
another’s memory.

Example: When you open Chrome, it gets


some RAM; when you close it, RAM is
released.
It's like a librarian who knows exactly which book
(program) is on which shelf (memory location).
3. File System Management
⚫ OS organizes data into files and folders.
⚫ Manages reading/writing from storage
devices (HDD, SSD, Pen drive).
⚫ Ensures security and permissions.
Example: When you save a Word document, OS decides where
and how it’s stored on the disk.
4. Device Management
⚫ Controls input/output devices (keyboard,
mouse, printer, scanner, USB).
⚫ This function involves managing all the
communication between the computer and
its peripheral devices, such as the keyboard,
mouse, printer, and speakers.
⚫ The OS provides a common interface, so
application programs don't need to know the
specific technical details of each device.
⚫ Uses device drivers to communicate with
hardware.
Example: When you press a key ⌨, the OS translates it into a
signal the CPU can understand.
5. Security & Protection
⚫ Provides authentication (passwords,
fingerprints).
⚫ Prevents unauthorized access to data.
⚫ Protects processes from interfering with each
other.
⚫ The OS protects the computer from
unauthorized access.
⚫ It handles user authentication (like logging in
with a password) and controls which users
have access to certain files and programs.
⚫ For instance, an administrator account has
more privileges than a guest account, and the
OS enforces these rules. It's the security guard
Example: You can’t open another user’s files
without permission.
Types of Operating Systems
[Link] Operating System
⚫ A batch operating system processes jobs in
groups, or "batches," without direct user
interaction.
⚫ Users submit their jobs (e.g., payroll
processing, bank statement generation) on
an offline device like a punch card, and an
operator collects jobs with similar
requirements and runs them together.
⚫ This system is efficient for repetitive tasks
that don't need user input.
⚫ Example: Early IBM mainframes.
Characteristics:
⚫ No direct interaction between the user and
the computer.
⚫ Jobs are processed in the order they are
submitted (first-come, first-served).
⚫ CPU is often idle waiting for I/O
operations, which can be inefficient.
Example 1
Financial Services: Banks use batch
processing at the end of each business day to
reconcile all transactions, calculate daily
interest, and generate customer statements

Example 2
Media and Entertainment: Media
companies use batch processing for tasks
like rendering large video files, converting
media formats, and compressing content for
distribution.
[Link]-Sharing Operating
System
⚫ Also known as a multitasking OS allows
multiple users or processes to share the
same computer system simultaneously.
⚫ The OS gives each user or process a small
"time slice" of the CPU's processing time.
⚫ The switches between tasks are so fast that
it gives users the illusion that they are the
only ones using the system.
Characteristics
⚫ Each process is given a fixed time slice.
⚫ It improves CPU utilization by switching to
another task if the current one is waiting
for an I/O operation.
⚫ Reduces CPU idle time.
[Link] OS
⚫ The fundamental idea is that most
programs require two types of time: CPU
time (for calculations) and I/O time (for
input/output operations like reading from
a disk or a network). I/O operations are
significantly slower than CPU operations.
⚫ In a non-multiprogrammed system, if a
program needs to perform an I/O
operation, the CPU would sit idle and wait
for that operation to complete before
moving on. A multiprogrammed OS solves
this inefficiency.
⚫ When a running program initiates an I/O
operation, the operating system's scheduler
interrupts it and assigns the CPU to
another program that is ready to run.
⚫ This process is called context switching.
The CPU continues to work on the second
program while the first program's I/O
operation happens in the background.
⚫ Once the I/O operation for the first
program is complete, it is put back in the
queue, ready to be picked up again by the
CPU. This rapid switching between tasks
gives the illusion that multiple programs
are running simultaneously.
Advantages ✨

⚫ Higher CPU Utilization: By minimizing


idle time, the CPU is kept busy for a higher
percentage of the time.
⚫ Increased Throughput: More jobs are
completed in a given time frame because
the CPU is not waiting for slow I/O
operations.
⚫ Better Resource Management: System
resources, like memory and I/O devices,
are used more efficiently.
⚫ Improved Responsiveness: It allows
multiple programs to progress
concurrently, leading to faster response
[Link] Operating
System
⚫ It is a type of OS that manages and utilizes
two or more central processing units
(CPUs) within a single computer system.
⚫ The key difference between this and a
multiprogramming OS is that a
multiprocessor system uses multiple
physical CPUs to achieve true parallel
execution,
⚫ whereas a multiprogramming OS
simulates parallelism on a single CPU by
quickly switching between tasks
5. Distributed OS
⚫ A distributed operating system manages a
group of independent computers and
makes them appear as a single, coherent
system to the user.
⚫ These computers are interconnected
through a network and work together to
share resources and process tasks.
⚫ The primary goal is to provide a
single-system image, hiding the
complexity of the underlying network.
⚫ Examples: Google's Fuchsia OS, and
frameworks like Apache Hadoop.
Characteristics
⚫ Transparency: The user doesn't know
where the resources (files, devices) are
physically located.
⚫ Scalability: You can easily add more
computers to the network to increase
performance.
⚫ Reliability: If one computer fails, the
system can continue to operate.
6. Real Time OS(RTOS)
⚫ It is designed for applications where precise
timing and predictability are critical. It
guarantees that specific tasks will be
completed within a defined time frame.
⚫ Missing a deadline can result in a system
failure. RTOS are categorized into two types:

⚫ Hard Real-Time Systems: These are for


applications where even a tiny delay is
unacceptable. Missing a deadline is a failure.
⚫ Soft Real-Time Systems: These are for
applications where missing a deadline is
undesirable but not a complete failure.
Performance might degrade, but the system
Characteristics
⚫ Highly reliable and predictable.
⚫ Tasks are completed within strict
deadlines.
⚫ Minimal overhead.

⚫ Examples:
Hard RTOS are used in air traffic control
systems, medical imaging, and robotics.
Soft RTOS are used in multimedia systems
and virtual reality.
7. Mobile OS
⚫ A mobile operating system is a specific
type of OS designed to run on mobile
devices like smartphones, tablets, and
smartwatches.
⚫ These systems are optimized for touch
interfaces, low power consumption, and
wireless connectivity.
⚫ They also manage mobile-specific features
like GPS, cameras, and cellular network
connections.
Characteristics:

⚫ Optimized for mobile hardware and


touchscreens.
⚫ Efficient power management to prolong
battery life.
⚫ Supports a wide range of wireless
technologies.

Examples: Android (Google), iOS (Apple),


and HarmonyOS (Huawei).
Command Line Interface (CLI)-
⚫ A Command Line Interface (CLI)-based
operating system is a system where the
primary way users interact with the
computer is by typing text commands into
a console, rather than using a mouse and
graphical icons.

⚫ It's the original method for interacting with


computers and is still widely used today,
particularly in professional environments
How It Works 🖥
A CLI operates through a simple
input-process-output cycle.
The user types a command into a shell,
which acts as a text-based interpreter
between the user and the operating system.
⚫ Input: The user types a command and
presses Enter.
⚫ Process: The shell parses the command,
identifies the program or action requested,
and sends it to the OS for execution.
⚫ Output: The OS performs the action and
returns a text-based result, which the shell
displays back to the user
Examples of CLI-Based
Systems
⚫ MS-DOS: Microsoft's original Disk
Operating System was a classic example of
a purely command-line-based OS from the
1980s.
⚫ Unix-like Systems: Many Unix and Linux
distributions, especially server versions, are
often run without a graphical interface to
save resources. Popular shells include Bash
and Zsh.
⚫ Embedded Systems: Small, dedicated
computing devices often use a
command-line interface due to their
limited hardware resources.
System Call
Definition
⚫ A system call is a way for a program (user
process) to request a service from the
operating system’s kernel.

⚫ Since user-level programs cannot directly


access hardware or critical kernel
resources, they use system calls as an
interface between user space and kernel
space.

⚫ System Call = Bridge between User


Programs and Operating System.
⚫ User programs run in user mode (restricted
environment).

⚫ OS kernel runs in kernel mode (full access to


hardware and resources).

⚫ When a program needs to perform tasks like


file handling, memory management,
process creation, device communication, or
networking, it makes a system call.

⚫ Example: If you want to read a file → your


program calls the OS through a system call →
OS accesses the disk → returns data to your
program.
Types of System Calls
1. Process Control
⚫ These system calls deal with process
creation, execution, and termination.
They allow programs to create, manage,
and end processes.

⚫ Examples:
1. fork() → create a new process
2. exec() → execute a new program
3. exit() → terminate a process
4. wait() → wait for process to finish
2. File Management

⚫ These system calls handle file operations


like creating, reading, writing, and deleting
files.
⚫ Examples:
⚫ open() → open a file
⚫ read() → read from a file
⚫ write() → write to a file
⚫ close() → close a file
⚫ unlink() → delete a file
3. Device Management

⚫ These system calls deal with hardware


devices (printers, disks, etc.).
They help in requesting, releasing, and
performing I/O operations on devices.
⚫ Examples:
⚫ ioctl() → control device
⚫ read() / write() → from/to device
⚫ release() → release device
4. Information Maintenance

⚫ These system calls provide information


about the system, processes, and time.
⚫ Examples:
⚫ getpid() → get process ID
⚫ alarm() → set alarm clock
⚫ time() → get system time/date
⚫ getuid() → get user ID
5. Communication

⚫ These system calls enable data exchange


between processes (Inter-Process
Communication, IPC) or across systems in
a network.
⚫ Examples:
⚫ pipe() → create communication channel
between processes
⚫ shmget() → create shared memory
⚫ send(), recv() → send/receive messages
⚫ socket() → create communication endpoint

You might also like