SlideShare a Scribd company logo
2
Most read
4
Most read
9
Most read
Process Concept 1
 A process can be thought of as a program in execution.
 A process will need certain resources-such as CPU time, memory, files, and I/O devices-to accomplish
its task.
 These resources are allocated to the process either when it is created or while it is executing.
 A process is the unit of work in most systems.
 Systems consist of a collection of processes: Operating-system processes execute system code, and
user processes execute user code. All these processes may execute concurrently.
 Although traditionally a process contained only a single thread of control as it ran, most modem
operating systems now support processes that have multiple threads.
 The operating system is responsible for the following activities in connection with process and thread
management: the creation and deletion of both user and system processes; the scheduling of
processes; and the provision of mechanisms for synchronization, communication and deadlock
handling for processes.
2
 Informally, as mentioned earlier, a process is a program in execution. A process is more than the
program code, which is sometimes known as the text section. It also includes the current activity, as
represented by the value of the program counter and the contents of the processor's registers.
 A process generally also includes the process stack, which contains temporary data (such as function
parameters, return addresses, and local variables), and a data section, which contains global variables.
 A process may also include a heap, which is memory that is dynamically allocated during process run
time.
 The structure of a process in memory is shown in Figure 3.1.
 We emphasize that a program by itself is not a process; a program is a passive entity, such as a file
containing a list of instructions stored on disk (often called an executable file), whereas a process is an
active entity, with a program counter specifying the next instruction to execute and a set of associated
resources.
 A program becomes a process when an executable file is loaded into memory.
 Two common techniques for loading executable files are double-clicking an icon representing the
executable file and entering the name of the executable file on the command line (as in prog. exe or a.
out.). 3
4
 As a process executes, it changes state. The state of a process is defined in part by the current
activity of that process. Each process may be in one of the following states:
 New: The process is being created.
 Running: Instructions are being executed.
 Waiting: The process is waiting for some event to occur (such as an I/O completion or
reception of a signal).
 Ready: The process is waiting to be assigned to a processor.
 Terminated: The process has finished execution.
 These names are arbitrary, and they vary across operating systems. The states that they
represent are found on all systems, however. Certain operating systems also more finely
delineate process states. It is important to realize that only one process can be running on
any processor at any instant. Many processes may be ready and waiting, however. The state
diagram corresponding to these states is presented in Figure 3.2.
5
6
 Each process is represented in the operating system by a process control block (PBC) also called a task
control block. A PCB is shown in Figure 3.3. It contains many pieces of information with a specific process,
including these:
 Process state: The state may be new, ready running, waiting, halted, and so on.
 Program counter: The counter indicates the address of the next instruction to be executed for this
process.
 CPU registers: The registers vary in number and type, depending on the computer architecture. They
include accumulators, index registers, stack pointers, and general-purpose registers, plus any condition-
code information. Along with the program counter, this state information must be saved when an interrupt
occurs, to allow the process to be continued correctly afterward (Figure 3.4).
 CPU-scheduling information: This information includes a process priority, pointers to scheduling queues,
and any other scheduling parameters.
 Memory-management information: This information may include such information as the value of the
base and limit registers, the page tables, or the segment tables, depending on the memory system used by
the operating system.
 Accounting information: This information includes the amount of CPU and real time used, time limits,
account numbers, job or process numbers, and so on.
 I/O status information: This information includes the list of I/O devices allocated to the process, a list of
open files, and so on.
 In brief the PCB simply serves as the repository for any information that may vary from process to process.
7
8
 A process is a program that performs a single thread of execution.
 For example, when a process is running a word-processor program, a single thread of instructions is
being executed.
 This single thread of control allows the process to perform only one task at one time.
 The user cannot simultaneously type in characters and run the spell checker within the same process,
for example.
 Many modern operating systems have extended the process concept to allow a process to have
multiple threads of execution and thus to perform more than one task at a time.
 On a system that supports threads, the PCB is expanded to include information for each thread. Other
changes throughout the system are also needed to support threads.
9
 Interrupts cause the operating system to change a CPU from its current task and to run a kernel routine.
 Such operations happen frequently on general-purpose systems.
 When an interrupt occurs, the system needs to save the current context of the process running on the CPU
