0% found this document useful (0 votes)
36 views139 pages

Operating System

An operating system (OS) is system software that serves as an intermediary between users and computer hardware, managing resources and executing programs efficiently. It encompasses various components such as process management, file management, memory management, and device management, and can be classified into types like batch, multiprogramming, and time-sharing systems. Examples of operating systems include macOS, Windows, Android, and Linux, each designed to optimize user experience and resource utilization.

Uploaded by

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

Operating System

An operating system (OS) is system software that serves as an intermediary between users and computer hardware, managing resources and executing programs efficiently. It encompasses various components such as process management, file management, memory management, and device management, and can be classified into types like batch, multiprogramming, and time-sharing systems. Examples of operating systems include macOS, Windows, Android, and Linux, each designed to optimize user experience and resource utilization.

Uploaded by

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

Operating System

What is Operating System?


● An operating system is system software that acts as an intermediary
between a user of a computer and the computer hardware.

It is software that manages the computer hardware and allows the user
to execute programs in a convenient and efficient manner.
● An operating system is a program on which application programs are
executed.

Some examples of operating systems include Apple macOS, Microsoft


Windows, Google's Android OS, Linux Operating System, and Apple IOS.
Goals or Objectives of Operating System

● To control and coordinate the use of system resources like CPU time,
memory, clock etc.,
● To provide a convenient environment for a user to access the
available resources.
● To increase the productivity of processing resources.
● To use the computer hardware in an efficient manner.
The salient features about Computer System
Organisation are:
● The I/O devices and the CPU both execute concurrently. Some
of the processes are scheduled for the CPU and at the same
time, some are undergoing input/output operations.
● There are multiple device controllers, each in charge of a
particular device such as keyboard, mouse, printer etc.
● There is buffer available for each of the devices. The input
and output data can be stored in these buffers.
● The data is moved from memory to the respective device
buffers by the CPU for I/0 operations and then this data is
moved back from the buffers to memory.
● The device controllers use an interrupt to inform the CPU that
I/0 operation is completed.
Computer System Structure or
Components of Computer System
● A computer system is a collection of hardware and software
components
● Hardware refers to the physical computing equipment.
● Software refers to the programs written to provide services to the
users of the system.
● Every computer system consists of four basic components.
● Those are hardware (Memory, Central Processing Unit and the
Input-Output Unit), Operating System, System and Application
Software and Users.
Computer System Structure or Components of Computer System

Computer system mainly consists of four components-


● Hardware: It provides basic computing resources CPU, memory, I/0
devices
● Operating System: It controls and coordinates use of hardware
and software among various applications and users
● System and Application Software: It define the ways in which
the system resources are used to solve the computing problems of
the users, Word processors, Compilers, Web browsers, Database
systems, Video games, etc.
● Users: People who use the Computers.
I can store a mountain of data but
weigh almost nothing. What am I?
Computer System Architecture
● Computer architecture means design or construction of a
computer.
● A computer system may be organized in different ways.
● Some computer systems have single processor and other have
multiple processors.
● So computer systems categorized in these ways

1. Single Processor Systems

2. Multiprocessor Systems

3. Clustered Systems
1.Single Processor Systems
Definition: A single processor system has only one CPU (Central
Processing Unit) that executes all instructions. It performs one task at
a time and switches between tasks using scheduling mechanisms.

Characteristics:
● Limited computational power.
● Simpler and cost-effective for basic tasks.
● Commonly used in personal computers or simple embedded
systems.

Example:

Early personal computers like IBM PC.


2. Multiprocessor Systems
Definition: A multiprocessor system consists of two or more
processors sharing a common memory. These processors work
together to perform tasks faster and handle more complex
computations.

Characteristics:
● Improved performance due to parallel processing.
● More expensive and complex than single-processor systems.
● Used in servers and high-performance computing environments.
● There are two types of Multiprocessor System
Types:

Symmetric Multiprocessing (SMP): All processors are equal and share memory.

The multiprocessing system in each processor performs all types of task within the
operating system.

All processors are peers and no master slave relationship exits.

Asymmetric Multiprocessing (AMP): The multiprocessing system, in which each


