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

Unit-1(OS)

The document provides an overview of operating systems, including their functions, classifications, and structures. It discusses key functions such as memory management, processor management, device management, file management, and user interface, as well as various types of operating systems like batch, interactive, and real-time systems. Additionally, it outlines the layered structure of operating systems and their components, emphasizing the importance of efficient resource management and user interaction.

Uploaded by

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

Unit-1(OS)

The document provides an overview of operating systems, including their functions, classifications, and structures. It discusses key functions such as memory management, processor management, device management, file management, and user interface, as well as various types of operating systems like batch, interactive, and real-time systems. Additionally, it outlines the layered structure of operating systems and their components, emphasizing the importance of efficient resource management and user interaction.

Uploaded by

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

UNIT-1

Introduction : Operating system and functions, Classification of Operating systems- Batch,


Interactive, Time sharing, Real Time System, Multiprocessor Systems, Multiuser Systems,
Multiprocess Systems, Multithreaded Systems, Operating System Structure- Layered
structure, System Components, Operating System services, Reentrant Kernels, Monolithic
and Microkernel Systems.

Operating System:
An Operating System acts as a communication bridge (interface) between the user and
computer hardware. The purpose of an operating system is to provide a platform on which a
user can execute programs conveniently and efficiently.

An operating system is a piece of software that manages the allocation of Computer


Hardware.

The main goal of the Operating System is to make the computer environment more
convenient to use and the Secondary goal is to use the resources most efficiently.

Functions of Operating System:

Memory Management The operating system manages the Primary Memory or Main
Memory. Main memory is made up of a large array of bytes or words where each byte or
word is assigned a certain address. Main memory is fast storage and it can be accessed
directly by the CPU. For a program to be executed, it should be first loaded in the main
memory. An operating system manages the allocation and deallocation of memory to
various processes and ensures that the other process does not consume the memory
allocated to one process. An Operating System performs the following activities for Memory
Management:

● It keeps track of primary memory, i.e., which bytes of memory are used by

which user program. The memory addresses that have already been

allocated and the memory addresses of the memory that has not yet been

used.

● In multiprogramming, the OS decides the order in which processes are granted

memory access, and for how long.

● It Allocates the memory to a process when the process requests it and

deallocates the memory when the process has terminated or is performing an

I/O operation.
Processor Management In a multiprogramming environment, the OS decides the order in
which processes have access to the processor, and how much processing time each
process has. This function of the OS is called Process Scheduling. An Operating System
performs the following activities for Processor Management.
● An operating system manages the processor’s work by allocating various jobs to it
and ensuring that each process receives enough time from the processor to function
properly.
● Keeps track of the status of processes. The program which performs this task is
known as a traffic controller. Allocates the CPU that is a processor to a process. De-
allocates the processor when a process is no longer required.

Device Management An OS manages device communication via its respective drivers. It


performs the following activities for device management.

● Keeps track of all devices connected to the system. Designates a program

responsible for every device known as the Input/Output controller.

● Decide which process gets access to a certain device and for how long.

● Allocates devices effectively and efficiently. Deallocates devices when they

are no longer required.

● There are various input and output devices. An OS controls the working of

these input-output devices.

● It receives the requests from these devices, performs a specific task, and

communicates back to the requesting process.

File Management A file system is organized into directories for efficient or easy navigation
and usage. These directories may contain other directories and other files. An
The Operating System carries out the following file management activities. It keeps track of
where information is stored, user access settings, the status of every file, and more. These
facilities are collectively known as the file system. An OS keeps track of information
regarding the creation, deletion, transfer, copy, and storage of files in an organized way. It
also maintains the integrity of the data stored in these files, including the file directory
structure, by protecting against unauthorized access.

User Interface or Command Interpreter The user interacts with the computer system
through the operating system. Hence OS acts as an interface between the user and the
computer hardware. This user interface is offered through a set of commands or a graphical
user interface (GUI). Through this interface, the user interacts with the applications and the
machine hardware.
Booting the Computer The process of starting or restarting the computer is known as
booting. If the computer is switched off completely and if turned on then it is called cold
booting. Warm booting is a process of using the operating system to restart the computer.

Security The operating system uses password protection to protect user data and similar
other techniques. it also prevents unauthorized access to programs and user data. The
operating system provides various techniques which
assure the integrity and confidentiality of user data. The following security measures are
used to protect user data:

● Protection against unauthorized access through login.

● Protection against intrusion by keeping the firewall active. ●

Protecting the system memory against malicious access. ● Displaying

