0% found this document useful (0 votes)
20 views15 pages

Chapter 2 OS

operating system mu chp 2

Uploaded by

yashpatilyp2004
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)
20 views15 pages

Chapter 2 OS

operating system mu chp 2

Uploaded by

yashpatilyp2004
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/ 15

Process management

• A process is a program in execution.


• For example, when we write a program in C or C++ and compile it,
the compiler creates binary code.
• The original code and binary code are both programs. When we
actually run the binary code, it becomes a process.
• A process is an ‘active’ entity instead of a program, which is
considered a ‘passive’ entity.
• A single program can create many processes when run multiple
times; for example, when we open a .exe or binary file multiple times,
multiple instances begin
• Process management can help organizations improve their
operational efficiency, reduce costs, increase customer satisfaction,
and maintain compliance with regulatory requirements.
• It involves analyzing the performance of existing processes,
identifying bottlenecks, and making changes to optimize the process
flow.
How Does a Process Look Like in
Memory?
• Text Section: A Process, sometimes known as the Text Section, also
includes the current activity represented by the value of the
Program Counter.

• Stack: The stack contains temporary data, such as function


parameters, returns addresses, and local variables.

• Data Section: Contains the global variable.

• Heap Section: Dynamically memory allocated to process during its run


time.
Key Components of Process
Management
• Process mapping: understand how tasks flow, identify dependencies,
and uncover improvement opportunities.
• Process analysis: Evaluating processes to identify bottlenecks,
inefficiencies, and areas for improvement.
• Process redesign: Making changes to existing processes or creating
new ones to optimize workflows and enhance performance.
• Process implementation: Introducing the redesigned processes into
the organization and ensuring proper execution.
• Process monitoring and control: Tracking process performance,
measuring key metrics, and implementing control mechanisms to
maintain efficiency and effectiveness.
Characteristics of a Process

• Process Id: A unique identifier assigned by the operating system.


• Process State: Can be ready, running, etc.
• CPU registers: Like the Program Counter (CPU registers must be saved and
restored when a process is swapped in and out of the CPU)
• Accounts information: Amount of CPU used for process execution, time
limits, execution ID, etc
• I/O status information: For example, devices allocated to the process, open
files, etc
• CPU scheduling information: For example, Priority (Different processes may
have different priorities, for example, a shorter process assigned high priority
in the shortest job first scheduling)
States of Process

New: Newly Created Process (or) being-created process.

Ready: After the creation process moves to the Ready state, i.e. the
process is ready for execution.

Run: Currently running process in CPU (only one process at a time can
be under execution in a single processor)
Wait (or Block): When a process requests I/O access.
Complete (or Terminated): The process completed its execution.

Suspended Ready: When the ready queue becomes full, some


processes are moved to a suspended ready state

Suspended Block: When the waiting queue becomes full.


Process control block
• A Process Control Block (PCB) is a data structure that is used by an
Operating System to manage and regulate how processes are carried
out.
• In operating systems, managing the process and scheduling them
properly play the most significant role in the efficient usage of
memory and other system resources
• n the process control block, all the details regarding the process
corresponding to it like its current status, its program counter, its
memory use, its open files, and details about CPU scheduling are
stored.
• The PCB is created with the aim of helping the OS to manage the
enormous amounts of tasks that are being carried out in the system.
• PCB is helpful in doing that as it helps the OS to actively monitor the
process and redirect system resources to each process accordingly.

• All this information is afterward used by the OS to manage processes


and run them efficiently.
• Process State: The state of the process is stored in the PCB which
helps to manage the processes and schedule them. There are
different states for a process which are “running,” “waiting,” “ready,”
or “terminated.”
• Process ID: The OS assigns a unique identifier to every process as
soon as it is created which is known as Process ID, this helps to
distinguish between processes.
• Program Counter: While running processes when the context switch
occurs the last instruction to be executed is stored in the program
counter which helps in resuming the execution of the process from
where it left off.
• CPU Registers: The CPU registers of the process helps to restore the
state of the process so the PCB stores a copy of them.
• Memory Information: The information like the base address or total
memory allocated to a process is stored in PCB which helps in efficient
memory allocation to the processes.
• Process Scheduling Information: The priority of the processes or the
algorithm of scheduling is stored in the PCB to help in making
scheduling decisions of the OS.
• Accounting Information: The information such as CPU time, memory
usage, etc helps the OS to monitor the performance of the process.
Operations that are Carried out with the help of
PCB

• Process Scheduling: The different information like Process priority,


process state, and resources used can be used by the OS to schedule
the process on the execution stack. The scheduler checks the priority
and other information to set when the process will be executed.

• Multitasking: Resource allocation, process scheduling, and process


synchronization altogether helps the OS to multitask and run different
processes simultaneously.
• Context Switching: When context switching happens in the OS the
process state is saved in the CPU register and a copy of it is stored in
the PCB.
• When the CPU switches to another process and then switches back to
that process the CPU fetches that value from the PCB and restores the
previous state of the process.
• Resources Sharing: The PCB stores information like the resources that
a process is using, such as files open and memory allocated.
• This information helps the OS to let a new process use the resources
which are being used by any other process to execute sharing of the
resources.

You might also like