The document discusses process management in operating systems. It defines a process as a program in execution and describes the key requirements for an OS in managing processes, including allocating resources, interleaving process execution, and supporting process creation and interprocess communication. The document outlines the major topics to be covered, including process states, creation/termination, the five-state process model, process control blocks (PCBs), and process control functions in Unix System V. It provides details on process states, transitions between states, and the role of PCBs in tracking process information and controlling execution.
This document discusses processes and process management. It covers key concepts like process states, process scheduling, and inter-process communication. The main points covered are:
- A process is a program in execution that needs resources like CPU time, memory, and I/O devices. The operating system is responsible for process management tasks like creation, scheduling, and synchronization.
- Processes go through various states like new, ready, running, waiting, and terminated. Each process is represented by a process control block containing its state and resource allocation information.
- The CPU scheduler selects processes from ready queues to load into memory and execute. Scheduling algorithms aim to maximize CPU usage and provide fair access to processes.
Operating Systems Unit Two - Fourth Semester - EngineeringYogesh Santhan
This document discusses processes and process management in operating systems. It defines a process as a program in execution that includes the program code, processor registers, and program counter. Processes can be in various states like running, ready, waiting, terminated. Each process is represented by a process control block that contains its state and other details. The document discusses process scheduling, context switching between processes, and operations on processes like creation, execution and termination. It also describes cooperating processes that can share resources and affect each other's states.
My ppt @ bec doms on process managementBabasab Patil
The document discusses process management in operating systems. It covers key topics such as process states (running, ready, blocked), process creation and termination, process description including process control blocks containing information like process ID and state, and queuing disciplines for scheduling processes. Memory, I/O, and file tables are used to manage resources for processes. Process states include new, running, ready, blocked, and exit and processes transition between these states.
My ppt @ bec doms on process managementBabasab Patil
The document discusses process management from an operating system perspective. It covers key topics such as:
1. Process states (running, ready, blocked), and the different states processes can be in.
2. Process description including the process control block and tables used by the operating system to manage processes and resources.
3. Process lifecycle functions such as creation, termination, suspension and scheduling performed by the operating system process manager.
4. Differences between processes and threads, and how threads are implemented on various operating systems.
UNIT II PROCESS MANAGEMENT
Processes – Process Concept, Process Scheduling, Operations on Processes, Inter-process Communication; CPU Scheduling – Scheduling criteria, Scheduling algorithms, Multiple-processor scheduling, Real time scheduling; Threads- Overview, Multithreading models, Threading issues; Process Synchronization – The critical-section problem, Synchronization hardware, Mutex locks, Semaphores, Classic problems of synchronization, Critical regions, Monitors; Deadlock – System model, Deadlock characterization, Methods for handling deadlocks, Deadlock prevention, Deadlock avoidance, Deadlock detection, Recovery from deadlock.
UNIT II PROCESS MANAGEMENT
Processes-Process Concept, Process Scheduling, Operations on Processes, Interprocess Communication; Threads- Overview, Multicore Programming, Multithreading Models; Windows 7 - Thread and SMP Management. Process Synchronization - Critical Section Problem, Mutex Locks, Semophores, Monitors; CPU Scheduling and Deadlocks.
The document discusses processes and threads in an operating system. It defines a process as an instance of a program running in memory that contains sections like the stack, heap, text, and data. A program becomes a process when it is loaded into memory and executed. Threads are lightweight processes that share memory and resources with other threads in the same process. The document compares processes and threads, describing threads as having lower overhead since they can communicate through shared memory rather than system calls. It also discusses process states, process control blocks (PCB), and reasons for using multithreading like improving server efficiency.
The document discusses operating systems and processes. It defines an operating system as an interface between the user and computer hardware that manages system resources efficiently. Processes are programs in execution that are represented in memory by a process control block containing information like state, registers, scheduling details. Processes go through states like new, running, waiting, ready and terminated. The document also discusses process creation, termination, and context switching between processes.
This document discusses processes and process management. It covers key concepts like process states, process scheduling, and inter-process communication. The main points covered are:
- A process is a program in execution that needs resources like CPU time, memory, and I/O devices. The operating system is responsible for process management tasks like creation, scheduling, and synchronization.
- Processes go through various states like new, ready, running, waiting, and terminated. Each process is represented by a process control block containing its state and resource allocation information.
- The CPU scheduler selects processes from ready queues to load into memory and execute. Scheduling algorithms aim to maximize CPU usage and provide fair access to processes.
Operating Systems Unit Two - Fourth Semester - EngineeringYogesh Santhan
This document discusses processes and process management in operating systems. It defines a process as a program in execution that includes the program code, processor registers, and program counter. Processes can be in various states like running, ready, waiting, terminated. Each process is represented by a process control block that contains its state and other details. The document discusses process scheduling, context switching between processes, and operations on processes like creation, execution and termination. It also describes cooperating processes that can share resources and affect each other's states.
My ppt @ bec doms on process managementBabasab Patil
The document discusses process management in operating systems. It covers key topics such as process states (running, ready, blocked), process creation and termination, process description including process control blocks containing information like process ID and state, and queuing disciplines for scheduling processes. Memory, I/O, and file tables are used to manage resources for processes. Process states include new, running, ready, blocked, and exit and processes transition between these states.
My ppt @ bec doms on process managementBabasab Patil
The document discusses process management from an operating system perspective. It covers key topics such as:
1. Process states (running, ready, blocked), and the different states processes can be in.
2. Process description including the process control block and tables used by the operating system to manage processes and resources.
3. Process lifecycle functions such as creation, termination, suspension and scheduling performed by the operating system process manager.
4. Differences between processes and threads, and how threads are implemented on various operating systems.
UNIT II PROCESS MANAGEMENT
Processes – Process Concept, Process Scheduling, Operations on Processes, Inter-process Communication; CPU Scheduling – Scheduling criteria, Scheduling algorithms, Multiple-processor scheduling, Real time scheduling; Threads- Overview, Multithreading models, Threading issues; Process Synchronization – The critical-section problem, Synchronization hardware, Mutex locks, Semaphores, Classic problems of synchronization, Critical regions, Monitors; Deadlock – System model, Deadlock characterization, Methods for handling deadlocks, Deadlock prevention, Deadlock avoidance, Deadlock detection, Recovery from deadlock.
UNIT II PROCESS MANAGEMENT
Processes-Process Concept, Process Scheduling, Operations on Processes, Interprocess Communication; Threads- Overview, Multicore Programming, Multithreading Models; Windows 7 - Thread and SMP Management. Process Synchronization - Critical Section Problem, Mutex Locks, Semophores, Monitors; CPU Scheduling and Deadlocks.
The document discusses processes and threads in an operating system. It defines a process as an instance of a program running in memory that contains sections like the stack, heap, text, and data. A program becomes a process when it is loaded into memory and executed. Threads are lightweight processes that share memory and resources with other threads in the same process. The document compares processes and threads, describing threads as having lower overhead since they can communicate through shared memory rather than system calls. It also discusses process states, process control blocks (PCB), and reasons for using multithreading like improving server efficiency.
The document discusses operating systems and processes. It defines an operating system as an interface between the user and computer hardware that manages system resources efficiently. Processes are programs in execution that are represented in memory by a process control block containing information like state, registers, scheduling details. Processes go through states like new, running, waiting, ready and terminated. The document also discusses process creation, termination, and context switching between processes.
The document discusses operating system concepts including process management, storage management, and virtual memory. It defines an operating system as software that manages hardware and other software. It describes key OS components like the memory manager, processor manager, and file manager. It also covers OS functions like resource allocation, program execution, I/O operations, and error detection. Process management involves scheduling processes in different states like ready, running, waiting. Virtual memory uses paging to store processes across main memory and disk.
In the given presentation, process overview,process management scheduling typesand some more basic concepts were explained.
Kindly refere the presentation.
The document discusses operating systems and processes. It defines an operating system as an interface between the user and computer hardware that manages system resources efficiently. Processes are programs in execution that are represented in memory by a process control block containing information like state, registers, scheduling details. Processes go through various states like running, ready, waiting and terminated. The document also describes process creation, termination, and context switching between processes.
The document discusses process management and CPU scheduling in operating systems. It defines what a process is, describes process states and control blocks. It covers topics like process creation, termination, scheduling queues, and context switching. Different types of schedulers like long-term, short-term, and medium-term schedulers are explained along with operations on processes like creation, termination and waiting states.
The document discusses operating system services and functions. It describes that an operating system manages computer resources, provides services for programmers, and schedules program execution. It then lists and describes key operating system services like program creation, execution, I/O access, file access, error handling, and accounting. The document also discusses how the operating system acts as a resource manager and describes common types of operating systems, scheduling, memory management techniques like swapping and paging, and how logical addresses are mapped to physical addresses.
OPERATING SYSTEM BY DR .MUGABO MG MKAMAMugabo Mkama
The document discusses operating system concepts including process management, storage management, and I/O management. It describes key components of an operating system like the kernel, shell, and memory manager. It explains how the operating system allocates memory and storage, schedules processes using techniques like paging and swapping, and manages I/O. Process states like ready, running, waiting, and terminated are also defined.
This document discusses key concepts related to processes in operating systems, including:
- Processes have states like ready, running, waiting, and terminated as they execute.
- A process control block (PCB) stores process state and scheduling information.
- Process scheduling involves long-term, short-term, and sometimes medium-term schedulers to allocate processes to the CPU.
- Context switching saves and restores process states when the CPU switches between processes. Inter-process communication allows processes to synchronize and exchange messages.
A system consists of processes that execute system code or user code. An operating system makes a computer more productive by switching the CPU between processes. A process is a program in execution that has a program counter, stack, data section, and state. The operating system manages processes using process control blocks and by moving processes between scheduling queues. Context switching allows the CPU to save and load process states when switching between processes.
The document discusses processes and threads in an operating system. It defines a process as the basic unit of work that includes instructions, data, and resources. Key points include:
- Processes have states like ready, running, waiting. The OS manages processes through system calls for creation, termination, suspension, and more.
- Threads are lightweight processes that share resources within a process and allow for concurrency. Thread switching is faster than process switching.
- The OS maintains process information in a process control block and switches between processes and threads through context switching.
This document provides an overview of operating system processes. It discusses what a process is, how process memory is divided, the different states a process can be in (new, running, waiting, ready, suspended, terminated), and the process control block that contains information about each process. It also covers process scheduling, including different scheduling categories (preemptive and non-preemptive), the scheduling queues, and types of schedulers (long term, short term, medium term). Additionally, it discusses context switching, process creation and termination, and the different times associated with processes like arrival time, burst time, completion time, turnaround time, waiting time, and response time.
The operating system manages processes and resources. A process is a program in execution that requires computer resources. There may be multiple processes requiring the same resource at the same time. The operating system schedules processes, creates and deletes processes, and handles process synchronization and communication. Processes can be in one of five states: new, ready, running, waiting, or terminated. The operating system uses a process control block to store attributes of each process like its ID, state, priority, registers, open files, and accounting information to manage switching between processes.
The document discusses processes and interprocess communication. Some key points:
- A process is a program in execution that includes the program code, stack, data, and other resources. Each process is represented by a process control block (PCB).
- Processes can be created and terminated through system calls. They communicate through either shared memory or message passing.
- The operating system schedules processes between ready, running, waiting, and other states using queues and schedulers like short-term and long-term schedulers. Context switches occur when changing the running process.
The document discusses operating systems and processes. It defines an operating system as software that controls hardware and manages resources. A process is a program in execution that has a unique ID and state. Processes go through various states like running, ready, blocked/waiting, and terminated. Threads are lightweight processes that can be scheduled independently and share resources within a process. User-level threads are managed in libraries while kernel-level threads are managed by the operating system kernel.
The document discusses operating systems and processes. It defines an operating system as software that controls hardware and manages resources. A process is a program in execution that has a unique ID and state. Processes go through various states like running, ready, blocked/waiting, and terminated. Threads are lightweight processes that can be scheduled independently and share resources within a process. User-level threads are managed in libraries while kernel-level threads are managed by the operating system kernel.
This document discusses processes and inter-process communication. It begins by defining processes and describing their components like code, data, and stack. Process states like running, waiting, and terminated are explained. Context switching and process scheduling are also covered. The document then discusses inter-process communication using shared memory and message passing. It provides examples of IPC in POSIX and Windows. Finally, it describes communication in client-server systems using sockets and remote procedure calls.
This document contains two sample question papers for an Operating Systems exam for a 4th semester BTech course in IT/CSE. Each paper has three sections - Section A contains 10 short answer questions worth 2 marks each, Section B contains 4 long answer questions worth 5 marks each, and Section C contains 2 long answer questions worth 10 marks each. The questions cover topics like virtual memory, processes, threads, CPU scheduling algorithms, deadlocks, memory management techniques like paging, segmentation, swapping etc.
Chapter 1 Introduction to Operating System ConceptsMeenalJabde
The document provides an overview of operating systems including:
- The definition of an operating system as a program that controls hardware and acts as an interface between users and computers.
- The key functions of operating systems including providing convenience, efficiency, and ability to evolve.
- Concepts such as processes, process states, process control blocks, and system calls. It describes what they are and their purpose.
- A brief history of operating systems from first to fourth generation systems.
- The main types of operating systems including batch, time-sharing, distributed, network, and real-time operating systems.
- Common services offered by most operating systems such as user interface, program execution, file
Here are 15 numbered sheets of paper with my name and today's date as requested:
1. John Doe, January 1, 2023
2. John Doe, January 1, 2023
3. John Doe, January 1, 2023
4. John Doe, January 1, 2023
5. John Doe, January 1, 2023
6. John Doe, January 1, 2023
7. John Doe, January 1, 2023
8. John Doe, January 1, 2023
9. John Doe, January 1, 2023
10. John Doe, January 1, 2023
11. John Doe, January 1, 2023
An operating system manages computer hardware and provides an environment for application programs to run. It acts as an interface between the computer and user, providing graphical or command line interfaces. There are different types of operating systems like real-time, distributed, and embedded operating systems. Key components of an operating system include the kernel, which manages system resources, and processes, which the operating system schedules. Memory, storage, security, and input/output management are also important operating system functions. Popular operating systems include Linux, a free and open-source UNIX-like system, and Windows XP, designed by Microsoft.
The document discusses operating system concepts including process management, storage management, and virtual memory. It defines an operating system as software that manages hardware and other software. It describes key OS components like the memory manager, processor manager, and file manager. It also covers OS functions like resource allocation, program execution, I/O operations, and error detection. Process management involves scheduling processes in different states like ready, running, waiting. Virtual memory uses paging to store processes across main memory and disk.
In the given presentation, process overview,process management scheduling typesand some more basic concepts were explained.
Kindly refere the presentation.
The document discusses operating systems and processes. It defines an operating system as an interface between the user and computer hardware that manages system resources efficiently. Processes are programs in execution that are represented in memory by a process control block containing information like state, registers, scheduling details. Processes go through various states like running, ready, waiting and terminated. The document also describes process creation, termination, and context switching between processes.
The document discusses process management and CPU scheduling in operating systems. It defines what a process is, describes process states and control blocks. It covers topics like process creation, termination, scheduling queues, and context switching. Different types of schedulers like long-term, short-term, and medium-term schedulers are explained along with operations on processes like creation, termination and waiting states.
The document discusses operating system services and functions. It describes that an operating system manages computer resources, provides services for programmers, and schedules program execution. It then lists and describes key operating system services like program creation, execution, I/O access, file access, error handling, and accounting. The document also discusses how the operating system acts as a resource manager and describes common types of operating systems, scheduling, memory management techniques like swapping and paging, and how logical addresses are mapped to physical addresses.
OPERATING SYSTEM BY DR .MUGABO MG MKAMAMugabo Mkama
The document discusses operating system concepts including process management, storage management, and I/O management. It describes key components of an operating system like the kernel, shell, and memory manager. It explains how the operating system allocates memory and storage, schedules processes using techniques like paging and swapping, and manages I/O. Process states like ready, running, waiting, and terminated are also defined.
This document discusses key concepts related to processes in operating systems, including:
- Processes have states like ready, running, waiting, and terminated as they execute.
- A process control block (PCB) stores process state and scheduling information.
- Process scheduling involves long-term, short-term, and sometimes medium-term schedulers to allocate processes to the CPU.
- Context switching saves and restores process states when the CPU switches between processes. Inter-process communication allows processes to synchronize and exchange messages.
A system consists of processes that execute system code or user code. An operating system makes a computer more productive by switching the CPU between processes. A process is a program in execution that has a program counter, stack, data section, and state. The operating system manages processes using process control blocks and by moving processes between scheduling queues. Context switching allows the CPU to save and load process states when switching between processes.
The document discusses processes and threads in an operating system. It defines a process as the basic unit of work that includes instructions, data, and resources. Key points include:
- Processes have states like ready, running, waiting. The OS manages processes through system calls for creation, termination, suspension, and more.
- Threads are lightweight processes that share resources within a process and allow for concurrency. Thread switching is faster than process switching.
- The OS maintains process information in a process control block and switches between processes and threads through context switching.
This document provides an overview of operating system processes. It discusses what a process is, how process memory is divided, the different states a process can be in (new, running, waiting, ready, suspended, terminated), and the process control block that contains information about each process. It also covers process scheduling, including different scheduling categories (preemptive and non-preemptive), the scheduling queues, and types of schedulers (long term, short term, medium term). Additionally, it discusses context switching, process creation and termination, and the different times associated with processes like arrival time, burst time, completion time, turnaround time, waiting time, and response time.
The operating system manages processes and resources. A process is a program in execution that requires computer resources. There may be multiple processes requiring the same resource at the same time. The operating system schedules processes, creates and deletes processes, and handles process synchronization and communication. Processes can be in one of five states: new, ready, running, waiting, or terminated. The operating system uses a process control block to store attributes of each process like its ID, state, priority, registers, open files, and accounting information to manage switching between processes.
The document discusses processes and interprocess communication. Some key points:
- A process is a program in execution that includes the program code, stack, data, and other resources. Each process is represented by a process control block (PCB).
- Processes can be created and terminated through system calls. They communicate through either shared memory or message passing.
- The operating system schedules processes between ready, running, waiting, and other states using queues and schedulers like short-term and long-term schedulers. Context switches occur when changing the running process.
The document discusses operating systems and processes. It defines an operating system as software that controls hardware and manages resources. A process is a program in execution that has a unique ID and state. Processes go through various states like running, ready, blocked/waiting, and terminated. Threads are lightweight processes that can be scheduled independently and share resources within a process. User-level threads are managed in libraries while kernel-level threads are managed by the operating system kernel.
The document discusses operating systems and processes. It defines an operating system as software that controls hardware and manages resources. A process is a program in execution that has a unique ID and state. Processes go through various states like running, ready, blocked/waiting, and terminated. Threads are lightweight processes that can be scheduled independently and share resources within a process. User-level threads are managed in libraries while kernel-level threads are managed by the operating system kernel.
This document discusses processes and inter-process communication. It begins by defining processes and describing their components like code, data, and stack. Process states like running, waiting, and terminated are explained. Context switching and process scheduling are also covered. The document then discusses inter-process communication using shared memory and message passing. It provides examples of IPC in POSIX and Windows. Finally, it describes communication in client-server systems using sockets and remote procedure calls.
This document contains two sample question papers for an Operating Systems exam for a 4th semester BTech course in IT/CSE. Each paper has three sections - Section A contains 10 short answer questions worth 2 marks each, Section B contains 4 long answer questions worth 5 marks each, and Section C contains 2 long answer questions worth 10 marks each. The questions cover topics like virtual memory, processes, threads, CPU scheduling algorithms, deadlocks, memory management techniques like paging, segmentation, swapping etc.
Chapter 1 Introduction to Operating System ConceptsMeenalJabde
The document provides an overview of operating systems including:
- The definition of an operating system as a program that controls hardware and acts as an interface between users and computers.
- The key functions of operating systems including providing convenience, efficiency, and ability to evolve.
- Concepts such as processes, process states, process control blocks, and system calls. It describes what they are and their purpose.
- A brief history of operating systems from first to fourth generation systems.
- The main types of operating systems including batch, time-sharing, distributed, network, and real-time operating systems.
- Common services offered by most operating systems such as user interface, program execution, file
Here are 15 numbered sheets of paper with my name and today's date as requested:
1. John Doe, January 1, 2023
2. John Doe, January 1, 2023
3. John Doe, January 1, 2023
4. John Doe, January 1, 2023
5. John Doe, January 1, 2023
6. John Doe, January 1, 2023
7. John Doe, January 1, 2023
8. John Doe, January 1, 2023
9. John Doe, January 1, 2023
10. John Doe, January 1, 2023
11. John Doe, January 1, 2023
An operating system manages computer hardware and provides an environment for application programs to run. It acts as an interface between the computer and user, providing graphical or command line interfaces. There are different types of operating systems like real-time, distributed, and embedded operating systems. Key components of an operating system include the kernel, which manages system resources, and processes, which the operating system schedules. Memory, storage, security, and input/output management are also important operating system functions. Popular operating systems include Linux, a free and open-source UNIX-like system, and Windows XP, designed by Microsoft.
Similar to process control block ppt in operating system (20)
"IOS 18 CONTROL CENTRE REVAMP STREAMLINED IPHONE SHUTDOWN MADE EASIER"Emmanuel Onwumere
In iOS 18, Apple has introduced a significant revamp to the Control Centre, making it more intuitive and user-friendly. One of the standout features is a quicker and more accessible way to shut down your iPhone. This enhancement aims to streamline the user experience, allowing for faster access to essential functions. Discover how iOS 18's redesigned Control Centre can simplify your daily interactions with your iPhone, bringing convenience right at your fingertips.
2. B.Ramamurthy 1/11/2024 2
Introduction
The fundamental task of any operating system is
process management.
OS must allocate resources to processes, enable
sharing of information, protect resources, and
enable synchronization among processes.
In many modern OS the problems of process
management is compounded by introduction of
threads.
We will process management in this chapter and
threads in the next.
3. B.Ramamurthy 1/11/2024 3
Topics for discussion
Requirement of process
Process states
Creation, termination and suspension
Five State Model
Process Control Block (PCB)
Process control
Unix System V
Summary
4. B.Ramamurthy 1/11/2024 4
What is a process?
A process is simply a program in execution: an instance of a
program execution.
Unit of work individually schedulable by an operating system.
OS keeps track of all the active processes and allocates system
resources to them according to policies devised to meet design
performance objectives.
To meet process requirements OS must maintain many data
structures efficiently.
The process abstraction is a fundamental OS means for
management of concurrent program execution. Example:
instances of process co-existing.
5. B.Ramamurthy 1/11/2024 5
Major requirements
OS must interleave the execution of a number of
processes to maximize processor use while
providing reasonable response time.
OS must allocate resources to processes in
conformance with a specific policy. Example: (i)
higher priority, (ii) avoid deadlock.
Support user creation of processes and IPC both of
which may aid in the structuring of applications.
Reading assignment: pages 101-105 including
“two state process model”
6. B.Ramamurthy 1/11/2024 6
Process creation
Four common events that lead to a process
creation are:
1) When a new batch-job is presented for execution.
2) When an interactive user logs in.
3) When OS needs to perform an operation (usually
IO) on behalf of a user process, concurrently with
that process.
4) To exploit parallelism an user process can spawn a
number of processes.
==> concept of parent and child processes.
7. B.Ramamurthy 1/11/2024 7
Termination of a process
Normal completion, time limit exceeded, memory
unavailable
Bounds violation, protection error, arithmetic error, invalid
instruction
IO failure, Operator intervention, parent termination,
parent request
A number of other conditions are possible.
Segmentation fault : usually happens when you try
write/read into/from a non-existent array/structure/object
component. Or access a pointer to a dynamic data before
creating it. (new etc.)
Bus error: Related to function call and return. You have
messed up the stack where the return address or parameters
are stored.
8. B.Ramamurthy 1/11/2024 8
A five-state process model
Five states: New, Ready, Running, Blocked, Exit
New : A process has been created but has not yet been
admitted to the pool of executable processes.
Ready : Processes that are prepared to run if given an
opportunity. That is, they are not waiting on anything
except the CPU availability.
Running: The process that is currently being executed.
(Assume single processor for simplicity.)
Blocked : A process that cannot execute until a specified
event such as an IO completion occurs.
Exit: A process that has been released by OS either after
normal termination or after abnormal termination (error).
9. B.Ramamurthy 1/11/2024 9
State Transition Diagram
NEW READY RUNNING
BLOCKED
EXIT
Admit
Dispatch
Time-out
Release
Event
Wait
Event
Occurs
Think of the conditions under which state transitions may take place.
10. B.Ramamurthy 1/11/2024 10
Queuing model
Event1 Wait
Admit
Ready queue
Dispatch
CPU
Release
Time-out
Event1
Occurs
Event2 Wait
Event2
Occurs
Eventn Wait
Event n
occurs
11. B.Ramamurthy 1/11/2024 11
Process suspension
Many OS are built around (Ready, Running,
Blocked) states. But there is one more state that
may aid in the operation of an OS - suspended
state.
When none of the processes occupying the main
memory is in a Ready state, OS swaps one of the
blocked processes out onto to the Suspend queue.
When a Suspended process is ready to run it
moves into “Ready, Suspend” queue. Thus we
have two more state: Blocked_Suspend,
Ready_Suspend.
12. B.Ramamurthy 1/11/2024 12
Process suspension (contd.)
Blocked_suspend : The process is in the secondary
memory and awaiting an event.
Ready_suspend : The process is in the secondary
memory but is available for execution as soon as it is
loaded into the main memory.
State transition diagram Fig.3.7
Observe on what condition does a state transition take
place? What are the possible state transitions?
13. B.Ramamurthy 1/11/2024 13
State Transition Diagram (take 2)
NEW READY RUNNING
BLOCKED
EXIT
Admit
Dispatch
Time-out
Release
Event
Wait
Event
Occurs
Think of the conditions under which state transitions may take place.
Activate
Suspend
Event occurs
Activate
Suspend
Blocked
Suspend
Ready
Suspend
14. B.Ramamurthy 1/11/2024 14
Process description
OS constructs and maintains tables of information
about each entity that it is managing : memory
tables, IO tables, file tables, process tables.
Process control block: Associated with each
process are a number of attributes used by OS for
process control. This collection is known as PCB.
Process image: Collection of program, data, stack,
and PCB together is known as Process image.
For more details on PCB see Table 3.6
15. B.Ramamurthy 1/11/2024 15
Process control block
Contains three categories of information:
1) Process identification
2) Process state information
3) Process control information
Process identification:
– numeric identifier for the process (pid)
– identifier of the parent (ppid)
– user identifier (uid) - id of the usr responsible
for the process.
16. B.Ramamurthy 1/11/2024 16
Process control block (contd.)
Process state information:
– User visible registers
– Control and status registers : PC, IR, PSW,
interrupt related bits, execution mode.
– Stack pointers
17. B.Ramamurthy 1/11/2024 17
Process control block (contd.)
Process control information:
– Scheduling and state information : Process
state, priority, scheduling-related info., event
awaited.
– Data structuring : pointers to other processes
(PCBs): belong to the same queue, parent of
process, child of process or some other
relationship.
– Interprocess comm: Various flags, signals,
messages may be maintained in PCBs.
18. B.Ramamurthy 1/11/2024 18
Process control block (contd.)
Process control information (contd.)
– Process privileges: access privileges to certain
memory area, critical structures etc.
– Memory management: pointer to the various
memory management data structures.
– Resource ownership : Pointer to resources such
as opened files. Info may be used by scheduler.
PCBs need to be protected from inadvertent
destruction by any routine. So protection of PCBs
is a critical issue in the design of an OS.
19. B.Ramamurthy 1/11/2024 19
OS Functions related to
Processes
Process management: Process creation,
termination, scheduling, dispatching, switching,
synchronization, IPC support, management of
PCBs
Memory management: Allocation of address space
to processes, swapping, page and segment
management.
IO management: Buffer management, allocation
of IO channels and devices to processes.
Support functions: Interrupt handling, accounting,
monitoring.
20. B.Ramamurthy 1/11/2024 20
Modes of execution
Two modes : user mode and a privileged mode called the
kernel mode.
Why? It is necessary to protect the OS and key OS tables
such as PCBs from interference by user programs.
In the kernel mode, the software has complete control of
the processor and all its hardware.
When a user makes a system call or when an interrupt
transfers control to a system routine, an instruction to
change mode is executed. This mode change will result in
an error unless permitted by OS.
21. B.Ramamurthy 1/11/2024 21
Creation of a process
Assign a unique pid to the new process.
Allocate space for all the elements of the
process image. How much?
The process control block is initialized.
Borrow info from parent.
The appropriate linkages are set: for
scheduling, state queues..
Create and initialize other data structures.
22. B.Ramamurthy 1/11/2024 22
Process Interruption
Two kinds of process interruptions: interrupt and
trap.
Interrupt: Caused by some event external to and
asynchronous to the currently running process,
such as completion of IO.
Trap : Error or exception condition generated
within the currently running process. Ex: illegal
access to a file, arithmetic exception.
(supervisor call) : explicit interruption.
23. B.Ramamurthy 1/11/2024 23
Process and Context Switching
Clock interrupt: The OS determines if the time
slice of the currently running process is over, then
switches it to Ready state, and dispatches another
from Ready queue. “Process switch”
Memory fault: (Page fault) A page fault occurs
when the requested program page is not in the
main memory. OS (page fault handler) brings in
the page requested, resumes faulted process.
IO Interrupt : OS determines what IO action
occurred and takes appropriate action.
24. B.Ramamurthy 1/11/2024 24
Process and Context Switching
(contd.)
Process switch: A transition between two memory-
resident processes in a multiprogramming
environment. Study the 7 steps involved in a
process switch.
Context switch: Changing context from a
executing program to an Interrupt Service Routine
(ISR). Part of the context that will be modified by
the ISR needs to be saved. This required context is
saved and restored by hardware as specified by the
ISR.
25. B.Ramamurthy 1/11/2024 25
Process and Context Switching
(contd.)
How many context switch occurs per
process switch?
Typically 1Process switch : 100 context
switches
Process switch of more expensive than
context switch.
Read more on this.
This factor is very important for many
system design projects.
26. B.Ramamurthy 1/11/2024 26
Unix system V
All user processes in the system have as root ancestor
a process called init. When a new interactive user logs
onto the system, init creates a user process,
subsequently this user process can create child
processes and so on. init is created at the boot-time.
Process states : User running , kernel running, Ready
in memory, sleeping in memory (blocked), Ready
swapped (ready-suspended), sleeping swapped
(blocked-suspended), created (new), zombie ,
preempted (used in real-time scheduling).
27. B.Ramamurthy 1/11/2024 27
Unix system V (contd.)
Reading assignment: Fig. 3.15 and
description, Table 3.10, 3.11, 3.12and 3.13.
What does unix process image contain?
What does process table entry contain? proc
What is unix U (user) area? u area
Function of each of these components.
28. B.Ramamurthy 1/11/2024 28
Process and kernel context
User mode
mode
kernel
process context
kernel context
Application pgms system calls
kernel tasks
interrupt services
Kernel acts on behalf of user
29. B.Ramamurthy 1/11/2024 29
Process Context
User address space,
Control information : u area (accessed only
by the running process) and process table
entry (or proc area, accessed by the kernel)
Credentials : UID, GID etc.
Environment variables : inherited from the
parent
30. B.Ramamurthy 1/11/2024 30
U area
Process control block
Pointer to proc structure
Signal handlers related information
Memory management information
Open file descriptor
Vnodes of the current directory
CPU usage stats
Per process kernel stack
31. B.Ramamurthy 1/11/2024 31
Process control
Process creation in unix is by means of the system
call fork().
OS in response to a fork() call:
– Allocate slot in the process table for new
process.
– Assigns unique pid.
– Makes a copy of the process image, except for
the shared memory.
– Move child process to Ready queue.
– it returns pid of the child to the parent, and
a zero value to the child.
32. B.Ramamurthy 1/11/2024 32
Process control (contd.)
All the above are done in the kernel mode in the process
context. When the kernel completes these it does one of the
following as a part of the dispatcher:
– Stay in the parent process. Control returns to the user
mode at the point of the fork call of the parent.
– Transfer control to the child process. The child process
begins executing at the same point in the code as the
parent, at the return from the fork call.
– Transfer control another process leaving both parent
and child in the Ready state.
33. B.Ramamurthy 1/11/2024 33
Process creation - Example
main () {
int pid;
cout << “ just one process so far”<<endl;
pid = fork();
if (pid == 0)
cout <<“im the child “<< endl;
else if (pid > 0)
cout <<“im the parent”<< endl;
else
cout << “fork failed”<< endl;}
34. B.Ramamurthy 1/11/2024 34
fork and exec
Child process may choose to execute some other
program than the parent by using exec call.
Exec overlays a new program on the existing
process.
Child will not return to the old program unless
exec fails. This is an important point to remember.
Why do we need to separate fork and exec? Why
can’t we have a single call that fork a new
program?
35. B.Ramamurthy 1/11/2024 35
Example
if (( result = fork()) == 0 ) {
// child code
if (execv (“new program”,..) < 0)
perror (“execv failed “);
exit(1);
}
else if (result < 0 ) perror (“fork”); …}
/* parent code */
36. B.Ramamurthy 1/11/2024 36
Version of exec
Many versions of exec are offered by C
library
exece
execve
execvp
execl, execle, execlp
This will be explained to you with examples
in this week’s recitation.