messages related to system vulnerabilities.

Control Over System Performance Operating systems play a pivotal role in controlling and
optimizing system performance. They act as intermediaries between hardware and software,
ensuring that computing resources are efficiently utilized. One fundamental aspect is
resource allocation, where the OS allocates CPU time, memory, and I/O devices to different
processes, striving to provide fair and optimal resource utilization. Process scheduling, a
critical function, helps decide which processes or threads should run when preventing any
single task from monopolizing the CPU and enabling effective multitasking.

Job Accounting The operating system Keeps track of time and resources used by various
tasks and users, this information can be used to track resource usage for a particular user or
group of users. In a multitasking OS where multiple programs run simultaneously, the OS
determines which applications should run in which order and how time should be allocated
to each application.

Error-Detecting Aids The operating system constantly monitors the system to detect errors
and avoid malfunctioning computer systems. From time to time, the operating system
checks the system for any external threat or malicious software activity. It also checks the
hardware for any type of damage. This process displays several alerts to the user so that
the appropriate action can be taken against any damage caused to the system.

Coordination Between Other Software and Users Operating systems also coordinate and
assign interpreters, compilers, assemblers, and other software to the various users of the
computer systems. In simpler terms, think of the operating system as the traffic cop of your
computer. It directs and manages how different software programs can share your
computer’s resources without causing chaos. It ensures that when you want to use a
program, it runs smoothly without crashing or causing problems for others. So, it’s like the
friendly officer ensuring a smooth flow of traffic on a busy road, making sure everyone gets
where they need to go without any accidents or jams.

Performs Basic Computer Tasks The management of various peripheral devices such as
the mouse, keyboard, and printer is carried out by the operating system. Today most
operating systems are plug-and-play. These operating systems automatically recognize and
configure the devices with no user interference.
Classification of Operating Systems:
Operating systems can be classified based on how they manage tasks, users, and
resources. Here are the main types:

1. Batch Operating System

Definition

A Batch Operating System groups similar jobs together and executes them without any user
interaction. Users submit jobs using punch cards or other input media, and the OS
processes them one by one.

Features

● No direct interaction between user and computer during execution.

● Jobs are collected, grouped, and processed in batches.

● Uses job control language (JCL) to specify job instructions.

Advantages

● Efficient for large jobs that need little to no user interaction.

● Reduces idle time of the CPU.

Disadvantages

● No real-time interaction or feedback.

● Difficult to debug or update job instructions.

Examples

● IBM mainframe systems.

● Early computers like IBM 1401.

Use Cases

● Payroll processing, bank statement generation, monthly billing systems.

2. Interactive Operating System

Definition

Interactive OS allows users to directly communicate with the computer through a user
interface, usually in real-time.
Features

● Real-time user interaction with applications.

● Provides Graphical User Interface (GUI) or Command Line Interface (CLI).

● Immediate response to input.

Advantages

● User-friendly.

● Easier to operate and troubleshoot.

Disadvantages

● More resource-intensive.

● Not suitable for jobs requiring batch execution.

Examples

● Microsoft Windows, macOS, Linux (with GUI).

Use Cases

● Personal computing, gaming, browsing, office productivity.

3. Time-Sharing Operating System

Definition

Allows multiple users to share the system resources simultaneously by allocating fixed time
slots to each task.

Features

● Supports multitasking and multi-user environments.

● Uses CPU scheduling and time slicing.

● Increases system responsiveness.

Advantages

● Reduces idle time of CPU.

● Provides faster response to users.


Disadvantages

● Complex scheduling and resource management.

● Slower performance if overloaded.

Examples

● UNIX, Multics.

Use Cases

● Academic institutions, software development environments.

4. Real-Time Operating System (RTOS)

Definition

Designed to process data and deliver results within a guaranteed time frame, often critical
for applications where timing is crucial.

Types

● Hard Real-Time: Strict timing (e.g., pacemakers).

● Soft Real-Time: More flexible but still time-sensitive (e.g., video streaming).

Features

● Predictable and deterministic response time.

● Minimal latency and high reliability.

Advantages

● Accurate timing and quick response.

● High reliability for critical systems.

Disadvantages

● Difficult to design and develop.

● Limited multitasking.

Examples

● VxWorks, QNX, RTLinux.


Use Cases

● Medical devices, automotive systems, industrial robots.

5. Multiprocessor Operating System

Definition

Supports multiple CPUs (processors) working together, sharing the same memory and I/O
devices.

Features