processor is assigned a specific task, is known as Asymmetric Multiprocessing Systems.

In this system there exists master slave relationship like one processor defined as master
and others are slave.

Example:

Modern servers like Dell PowerEdge.

High-end desktops like gaming PCs with dual CPUs.


3. Clustered Systems
Definition: A clustered system consists of multiple independent systems (nodes)
connected via a network. They work together as a single unit, often used for
redundancy, load balancing, and high availability.

Characteristics:
● Nodes can work together or independently.
● If one node fails, others can take over (fault tolerance).
● Commonly used in cloud computing, data centers, and large-scale applications

Example:

Hadoop clusters for big data processing.

Amazon Web Services (AWS) clusters.


1. I live in the “cloud,” but I’m not
made of water. What am I?
View of Operating System
Operating System can be viewed from two viewpoints- User Views & System

Views

1. User Views: The user's view of the operating system depends on the type of
user.
● If the user is using standalone system, then OS is designed for ease of use
and high performances. Here resource utilization is not given importance.
● If the users are at different terminals connected to a mainframe or
minicomputers, by sharing information and resources, then the OS is designed
to maximize resource utilization. OS is designed such that the CPU time,
memory and I/0 are used efficiently and no single user takes more than the
resource allotted to them.
● Users of hand-held systems, expects the OS to be designed for ease of use
and performance per amount of battery life
2. System Views: Operating system can be viewed as a resource
allocator and control program.
● Resource allocator: The OS acts as a manager of hardware and
software resources. CPU time, memory space, file-storage space,I/0
devices, shared files etc. are the different resources required during
execution of a program.

● Control Program: The OS is a control program and manage the


execution of user program to prevent errors and improper use of the
computer.
Parts of Operating System
1. Kernel:
● The core of the operating system is the Kernel. It is the inner layer
of OS.
● It controls the computer's resources, allotting them to different
users and to different tasks

2. Shell: interface between the user and the kernel


● Prompting the user to give input
● Interpreting the input for the operating system
● Handling the output from the operating system.
Functions or Components of Operating System
Process Management
● A process is a program in a state of execution. It is a unit of work for
the operating system.
● A process can be created, executed, and stopped.
● A program may have two or more processes running. A process and
a program are, thus, two different entities.
The Process Management activities handled by the Operating
System

1. Control access to shared resources like file, memory, I/0 and CPU.

2. Control execution of applications.

3.The creation, execution and deletion of both user and system processes

4. Cancel or resume a process.

5. Schedule a process

6. The provision of mechanisms for process synchronization &


communication.

7. The provision of mechanisms for deadlock handling.


File Management
The file management function of the operating system involves
handling the file system which consists of two parts-a set of files, and a
directory structure.

Files: File is a collection of related information, has a name, and is


stored on a secondary storage.

Directory: Directory structure provides information about the files


stored on the secondary storage
The File Management activities handled by the Operating System

1. File and directory creation and deletion.

2. Manipulating files and directories.

3. Provide access to files

4. Mapping files onto secondary storage.

5. Backup files on stable storage media.

6. Protection and security of the files.


Memory Management

● Memory management is one of the tasks handled by the operating system.


● Memory management handle the allocation of memory to different
processes.
● On completion of process execution, the memory is de-allocated and made
available to another process
● Main memory, also known as

primary memory, stores data temporarily


● secondary memory stores data

permanently
The Memory Management activities handled by the Operating
System

1. It keep track of memory usage.

2. It keep track of which parts of memory are currently being used and by
whom.

3. In a multiprogramming system, the OS decides which process will get


memory and how much.

4. Allocates the memory when a process requests.

5. Re-allocate memory to a program when a used block is freed.

6. It also de-allocates the memory when a process no longer requires or has


been terminated.
Secondary Storage Management
● The main memory is too small to accommodate all data and
programs, and its data are lost when power is lost,

the computer system must provide secondary storage to back up


main memory.
● Today modern computers use hard drives/SSD as the primary
storage of both programs and data.
The Secondary Storage Management activities handled by the Operating System

1. Storage allocation (what data goes where on the disk)

2. Free space management (paging/swapping)

3. Disk scheduling (Scheduling the requests for memory access).