so that it can restore that context when its processing is done, essentially suspending the process and then
resuming it.
 The context is represented in the PCB of the process; it includes the value of the CPU registers, the process
state (see Figure 3.2), and memory-management information.
 Generically, we perform a save state of the current state of the CPU, be it in kernel or user mode, and then a
state restore to resume operations.
 Switching the CPU to another process requires performing a state save of the current process and a state
restore of a different process.
 This task is known as Context Switch.
 When a context switch occurs, the kernel saves the context of the old process in its PCB and loads the saved
context of the new process scheduled to run.
 Context-switch time is pure overhead, because the system does no useful work while switching.
 Its speed varies from machine to machine, depending on the memory speed, the number of registers that
must be copied, and the existence of special instructions (such as a single instruction to load or store all
registers).
10
 Typical speeds are a few milliseconds. Context-switch times are highly dependent on hardware
support.
 For instance, some processors (such as the Sun UltraSPARC) provide multiple sets of registers.
 A context switch here simply requires changing the pointer to the current register set.
 Of course, if there are more active processes than there are register sets, the system resorts to copying
register data to and from memory, as before.
 Also, the more complex the operating system, the more work must be done during a context switch.
 Advanced memory-management techniques may require extra data to be switched with each context.
 For instance, the address space of the current process must be preserved as the space of the next task
is prepared for use.
 How the address space is preserved, and what amount of work is needed to preserve it, depend on the
memory-management method of the operating system.
11
12
 Processes executing concurrently in the operating system may be either independent processes or
cooperating processes.
 A process is independent if it cannot affect or be affected by the other processes executing in the
system.
 Any process that does not share data with any other process is independent.
 A process is cooperating if it can affect or be affected by the other processes executing in the system.
 Clearly, any process that shares data with other processes is a cooperating process.
 There are several reasons for providing an environment that allows process cooperation:
 Information sharing: Since several users may be interested in the same piece of information (for
instance, a shared file), we must provide an environment to allow concurrent access to such
information.
 Computation speedup: If we want a particular task to run faster, we must break it into subtasks, each
of which will be executing in parallel with the others. Notice that such a speedup can be achieved
only if the computer has multiple processing elements (such as CPUs or I/O channels).
 Modularity: We may want to construct the system in a modular fashion, dividing the system functions
into separate processes or threads.
13
 Convenience: Even an individual user may work on many tasks at the same time. For instance, a user may
be editing, printing, and compiling in parallel.
 Cooperating processes require an Interprocess communication (IPC) mechanism that will allow them to
exchange data and information.
 There are two fundamental models of Interprocess communication: (1) shared memory and (2) message
passing.
 In the shared-memory model, a region of memory that is shared by cooperating processes is established.
Processes can then exchange information by reading and writing data to the shared region.
 In the message passing model, communication takes place by means of messages exchanged between the
cooperating processes. The two communications models are contrasted in Figure 3.13 below.
 Both of the models just discussed are common in operating systems, and many systems implement both.
 Message passing is useful for exchanging smaller amounts of data, because no conflicts need be avoided.
 Message passing is also easier to implement than is shared memory for inter computer communication.
 Shared memory allows maximum speed and convenience of communication. Shared memory is faster than
message passing, as message passing systems are typically implemented using system calls and thus
require the more time-consuming task of kernel intervention.
 In contrast, in shared memory systems, system calls are required only to establish shared-memory regions.
Once shared memory is established, all accesses are treated as routine memory accesses, and no assistance
from the kernel is required.
14
15

More Related Content

PPT
Process management in os
PDF
CS6401 OPERATING SYSTEMS Unit 2
PPTX
Os unit 3 , process management
PPTX
Operating Systems - Processor Management
PPT
Chapter 8 - Main Memory
PDF
6 cpu scheduling
PDF
Unit II - 3 - Operating System - Process Synchronization
Process management in os
CS6401 OPERATING SYSTEMS Unit 2
Os unit 3 , process management
Operating Systems - Processor Management
Chapter 8 - Main Memory
6 cpu scheduling
Unit II - 3 - Operating System - Process Synchronization

What's hot (20)