● Symmetric or asymmetric multiprocessing.

● High processing power.

● Parallel task execution.

Advantages

● Improved performance and reliability.

● Efficient multitasking and computation.

Disadvantages

● Expensive hardware.

● Complex OS design.

Examples

● Linux (SMP support), Windows Server, UNIX.

Use Cases

● Data centers, scientific computing, real-time simulations.

6. Multiuser Operating System

Definition

Allows multiple users to access and use the computer resources at the same time.

Features
● User isolation and data security.

● Individual sessions for users.

● Efficient resource sharing.

Advantages

● Shared computing resources.

● Cost-effective for organizations.

Disadvantages

● High system load.

● Risk of data breaches if not secured.

Examples

● UNIX, Linux, Windows Server.

Use Cases

● Enterprise systems, cloud services, mainframes.

7. Multiprogramming Operating System

Definition

Allows more than one program to reside in memory and be executed simultaneously by
managing CPU time efficiently.

Features

● CPU switches between programs.

● Increases system utilization.

● Relies on proper job scheduling.

Advantages

● Better CPU utilization.

● Reduces idle time.

Disadvantages
● Complex memory and process management.

● Risk of conflicts and errors if not managed well.

Examples

● UNIX, early Windows versions.

Use Cases

● General-purpose computers, mainframes.

8. Multithreaded Operating System

Definition

Supports multiple threads (smallest sequence of programmed instructions) within a single


process for efficient execution.

Features

● Threads share memory and resources of the process.

● Faster context switching.

● Supports concurrency within applications.

Advantages

● Efficient use of CPU.

● Faster execution of multitask applications.

Disadvantages

● Complex to develop and debug.

● Risk of data inconsistency (needs synchronization).

Examples

● Windows, Linux, macOS.

Use Cases

● Web servers, browsers, gaming, multimedia applications.

Operating System Structure- Layered structure:


The operating system is split into various layers In the layered operating system and each of
the layers have different functionalities. This type of operating system was created as an
improvement over the early monolithic systems.

Layers in Layered Operating System

There are six layers in the layered operating system. A diagram demonstrating these layers
is as follows:

Details about the six layers are:

Hardware

This layer interacts with the system hardware and coordinates with all the peripheral devices
used such as printer, mouse, keyboard, scanner etc. The hardware layer is the lowest layer
in the layered operating system architecture.

CPU Scheduling

This layer deals with scheduling the processes for the CPU. There are many scheduling
queues that are used to handle processes. When the processes enter the system, they are
put into the job queue. The processes that are ready to execute in the main memory are kept
in the ready queue.

Memory Management

Memory management deals with memory and the moving of processes from disk to primary
memory for execution and back again. This is handled by the third layer of the operating
system.

Process Management

This layer is responsible for managing the processes i.e assigning the processor to a
process at a time. This is known as process scheduling. The different algorithms used for
process scheduling are FCFS (first come first served), SJF (shortest job first), priority
scheduling, round-robin scheduling etc.

I/O Buffer

I/O devices are very important in computer systems. They provide users with the means of
interacting with the system. This layer handles the buffers for the I/O devices and makes
sure that they work correctly.

User Programs

This is the highest layer in the layered operating system. This layer deals with the many user
programs and applications that run in an operating system such as word processors, games,
browsers etc.

Advantages of Layered Structure

Modularity: Easy to modify or replace individual layers without affecting others.


Maintainability: Easier to maintain and debug because of separation of concerns.
Security and Protection: Each layer can be given specific access controls.
Simplicity: Clear and well-defined interfaces between layers.

Disadvantages of Layered Structure

Performance Overhead: Data and control must pass through multiple layers, possibly
reducing performance.
Complex Implementation: Requires strict planning to properly define layer responsibilities
and interfaces.

Dependency Issues: Layers must be carefully managed to prevent lower layers from
depending on higher layers.
Example of Layered OS:

The Operating System (developed by E.W. Dijkstra) — one of the first OSes to use the
layered design.
Modern OSes like UNIX and Windows have components inspired by layered design, though
they often use a combination of architectures.

System Components of an Operating System:

An Operating System (OS) is composed of several components, each responsible for a


specific function. Together, they ensure the smooth and efficient operation of a computer
system.

1. Process Management

Purpose:

Manages the creation, execution, and termination of processes.

Responsibilities:

● Creating and deleting user and system processes.

● Scheduling processes.

● Handling synchronization and communication between processes.

● Providing mechanisms for process coordination (e.g., semaphores, mutexes).