I/O Device Management
● The peripheral devices like mouse, hard disk, printer, plotter etc.
are connected to the computer. OS manages and controls the
devices attached to the computer.
● OS provides appropriate functionality to the application programs
for controlling different aspects of the devices
The Device Management activities handled by the Operating System

1. Open, close and write device drivers

2. Communicate, control and monitor the device driver.

3. It offers a buffer caching system

4. It provides drivers for particular hardware devices.


Network Management
● Operating systems play a major role in networking. A common
example is that of distributed systems in which a Operating System
of sever can ensure that there is uniformity between the distributed
PCs.
The Network Management activities handled by the Operating System

1. Creating and managing user accounts on the network.

2. Controlling access to resources on the network.

3. Provide communication services between the devices on the network.

4. Offers data availability and reliability.


Security Management
● OS protects the resources of system.
● If a computer system has multiple users and allows the concurrent
execution of multiple processes then the various processes must be
protected from each other's activities.
● For example, memory addressing hardware ensures that a process
can execute only within its own address space
The Security Management activities handled by the Operating System

1. The protection of activities of one process from the activities of


another process.

2. To ensure the reliability of the computer system

3. User Authentication: To secure the data and programs stored in the


computer system as well as the various resources of the computer
system against unauthorized access.

4. To ensure safety from threats and attacks from external world


Command Interpreter System
● A user provides input commands in a high level language. Since the
computer only understands Os and 1s (binary language), the
operating system manages the interpretation of the commands and
then guides the resources to process them
● Command interpreter is an important part of any operating system.
It provides an interface between the user and the computer.
1. Command Line Interface (CLI): CLI requires the user to interact
with operating system in the form of text keyed in from the keyboard.

Examples: MS-DOS and Linux shell are examples of command line


mode of interfaces.

2.Graphical User Interface (GUI): GUI use graphics to display the


various commands. The interface consists of icons, menus, windows,
and pointers.

Examples: Microsoft Windows and Mac OS are examples of graphical


mode of interface.
Layered Approach Structure
The peripheral devices like mouse, hard disk, printer, plotter etc. are
connected to the computer. OS manages and controls the devices
attached to the computer. OS provides appropriate functionality to the
application programs for controlling different aspects of the devices.

Any kind of Input that we give to the computer goes through the
operating system. Any output that we get is also acted upon by the
Operating System.
Classification or Types of Operating System
Classification of Operating System based on Processing Method

● Batch Processing Operating System


● Multi-Programming Operating System
● Network Operating System
● Distributed Operating System.
● Multi-Processing Operating System
● Time-Sharing Operating System
● Real-Time Operating System
Batch Processing Operating System

● A batch is a sequence of user jobs formed for the purpose of processing


by a batch processing system.Each job in the batch is independent of
other jobs in the batch.
● Batch operating systems process data in the form of batches.
● The user of a batch operating system never directly interacts with the
computer.
● In this type of OS, every user prepares his or her job on an offline device
like a punch card and submit it to the computer operator.
● Batch operating system was the first operating system to be used in
second generation computer.
Examples for Batch Operating system
1. Payroll System

2. Monthly Statement Generation in Banks


Advantages and Disadvantages of Batch
Operating System
Advantages Disadvantages

● The overall time taken by the ● The computer operators should be


system to execute all the well known with batch systems
● It proves to be costly sometimes.
programs will be reduced...
● The other jobs will have to wait for
● Batch systems can be shared
an unknown time if any job fails
by multiple users.
● Lack of interaction between the
● It can work in offline mode
user and the job.
also. ● Difficult to provide the desired
● It manages the large load of priority.
repeated work efficiently
Buffering
● The main memory has an area called buffer that is used to store or
hold the data temporarily that is being transmitted either between
two devices or between a device or an application.
● Buffering is an act of storing data temporarily
● Buffering is a method of overlapping input, output and processing of
a single job.

SPOOLING (Simultaneous Peripheral Operation Online):


● It is called simultaneous peripheral operation online.
● Simultaneous means if two or more users issue the print command
and the printer can accept requests even if it is printing some other
jobs.
2.Multiprogramming Operating System

● The operating system which can run multiple processes on a single