PPTX
contiguous memory allocation.pptx
PPTX
Memory Management in OS
PPT
Introduction to System Calls
PPT
Os Threads
PDF
OS - Process Concepts
PPTX
Context switching
PPTX
Operating system memory management
PPT
Memory management
PPTX
Computer architecture virtual memory
PPTX
Inter Process Communication
PDF
operating system structure
PDF
Distributed Operating System_1
PPTX
Operating System Operations ppt.pptx
PPTX
Assemblers
PPTX
Operating system architecture
PPTX
CPU Scheduling in OS Presentation
PPTX
Evolution of operating system
PPT
Memory Management in OS
PPTX
Operating system critical section
PPTX
Concurrency
contiguous memory allocation.pptx
Memory Management in OS
Introduction to System Calls
Os Threads
OS - Process Concepts
Context switching
Operating system memory management
Memory management
Computer architecture virtual memory
Inter Process Communication
operating system structure
Distributed Operating System_1
Operating System Operations ppt.pptx
Assemblers
Operating system architecture
CPU Scheduling in OS Presentation
Evolution of operating system
Memory Management in OS
Operating system critical section
Concurrency
Ad

Similar to Operating system - Process and its concepts (20)

PPT
operating system for computer engineering ch3.ppt
PPTX
2Chapter Two- Process Management(2) (1).pptx
PPT
Lecture5
PPTX
Operating system Chapter 3 Part-1 process and threads.pptx
PPTX
Process and thread Management Operating system
PPT
Ch2_Processes_and_process_management_1.ppt
PPT
Lecture 8 9 process_concept
PDF
Chapter 3.pdf
PPTX
OS (1).pptx
PPTX
Operating Systems Process Management.pptx
DOCX
BITS 1213 - OPERATING SYSTEM (PROCESS,THREAD,SYMMETRIC MULTIPROCESSOR,MICROKE...
PDF
Module 2 - PPT.pdfModule 2 - PPT.pdfModule 2 - PPT.pdfModule 2 - PPT.pdfModul...
PPTX
Lecture 2 process
PPTX
381CCS_CHAPTER3_UPDATED king Khalid .pptx
DOCX
CHAPTER READING TASK OPERATING SYSTEM
PPT
OSLec 4& 5(Processesinoperatingsystem).ppt
PDF
Operating System-2 by Adi.pdf
PDF
Operating System-2_Process Managementby_Adi.pdf
DOC
Operating Systems Unit Two - Fourth Semester - Engineering
operating system for computer engineering ch3.ppt
2Chapter Two- Process Management(2) (1).pptx
Lecture5
Operating system Chapter 3 Part-1 process and threads.pptx
Process and thread Management Operating system
Ch2_Processes_and_process_management_1.ppt
Lecture 8 9 process_concept
Chapter 3.pdf
OS (1).pptx
Operating Systems Process Management.pptx
BITS 1213 - OPERATING SYSTEM (PROCESS,THREAD,SYMMETRIC MULTIPROCESSOR,MICROKE...
Module 2 - PPT.pdfModule 2 - PPT.pdfModule 2 - PPT.pdfModule 2 - PPT.pdfModul...
Lecture 2 process
381CCS_CHAPTER3_UPDATED king Khalid .pptx
CHAPTER READING TASK OPERATING SYSTEM
OSLec 4& 5(Processesinoperatingsystem).ppt
Operating System-2 by Adi.pdf
Operating System-2_Process Managementby_Adi.pdf
Operating Systems Unit Two - Fourth Semester - Engineering
Ad

More from Karan Thakkar (7)

PDF
Wt module 2
DOCX
PDF
Theory of Computer Science - Post Correspondence Problem
PDF
Working principle of Turing machine
PDF
Turing machine
PPTX
Microcontoller and Embedded System
PPTX
Search Engine Optimization
Wt module 2
Theory of Computer Science - Post Correspondence Problem
Working principle of Turing machine
Turing machine
Microcontoller and Embedded System
Search Engine Optimization

Recently uploaded (20)

PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PDF
Model Code of Practice - Construction Work - 21102022 .pdf
PPTX
Internet of Things (IOT) - A guide to understanding
PPTX
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
DOCX
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
PPTX
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
PPTX
web development for engineering and engineering
PDF
Digital Logic Computer Design lecture notes
PDF
composite construction of structures.pdf
PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PPTX
Lecture Notes Electrical Wiring System Components
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PDF
Well-logging-methods_new................
PPTX
Lesson 3_Tessellation.pptx finite Mathematics
PPT
Mechanical Engineering MATERIALS Selection
PPTX
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
PDF
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
PDF
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
PPTX
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
Model Code of Practice - Construction Work - 21102022 .pdf
Internet of Things (IOT) - A guide to understanding
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
web development for engineering and engineering
Digital Logic Computer Design lecture notes
composite construction of structures.pdf
UNIT-1 - COAL BASED THERMAL POWER PLANTS
Lecture Notes Electrical Wiring System Components
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
Well-logging-methods_new................
Lesson 3_Tessellation.pptx finite Mathematics
Mechanical Engineering MATERIALS Selection
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx

Operating system - Process and its concepts

  • 2.  A process can be thought of as a program in execution.  A process will need certain resources-such as CPU time, memory, files, and I/O devices-to accomplish its task.  These resources are allocated to the process either when it is created or while it is executing.  A process is the unit of work in most systems.  Systems consist of a collection of processes: Operating-system processes execute system code, and user processes execute user code. All these processes may execute concurrently.  Although traditionally a process contained only a single thread of control as it ran, most modem operating systems now support processes that have multiple threads.  The operating system is responsible for the following activities in connection with process and thread management: the creation and deletion of both user and system processes; the scheduling of processes; and the provision of mechanisms for synchronization, communication and deadlock handling for processes. 2
  • 3.  Informally, as mentioned earlier, a process is a program in execution. A process is more than the program code, which is sometimes known as the text section. It also includes the current activity, as represented by the value of the program counter and the contents of the processor's registers.  A process generally also includes the process stack, which contains temporary data (such as function parameters, return addresses, and local variables), and a data section, which contains global variables.  A process may also include a heap, which is memory that is dynamically allocated during process run time.  The structure of a process in memory is shown in Figure 3.1.  We emphasize that a program by itself is not a process; a program is a passive entity, such as a file containing a list of instructions stored on disk (often called an executable file), whereas a process is an active entity, with a program counter specifying the next instruction to execute and a set of associated resources.  A program becomes a process when an executable file is loaded into memory.  Two common techniques for loading executable files are double-clicking an icon representing the executable file and entering the name of the executable file on the command line (as in prog. exe or a. out.). 3
  • 4. 4
  • 5.  As a process executes, it changes state. The state of a process is defined in part by the current activity of that process. Each process may be in one of the following states:  New: The process is being created.  Running: Instructions are being executed.  Waiting: The process is waiting for some event to occur (such as an I/O completion or reception of a signal).  Ready: The process is waiting to be assigned to a processor.  Terminated: The process has finished execution.  These names are arbitrary, and they vary across operating systems. The states that they represent are found on all systems, however. Certain operating systems also more finely delineate process states. It is important to realize that only one process can be running on any processor at any instant. Many processes may be ready and waiting, however. The state diagram corresponding to these states is presented in Figure 3.2. 5
  • 6. 6
  • 7.  Each process is represented in the operating system by a process control block (PBC) also called a task control block. A PCB is shown in Figure 3.3. It contains many pieces of information with a specific process, including these:  Process state: The state may be new, ready running, waiting, halted, and so on.  Program counter: The counter indicates the address of the next instruction to be executed for this process.  CPU registers: The registers vary in number and type, depending on the computer architecture. They include accumulators, index registers, stack pointers, and general-purpose registers, plus any condition- code information. Along with the program counter, this state information must be saved when an interrupt occurs, to allow the process to be continued correctly afterward (Figure 3.4).  CPU-scheduling information: This information includes a process priority, pointers to scheduling queues, and any other scheduling parameters.  Memory-management information: This information may include such information as the value of the base and limit registers, the page tables, or the segment tables, depending on the memory system used by the operating system.  Accounting information: This information includes the amount of CPU and real time used, time limits, account numbers, job or process numbers, and so on.  I/O status information: This information includes the list of I/O devices allocated to the process, a list of open files, and so on.  In brief the PCB simply serves as the repository for any information that may vary from process to process. 7
  • 8. 8
  • 9.  A process is a program that performs a single thread of execution.  For example, when a process is running a word-processor program, a single thread of instructions is being executed.  This single thread of control allows the process to perform only one task at one time.  The user cannot simultaneously type in characters and run the spell checker within the same process, for example.  Many modern operating systems have extended the process concept to allow a process to have multiple threads of execution and thus to perform more than one task at a time.  On a system that supports threads, the PCB is expanded to include information for each thread. Other changes throughout the system are also needed to support threads. 9
  • 10.  Interrupts cause the operating system to change a CPU from its current task and to run a kernel routine.  Such operations happen frequently on general-purpose systems.  When an interrupt occurs, the system needs to save the current context of the process running on the CPU so that it can restore that context when its processing is done, essentially suspending the process and then resuming it.  The context is represented in the PCB of the process; it includes the value of the CPU registers, the process state (see Figure 3.2), and memory-management information.  Generically, we perform a save state of the current state of the CPU, be it in kernel or user mode, and then a state restore to resume operations.  Switching the CPU to another process requires performing a state save of the current process and a state restore of a different process.  This task is known as Context Switch.  When a context switch occurs, the kernel saves the context of the old process in its PCB and loads the saved context of the new process scheduled to run.  Context-switch time is pure overhead, because the system does no useful work while switching.  Its speed varies from machine to machine, depending on the memory speed, the number of registers that must be copied, and the existence of special instructions (such as a single instruction to load or store all registers). 10
  • 11.  Typical speeds are a few milliseconds. Context-switch times are highly dependent on hardware support.  For instance, some processors (such as the Sun UltraSPARC) provide multiple sets of registers.  A context switch here simply requires changing the pointer to the current register set.  Of course, if there are more active processes than there are register sets, the system resorts to copying register data to and from memory, as before.  Also, the more complex the operating system, the more work must be done during a context switch.  Advanced memory-management techniques may require extra data to be switched with each context.  For instance, the address space of the current process must be preserved as the space of the next task is prepared for use.  How the address space is preserved, and what amount of work is needed to preserve it, depend on the memory-management method of the operating system. 11
  • 12. 12
  • 13.  Processes executing concurrently in the operating system may be either independent processes or cooperating processes.  A process is independent if it cannot affect or be affected by the other processes executing in the system.  Any process that does not share data with any other process is independent.  A process is cooperating if it can affect or be affected by the other processes executing in the system.  Clearly, any process that shares data with other processes is a cooperating process.  There are several reasons for providing an environment that allows process cooperation:  Information sharing: Since several users may be interested in the same piece of information (for instance, a shared file), we must provide an environment to allow concurrent access to such information.  Computation speedup: If we want a particular task to run faster, we must break it into subtasks, each of which will be executing in parallel with the others. Notice that such a speedup can be achieved only if the computer has multiple processing elements (such as CPUs or I/O channels).  Modularity: We may want to construct the system in a modular fashion, dividing the system functions into separate processes or threads. 13
  • 14.  Convenience: Even an individual user may work on many tasks at the same time. For instance, a user may be editing, printing, and compiling in parallel.  Cooperating processes require an Interprocess communication (IPC) mechanism that will allow them to exchange data and information.  There are two fundamental models of Interprocess communication: (1) shared memory and (2) message passing.  In the shared-memory model, a region of memory that is shared by cooperating processes is established. Processes can then exchange information by reading and writing data to the shared region.  In the message passing model, communication takes place by means of messages exchanged between the cooperating processes. The two communications models are contrasted in Figure 3.13 below.  Both of the models just discussed are common in operating systems, and many systems implement both.  Message passing is useful for exchanging smaller amounts of data, because no conflicts need be avoided.  Message passing is also easier to implement than is shared memory for inter computer communication.  Shared memory allows maximum speed and convenience of communication. Shared memory is faster than message passing, as message passing systems are typically implemented using system calls and thus require the more time-consuming task of kernel intervention.  In contrast, in shared memory systems, system calls are required only to establish shared-memory regions. Once shared memory is established, all accesses are treated as routine memory accesses, and no assistance from the kernel is required. 14
  • 15. 15