Example:

When you open multiple applications, the OS ensures each process gets a fair share of CPU
time.
2. Memory Management

Purpose:

Manages the system's primary memory (RAM).

Responsibilities:

● Allocating and deallocating memory to processes.

● Keeping track of which parts of memory are in use.

● Ensuring efficient and safe memory access.

● Handling virtual memory and swapping.

Example:

When you open a new tab in a browser, the OS allocates memory for it.

3. File System Management

Purpose:

Handles data storage, organization, access, and retrieval.

Responsibilities:

● Creating, deleting, reading, writing, and updating files.

● Managing file permissions and directory structures.

● Organizing data into files and folders on storage devices.


Example:

Saving a Word document involves the file system managing where and how the file is
stored.

4. Device Management (I/O System Management)

Purpose:

Controls and coordinates input/output devices like keyboards, mice, printers, and storage
devices.

Responsibilities:

● Installing and managing device drivers.

● Buffering and caching data.

● Handling interrupts and communication between devices.

Example:

When you print a document, the OS uses the printer driver to send the job to the printer.

5. Secondary Storage Management

Purpose:

Manages long-term data storage (e.g., hard drives, SSDs).

Responsibilities:
● Free space management.

● Disk scheduling (e.g., determining which data to access next).

● Partitioning and mounting file systems.

Example:

Storing data across multiple partitions on a hard drive is handled by this component.

6. Networking

Purpose:

Enables communication between devices and systems over a network.

Responsibilities:

● Managing network protocols and data transmission.

● Handling network security and addressing.

● Supporting remote access and sharing.

Example:

Using a browser to access a website involves the networking component managing data
transmission over the internet.

7. User Interface

Purpose:
Allows users to interact with the system.

Types:

● CLI (Command Line Interface) – text-based (e.g., Terminal in Linux).

● GUI (Graphical User Interface) – graphical interaction (e.g., Windows desktop).

Responsibilities:

● Displaying system information.

● Accepting and interpreting user commands.

Example:

Clicking icons or entering terminal commands to run applications.

8. Security and Protection System

Purpose:

Safeguards system data and resources from unauthorized access.

Responsibilities:

● User authentication (login credentials).

● Access control (who can read/write files).

● Protection against malware and unauthorized operations.


Example:

When you log into your account or restrict access to certain files.

Summary Table

Component Function

Process Management Manages running processes and CPU allocation

Memory Management Allocates and tracks system memory

File System Management Organizes and manages files and directories

Device Management Controls I/O devices

Secondary Storage Mgmt Manages hard drives and data storage

Networking Enables communication between systems

User Interface Facilitates user interaction

Security & Protection Controls access and ensures system security

Operating System Services:

Operating systems provide a set of services to help both users and programs interact
effectively with the system hardware and resources. These services simplify the task of
managing hardware, files, programs, and data.

Types of Operating System Services

1. Program Execution
What it does: Loads programs into memory, executes them, and manages their execution
until completion.

Features:

● Handles process creation and termination.

● Ensures correct execution and reporting of errors.

Example: Opening MS Word or running a C program.

2. I/O Operations

What it does: Manages input and output devices, like keyboard, mouse, printer, or storage.

Features:

● Provides a uniform interface to perform I/O.

● Handles device communication and buffering.

Example: Reading data from a file or printing a document.

3. File System Manipulation

What it does: Allows programs and users to create, read, write, delete, and manage files
and directories.

Features:

● File access permissions.

● Directory structure management.

Example: Saving, renaming, or copying a file.


4. Communication Services

What it does: Enables processes to communicate with each other, either on the same
system or over a network.

Features:

● Supports interprocess communication (IPC).

● Manages data sharing via pipes, sockets, or message queues.

Example: Chat apps, client-server communication, or background sync.

5. Error Detection and Handling

What it does: Monitors the system for errors and takes appropriate action.

Features:

● Detects hardware failures, memory errors, file system corruption.

● Reports and logs errors to prevent system crashes.

Example: Warning when a file is corrupt or hardware driver fails.

6. Resource Allocation

What it does: Manages and allocates CPU, memory, and I/O devices to different programs
and users.

Features:

● Scheduling algorithms.

● Fair and efficient distribution of resources.


Example: Assigning CPU time to different running applications.

7. Accounting

What it does: Tracks resource usage for each user or process.

Features:

● Monitors CPU usage, memory, I/O.

● Useful for billing and system optimization.

Example: Tracking system usage in a university lab or cloud services billing.

8. Protection and Security