processor is called a multiprogramming operating system
● There are different programs that want to get executed
● So these programs are kept in the ready queue.
● And are assigned to the CPU one by one.
● If one process gets blocked then other processes from the ready
queue are assigned to the CPU.
● The main aim multiprogramming OS is optimal resource utilization
and more CPU utilization.
Advantages of Multiprogramming Operating System

● No CPU idle tirne


● Multiprogramming system can monitor fastest as entire tasks run in
parallel.
● Shorter response time
● Maximizes total job throughput of a computer
● Increases resource utilization.
Disadvantages of Multiprogramming Operating System

● Sometimes long-time jobs have to wait a long time.


● Tracking of all processes is sometimes difficult.
● Requires CPU scheduling.
● Requires efficient memory management.
● No user interaction with any program during execution.
3.Time Sharing Operating System
● Time-sharing is a logical extension of multiprogramming
● A time-shared operating system allows many users to share the
computer simultaneously.
● The system switches rapidly form one user to the next and hence
the user is given an impression that the entire computer system is
dedicated to his use, though it is being shared among many user
using CPU scheduling and Time Slice.

Features
● Multiple online users can use the same computer at the same time
● Better interaction between users and computers.
● User requests can make in small-time responses.
● It is also called as Multitasking OS
Advantages of Time-Sharing Operating System

It provides a quick response.

• Reduces CPU idle time

• All the tasks are given a specific time.

• Enables resource sharing.

• Improves response time.

Easy to use and user friendly.


Disadvantages of Time-Sharing Operating System

It consumes many resources

Requires high specification of hardware

It has a problem of reliability

An issue with the security

Probability of data communication.

Differentiate Multiprogramming OS and Time-sharing OS


4. Multiprocessing Operating System
● Multiprocessing helps in performing parallel computing.
● Parallel computing means simultaneous use of multiple
processors to solve a problem.
● A problem is broken into multiple parts that can be solved
concurrently and are executed using multiple CPUs
● There are several processors in a system, each of which can run
multiple processes at the same time.
● The system’s throughput will be significantly increased as a result of
this.
Advantages of Multi Processor
Operating System

● Parallel Processing
● Great Reliability as functions are distributed
properly among several processors, then the
failure of one processor will not halt the system.
● Increased throughput as by increasing the number
of processors, we can expect more work to be
done in less time.
Disadvantages of Multi Processor
Operating System
● Implementation is complex
● Requires resource management and protection.
● processors and memory, making a system more
expensive.
5.Network Operating System
● Network operating systems are those networks that contain two
types of nodes, the servers, and clients It is also called as
Client/Server Network OS.
● The servers host the applications or services for users while clients
use these applications.
● In a client/server system, both the server and client computers
must have certain software installed to connect to each other
securely over a network connection
Advantages of Network Operating System

● Highly stable centralized servers.


● Security concerns are handled through servers
● New technologies and hardware up-gradation are easily integrated
into the system.
● Server access is possible remotely from different locations and
types of systems.
Disadvantages of Network Operating System

● Servers are costly.

● User has to depend on a central location for most operations.

● Maintenance and updates are required regularly.

● Less secure than dedicated server systems.


6.Distributed Operating System
● A distributed operating system is an operating system that is
designed to operate on a network of computers.
● Distributed systems are usually used to distribute software
applications and data.

● Two types
○ Loosely Coupled System: Processor with own resources are not
accessible to other systems
○ Tightly Couple System: Processors share the computer bus,
memory and peripheral devices.
Advantages of Distributed Operating System
● It is more reliable as a failure of one system will not impact the
other computers or the overall system.
● All computers work independently.
● Resources are shared
● The system works at a higher speed as resources are shared
● The host system has less load.
Disadvantages of Distributed Operating System

● Costly setup.
● If the server is failed, then the whole system will fail.
● Complex software is used for such a system.
Kernel and System Call
● A Kernel is a computer program that is the heart and core of an
Operating System. It has control over everything in the system.
● The Kernel is responsible for low-level tasks such as disk
management. memory management, task management, etc.
● It provides an interface between the user and the hardware
components of the system.
● When a process makes a request to the Kernel, then it is called
System Call
Kernel Space and User Space
1. Kernel Space.