What it does: Protects system resources and data from unauthorized access.

Features:

● User authentication and password protection.

● File permissions and access control.

● Data encryption.

Example: Logging into a user account securely, restricting access to private files.

Summary Table

Service Function

Program Execution Runs programs and manages their lifecycle

I/O Operations Handles input/output devices and data transfers


File System Manipulation Manages files and directories

Communication Enables process and network communication

Error Detection Detects and manages system errors

Resource Allocation Distributes system resources efficiently

Accounting Tracks resource usage for users/processes

Protection & Security Safeguards against unauthorized access and ensures data
privacy

Reentrant Kernel in Operating Systems:

A Reentrant Kernel is a type of operating system kernel that allows multiple processes to
execute kernel code simultaneously without interfering with each other.

This means the kernel code is safe to re-enter — it can be interrupted in the middle of
execution and safely called again (“re-entered”) before the previous execution is complete.

Key Concept

A reentrant kernel ensures that:

● No shared data is modified by two processes at the same time.

● Kernel code is stateless, or shared data is protected using synchronization


mechanisms (like semaphores or locks).

How It Works

● When a process enters kernel mode (e.g., during a system call), it may be interrupted
by another process.
● The kernel ensures that the second process can also enter kernel mode without
corrupting shared resources.

● It uses separate stacks or context switching to keep process data isolated.

Advantages of Reentrant Kernels

Benefit Explanation

Supports multitasking Multiple processes can run system calls concurrently.

Efficient use of CPU Allows interruption and handling of multiple kernel


requests.

Improved system Especially useful in real-time and time-sharing systems.


responsiveness

Safe parallelism Avoids conflicts in shared code by ensuring reentrancy.

Disadvantages

Drawback Explanation

Complex to design Requires careful management of shared resources and


synchronization.

Performance May involve context switching and locking mechanisms.


overhead

More resource usage Needs separate stacks and more control structures for each pr

Monolithic vs. Microkernel Operating Systems


These are two major types of kernel architectures, which define how the operating system
core is structured and how it interacts with system hardware and software.

1. Monolithic Kernel

Definition:

A Monolithic Kernel is a kernel architecture where the entire operating system runs in
kernel mode as a single large process. All the OS services (like process management,
memory management, file system, device drivers, etc.) are part of the kernel itself.

Key Features:

● Everything (scheduler, memory manager, I/O, drivers) runs in one address space.

● Faster because all services interact through direct function calls (no message
passing).

● Less modular, more complex to debug or update.

Example Operating Systems:

● Linux

● Unix

● MS-DOS

Advantages:

Feature Benefit
High performance Faster execution due to no context
switching.

Efficient system calls Everything is linked together directly.

Easy access to Direct control over hardware and memory.


resources

Disadvantages:

Issue Why it matters

Less secure A bug in one module can crash the whole system.

Hard to maintain One large codebase; changes can affect


everything.

Difficult debugging Interconnected modules make errors hard to


isolate.

2. Microkernel

Definition:

A Microkernel is a kernel architecture where only the essential core functions run in
kernel mode — like CPU scheduling, inter-process communication (IPC), and basic memory
handling. Other services (drivers, file systems, etc.) run in user mode as separate
processes.

Key Features:
● Services communicate via message passing.

● Focuses on minimalism, modularity, and security.

● Better isolation — if a service fails, the kernel is unaffected.

Example Operating Systems:

● QNX

● MINIX

● Mach (used in macOS)

● L4 microkernel family

Advantages:

Feature Benefit

Highly secure Crashed services don't crash the whole


system.

Modular and maintainable Easy to upgrade, replace, or restart


components.

Reliable Less prone to system-wide failure.

Disadvantages:
Issue Why it matters

Slower Message passing is slower than direct function


performance calls.

Complex IPC Inter-process communication adds complexity.

More overhead Requires more resources for service management.

Comparison Table: Monolithic Kernel vs. Microkernel

Feature Monolithic Kernel Microkernel

Size Large Small (Minimal Core)

Services in Almost all (drivers, FS, Only essentials (scheduling, IPC,


Kernel memory, etc.) memory mgmt)

Performance High Slightly lower due to message


passing

Stability Lower — a bug can crash Higher — modules are isolated


whole system

Security Lower Higher due to better isolation

Complexity Simple concept, but large More modular, but complex IPC
codebase

Maintainability Difficult Easier

Examples Linux, UNIX, MS-DOS MINIX, QNX, macOS (Mach), L4


kernels

You might also like