The memory space where the core of the operating system (kernel)
executes and provides its services is known as kernel space

2.User Space

The user space is the memory space where all user applications or
application software executes.
Types of Kernel
Operating System Services
1.User interface

2.Program Execution

3.I/O system manipulation

4.File-System Manipulation

5. Error Detection

6.Communication

7.Resoures Allocation

8.Protection and Security

9.Accounting
System Calls
● When the process is being run, if the process requires certain actions
which need to be carried out by Operating System, the process need to
call the function which can interact with the kernel to complete the
actions. This special type of function call is known as System Calls in OS.

Definition System Calls


● In computing, a system call is the programmatic way in which a
computer program requests a service from the kernel of the operating
system it is executed on.
● A system call is a way for programs to Interact with the operating
system.
Need for System Calls
We require system calls in various situations. Some of the reasons for
system calls are:

1. To read and write from files.

2 To create or delete files.

3. To create and manage new processes.

4. To send and receive packets, through network connections.

5. To access hardware devices.


How the System Call works?

1. User Mode: In this mode, execution is


done on behalf of the user.

2. Kernel-Mode: In this mode, execution is


done on behalf of OS
Services of System Call in Operating System

Following are the services provided by a system call:


● Manages Main Memory
● Helps access Files and Directories and manages
the File System.
● Creates and Manages New Processes
● I/0 Device Handling
● Provides System Protection
Types of System Calls
There are mainly fhe types of system calls. They are as follows:

1.Process Control

2. File Management

3. Device Management

4. Information Maintenance

5 Communication

6. Protection
1.Process Control
● Process control is the system call that is used to direct the
processes.
● It performs the tasks of process creation, process termination, etc.

Functions of Process Control:


● End and Abort
● Loading and Execution of a process
● Creation and termination of a Process
● Wait and Signal Event
● Allocation of free memory
2.File Management:
● File management is a system call that is used to handle the files.

Functions of File Management:


● Creation of a file
● Deletion of a file
● Opening and closing of a file
● Reading, writing, and repositioning
● Getting and setting file attributes
3. Device Management:
Device management is a system call that is used to deal with devices.

It helps in device manipulation like reading from device buffers, writing


into device buffers, etc

Functions of Device Management:


● Requesting and releasing devices
● Attaching and detaching devices logically
● Getting and setting device attributes
4.
4.Information Maintenance
It handles information and information transfer between OS and the
user program

Functions. of Information Maintenance:

● Getting or setting time and date


● Getting process and device attributes
5.Communication
● Communication is a system call that is used for inter process
communication.

Functions of Interprocess Communication:

Creation and deletion of communications connections

Sending and receiving messages

Helping OS transfer status information

Attaching or detaching remote devices


6. Protection
● Protection provides a mechanism for controlling access to the
resources provided by a computer system.

Functions of Protection:
● System calls providing protection include setting the permissions
and getting the permissions.
● Manipulating the permission settings of resources such as files and
disks.
● System calls specify whether particular users can or cannot be
allowed access to certain resources.
PROCESSES
A process is actively running software or a
computer code

When a program is loaded into memory, it may be divided into


the four components stack, heap, text, and data to form a
process.

.
Component & Description

1 Stack
The process Stack contains the temporary data such as
method/function parameters, return address and local
variables.
2 Heap
This is dynamically allocated memory to a process during
its run time.
3 Text
This includes the current activity represented by the value
of Program Counter and the contents of the processor's
registers.
Difference Between Program and Process
Program Process

The program contains a set of


The process is an instance of
instructions designed to
an executing program.
complete a specific task.

The process is an active


A program is a passive entity
entity as it is created during
as it resides in the secondary
execution and loaded into the
memory.
main memory.

The process exists for a


Program exists at a single
limited period as it gets
place and continues to exist
terminated after the
The process is a dynamic
A program is a static entity.
entity.

The process has a high


The program does not have
resource requirement, it
any resource requirement, it
needs resources like CPU,
only requires memory space
memory address, and I/O
for storing the instructions.
during its lifetime.

The program does not have Process has its control block
any control block. called Process Control Block.
In addition to program data, a process
The program has two
also requires additional information
logical components:
required for the management and
code and data.
execution.

Many processes may execute a single


The program does not program. Their program code may be
change itself. the same but program data may be
different. these are never the same.

Program contains The process is a sequence of


instructions instruction execution.
Process Life Cycle
When a process executes, it passes through different
states.
1 Start
This is the initial state when a process is first
started/created.

2 Ready
The process is waiting to be assigned to a processor. Ready
processes are waiting to have the processor allocated to
them by the operating system so that they can run. Process
may come into this state after Start state or while running
it by but interrupted by the scheduler to assign CPU to
some other process.
3 Running
Once the process has been assigned to a processor by the
OS scheduler, the process state is set to running and the
processor executes its instructions.
4 Waiting
Process moves into the waiting state if it needs to wait for
a resource, such as waiting for user input, or waiting for a
file to become available.
5 Terminated or Exit
Once the process finishes its execution, or it is terminated
by the operating system, it is moved to the terminated
state where it waits to be removed from main memory.
Process Control Block
PCB
❖ A Process Control Block is a data structure maintained

by the Operating System for every process.

❖ The PCB is identified by an integer process ID (PID).

❖ A PCB keeps all the information needed to keep track of

a process as listed below in the table


BLOCK DIAGRAM OF
PCB
1 Process State
The current state of the process i.e., whether it is ready,
running, waiting, or whatever.
2 Process privileges
This is required to allow/disallow access to system
resources.
3 Process ID
Unique identification for each of the process in the
operating system.
4 Pointer
A pointer to parent process.
5 Program Counter
Program Counter is a pointer to the address of the next
instruction to be executed for this process.
6 CPU registers
Various CPU registers where process need to be stored for
execution for running state.
7
CPU Scheduling Information
Process priority and other scheduling information which is
required to schedule the process.
8
Memory management information
This includes the information of page table, memory limits,
Segment table depending on memory used by the
operating system.
9
Accounting information
This includes the amount of CPU used for process
execution, time limits, execution ID etc.
10
IO status information
This includes a list of I/O devices allocated to the process.
Process Scheduling

The process scheduling is the activity of the


process manager that handles the removal of the
running process from the CPU and the selection of
another process on the basis of a particular
strategy.
• Process scheduling is an essential part of
a Multiprogramming operating systems.
• Operating systems allow more than one
process to be loaded into the executable
memory at a time and the loaded process
shares the CPU using time multiplexing.
Process Scheduling Queues
• The OS maintains all PCBs in Process Scheduling Queues.
• The OS maintains a separate queue for each of the process
states
• PCBs of all processes in the same execution state are
placed in the same queue.
• When the state of a process is changed, its PCB is unlinked
from its current queue and moved to its new state queue.
The Operating System maintains the following
important process scheduling queues −
Job queue − This queue keeps all the processes
in the system.
Ready queue − This queue keeps a set of all
processes residing in main memory, ready and
waiting to execute. A new process is always put in
this queue.
Device queue − The processes which are blocked
due to unavailability of an I/O device constitute this
queue. These are waiting for the allocation of a
Schedulers

Schedulers are special system software


which handle process scheduling in various
ways.

Their main task is to select the jobs to be


submitted into the system and to decide
which process to run.
Schedulers are of three types

• Long-Term Scheduler

• Short-Term Scheduler

• Medium-Term Scheduler
Long Term Scheduler
• It is also called a job scheduler.
• It determines which programs are admitted to the system for processing.
• It selects processes from the queue and loads them into memory for
execution.
• The primary objective of the job scheduler is to provide a balanced mix of jobs,
such as I/O bound and processor bound.
• It also controls the degree of multiprogramming. i.e the no. of programs
executing concurrently.
• When a process changes the state from new to ready, then there is use of
long-term scheduler.
Short Term Scheduler

• It is also called as CPU scheduler.


• Its main objective is to increase system
performance in accordance with the chosen set of
criteria.
• It is the change of ready state to running state of the
process.
• CPU scheduler selects a process among the processes that
are ready to execute and allocates CPU to one of them.

• Short-term schedulers, also known as dispatchers, make


the decision of which process to execute next.

• Short-term schedulers are faster than long-term schedulers.


Medium Term Scheduler

• Medium-term scheduling is a part of swapping.


• It removes the processes from the memory.
• It reduces the degree of multiprogramming.
• The medium-term scheduler is in-charge of
handling the swapped out-processes.
• A running process may become suspended if it
makes an I/O request.
• A suspended processes cannot make any
progress towards completion.
• In this condition, to remove the process from
memory and make space for other processes
• The suspended process is moved to the secondary
storage.
• This process is called swapping and the process is
said to be swapped out or rolled out.
• Swapping may be necessary to improve the
process mix.
Independent and
Cooperative
Processes
Independent Process Cooperating Process
● Cooperating Processes are those
processes that depend on other
processes or processes.
Independent
● They work together to achieve a
Processes are those common task in an operating system.

processes whose ● These processes interact with each


other by sharing the resources such
task is not as CPU, memory, and I/O devices to
complete the task.
dependent on any ● cooperating processes are essential
unit to increase the concurrent
other processes. execution and because of it, the
performance of the overall system
increases.
The functions of cooperating process in operating
system are

Inter-Process Communication
(IPC)
Concurrent execution
Resource sharing
● Inter-Process Communication (IPC):
Cooperating processes interact with each other
via Inter-Process Communication (IPC).
● As they are interacting to each other and sharing
some resources with each other .
● To implement the IPC there are many options
such as pipes, message queues, semaphores, and
shared memory.
● Concurrent execution: These cooperating
processes executes simultaneously.
● Simultaneous execution can be done by
operating system scheduler
● Scheduler helps OS to select the process from
ready queue.
● Because of concurrent execution of several
processes the completion time decreases.
● Resource sharing: Cooperating processes
cooperate by sharing resources including CPU,
memory, and I/O hardware.
● If several processes are sharing resources,
synchronization increases and the response time of
process increase.
• Deadlocks: As cooperating processes shares their
resources, there might be a deadlock condition.
• Deadlock means if p1 process holds the resource A
and wait for B and p2 process hold the B and wait
for A.
• In this condition deadlock occur in cooperating
process.
• To avoid deadlocks, operating systems typically use
algorithms such as the Banker’s algorithm to
● Process scheduling: Cooperating processes runs
simultaneously but after context switch, which
process should be next on CPU to executes, this is
done by the scheduler.
● Scheduler do it by using several scheduling
algorithms such as Round-Robin, FCFS, SJF, Priority
etc.
THREADS IN OPERATING SYSTEM
● A thread is a separate path of execution within a program
● Threading is a programming technique that allows
multiple tasks to be executed simultaneously in a
program.
● This is done by assigning each task its own thread of
control.
• Threads run independently, but share the process's
resources.

• The operating system manages the threads to


ensure fair processor utilization.

• Threads can perform different tasks


simultaneously on different processor cores.
Multithreaded programming in an
operating system (OS) is the ability of a
program to run multiple threads
simultaneously.
This allows the OS to handle multiple
requests at once, without requiring multiple
copies of the program.
• Multithreading allows the execution of multiple parts of a
program at the same time.

• These parts are known as threads and are lightweight


processes available within the process.
• Multithreading leads to maximum utilization of the CPU by
multitasking.
Multi-Threading Models
One to One Model
The one to one model maps each of the user threads to
a kernel thread.
This means that many threads can run in parallel on
multiprocessors
A disadvantage of the one to one model is that the
creation of a user thread requires a corresponding
kernel thread. Since a lot of kernel threads burden the
Many to One Model
The many to one model maps many of the user threads to a
single kernel thread. This model is quite efficient as the user
space manages the thread management.
A disadvantage of the many to one model is that a thread
blocking system call blocks the entire process. Also, multiple
threads cannot run in parallel as only one thread can access the
kernel at a time.
Many to Many Model
The many to many model maps many of the user
threads to a equal number or lesser kernel threads.
The number of kernel threads depends on the
application or machine.
The many to many does not have the
The many to many does not have the
disadvantages of the one to one model or the
many to one model. There can be as many user
threads as required and their corresponding kernel
threads can run in parallel on a multiprocessor
Thank You

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy