SlideShare a Scribd company logo
Introduction
to
Operating Systems - 2
PROF. K. ADISESHA
Process management
Process
management Process Concept
Threads
Process Scheduling
CPU Scheduling Algorithm
Inter process Communication
2
Process management
Introduction
Prof. K. Adisesha (Ph. D)
3
Introduction to Process:
A process is basically a program in execution. The execution of a process must
progress in a sequential fashion.
➢ When a program is loaded into the main memory it becomes a process.
➢ It can be divided into four sections ─
❖ Stack: The process Stack contains the temporary data such as
method/function parameters, return address and local variables
❖ Heap: This is dynamically allocated memory to a process during its run
time
❖ Text: This includes the current activity represented by the value of
Program Counter and the contents of the processor's registers.
❖ Data: This section contains the global and static variables.
Introduction
Prof. K. Adisesha (Ph. D)
4
Process Life Cycle:
When a process executes, it passes through different states. These stages may differ in
different operating systems, and the names of these states are also not standardized.
➢ A process can have one of the following five states at a time.
❖ Start
❖ Ready
❖ Running
❖ Waiting
❖ Terminated or Exit
Introduction
Prof. K. Adisesha (Ph. D)
5
Process Life Cycle:
➢ Start: This is the initial state when a process is first started/created.
➢ Ready: The process is waiting to be assigned to a processor. Ready processes are
waiting to have the processor allocated to them by the OS so that they can run.
➢ 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.
➢ 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.
➢ 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.
Introduction
Prof. K. Adisesha (Ph. D)
6
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.
➢ The PCB is maintained for a process throughout its
lifetime, and is deleted once the process terminates.
Threading
Prof. K. Adisesha (Ph. D)
7
Thread:
A thread is also called a lightweight process. A thread is a flow of execution through
the process code.
➢ A thread shares with its peer threads few information like code segment, data segment and
open files.
➢ Threads provide a way to improve application performance through parallelism.
➢ All threads can share same set of open files, child processes.
➢ Multiple threaded processes use fewer resources.
➢ Threads are implemented in following two ways −
❖ User Level Threads − User managed threads.
❖ Kernel Level Threads − Operating System managed threads acting on kernel, an
operating system core.
Threading
Prof. K. Adisesha (Ph. D)
8
Multithreading Models:
Some operating system provide a combined user level thread and Kernel level thread
facility.
➢ In a combined system, multiple threads within the same application can run in parallel on
multiple processors and a blocking system call need not block the entire process.
➢ Multithreading models are three types
❖ Many to many relationship
❖ Many to one relationship
❖ One to one relationship
Threading
Prof. K. Adisesha (Ph. D)
9
Thread:
Difference between User-Level & Kernel-Level Thread.
User-Level Threads Kernel-Level Thread
User-level threads are faster to create and
manage.
Kernel-level threads are slower to create and
manage.
Implementation is by a thread library at the
user level.
Operating system supports creation of Kernel
threads.
User-level thread is generic and can run on
any operating system.
Kernel-level thread is specific to the
operating system.
Multi-threaded applications cannot take
advantage of multiprocessing.
Kernel routines themselves can be
multithreaded.
Threading
Prof. K. Adisesha (Ph. D)
10
Advantages of Thread:
The various advantages of using Thread are:
➢ Threads minimize the context switching time.
➢ Use of threads provides concurrency within a process.
➢ Efficient communication.
➢ It is more economical to create and context switch threads.
➢ Threads allow utilization of multiprocessor architectures to a greater scale and
efficiency..
Swapping
Prof. K. Adisesha (Ph. D)
11
Swapping:
Swapping is a mechanism in which a process can be swapped temporarily out of main
memory to secondary storage and make that memory available to other processes.
➢ Swapping is also known as a technique for memory compaction.
➢ The total time taken by swapping process includes
the time it takes to move the entire process to a
secondary disk and then to copy the process back to
memory
Process Scheduling
Prof. K. Adisesha (Ph. D)
12
Process Scheduling:
The process scheduling is the activity of the process manager that handles the removal
of the running process from the CPU on the basis of a particular strategy.
➢ Process scheduling is an essential part of a Multiprogramming operating systems.
➢ The OS maintains all PCBs in 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.
❖ Device queues: The processes which are blocked due
to unavailability of an I/O device constitute this queue
Process Scheduling
Prof. K. Adisesha (Ph. D)
13
Schedulers:
Schedulers are special system software which handle process scheduling in various ways.
➢ The 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:
▪ It is also called a job scheduler.
▪ A long-term scheduler determines which programs are admitted to the system for processing.
❖ 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.
❖ Medium-Term Scheduler:
▪ Medium-term scheduling is a part of swapping.
▪ It removes the processes from the memory. It reduces the degree of multiprogramming.
Process Scheduling
Prof. K. Adisesha (Ph. D)
14
Scheduling Criteria:
Schedulers selects the processes in memory that are ready to execute, and allocates the
CPU based on certain scheduling Criterias.
➢ Scheduling Criteria are based on:
❖ CPU utilization – keep the CPU as busy as possible
❖ Throughput – No. of processes that complete their execution per time unit
❖ Turnaround time – amount of time to execute a particular process
❖ Waiting time – amount of time a process has been waiting in the ready queue
❖ Response time – amount of time it takes from when a request was submitted until the
first response is produced, not output (for time-sharing environment)
Process Scheduling
Prof. K. Adisesha (Ph. D)
15
Scheduling algorithms:
A Process Scheduler schedules different processes to be assigned to the CPU based on
particular scheduling algorithms.
➢ These algorithms are either non-preemptive or preemptive
➢ There are popular process scheduling algorithms:
❖ First-Come, First-Served (FCFS) Scheduling
❖ Shortest-Job-Next (SJN) Scheduling
❖ Priority Scheduling
❖ Round Robin(RR) Scheduling
❖ Multiple-Level Queues Scheduling.
Scheduling Algorithms
Prof. K. Adisesha (Ph. D)
16
First Come First Serve (FCFS):
In First Come First Serve (FCFS) scheduling, Jobs are executed on first come, first
serve basis.
➢ It is a non-preemptive, pre-emptive scheduling algorithm.
➢ Easy to understand and implement.
➢ Its implementation is based on FIFO queue.
➢ Poor in performance as average wait time is high..
Scheduling Algorithms
Prof. K. Adisesha (Ph. D)
17
First Come First Serve (FCFS):
In First Come First Serve (FCFS) scheduling, Jobs are executed on first come, first
serve basis.
Example: FCFS Scheduling
Scheduling Algorithms
Prof. K. Adisesha (Ph. D)
18
Shortest Job Next (SJN):
This is also known as shortest job first, associate with each process the length of its
next CPU burst. Use these lengths to schedule the process with the shortest time.
➢ This is a non-preemptive, pre-emptive scheduling algorithm.
➢ Best approach to minimize waiting time.
➢ Easy to implement in Batch systems where required CPU time is known in advance.
➢ Impossible to implement in interactive systems where required CPU time is not
known.
➢ The processer should know in advance how much time process will take..
Scheduling Algorithms
Prof. K. Adisesha (Ph. D)
19
Shortest Job Next (SJN):
This is also known as shortest job first, associate with each process the length of its
next CPU burst. Use these lengths to schedule the process with the shortest time.
➢ Example:
Scheduling Algorithms
Prof. K. Adisesha (Ph. D)
20
Priority Scheduling:
Priority scheduling is a priority based algorithm and one of the most common
scheduling algorithms in batch systems.
➢ Each process is assigned a priority. Process with highest priority is to be executed first
and so on.
➢ Processes with same priority are executed on first come first served basis.
➢ Priority can be decided based on memory requirements, time requirements or any other
resource requirement.
Scheduling Algorithms
Prof. K. Adisesha (Ph. D)
21
Priority Based Scheduling:
Priority scheduling is a non-preemptive algorithm and one of the most common
scheduling algorithms in batch systems.
➢ Example:
Scheduling Algorithms
Prof. K. Adisesha (Ph. D)
22
Round Robin Scheduling:
Each process gets a small unit of CPU time (time quantum), after this time has elapsed,
the process is preempted and added to the end of the ready queue.
➢ Round Robin is the preemptive process scheduling algorithm.
➢ Each process is provided a fix time to execute, it is called a quantum.
➢ Once a process is executed for a given time period, it is preempted and other process
executes for a given time period.
➢ Context switching is used to save states of preempted processes.
Scheduling Algorithms
Prof. K. Adisesha (Ph. D)
23
Round Robin Scheduling:
Each process gets a small unit of CPU time (time quantum), after this time has elapsed,
the process is preempted and added to the end of the ready queue.
➢ Example:
Scheduling Algorithms
Prof. K. Adisesha (Ph. D)
24
Multiple-Level Queues Scheduling:
Multiple-level queues are not an independent scheduling algorithm.
➢ They make use of other existing algorithms to group and schedule jobs with common
characteristics.
❖ Multiple queues are maintained for processes with common characteristics.
❖ Each queue can have its own scheduling algorithms.
❖ Priorities are assigned to each queue.
Interprocess Communication
Prof. K. Adisesha (Ph. D)
25
Inter process Communication (IPC):
Inter process communication is a mechanism which allows processes to communicate
with each other and synchronize their actions.
➢ The communication between these processes can be seen as a method of co-operation
between them.
➢ Some of the methods to provide IPC:
❖ Message Queue.
❖ Shared Memory.
❖ Signal.
❖ Shared Files and Pipe
❖ Socket
Process Synchronization
Prof. K. Adisesha (Ph. D)
26
Process Synchronization:
Process Synchronization means sharing system resources by processes in a such a way
that, Concurrent access to shared data is handled thereby minimizing the chance of
inconsistent data.
➢ Process Synchronization ensures a perfect co-ordination among the process.
➢ Maintaining data consistency demands mechanisms to ensure synchronized execution
of cooperating processes.
➢ Process Synchronization can be provided by using several different tools like:
❖ Semaphores
❖ Mutual Exclusion or Mutex
❖ Monitor
Process Synchronization
Prof. K. Adisesha (Ph. D)
27
Process Synchronization:
Process Synchronization means sharing system resources by processes in a such a way
that, Concurrent access to shared data is handled thereby minimizing the chance of
inconsistent data.
➢ Process synchronization problem arises in the case of Cooperative process also because
resources are shared in Cooperative processes.
➢ On the basis of synchronization, processes are categorized as one of the following two types:
❖ Independent Process: Execution of one process does not affects the execution of
other processes.
❖ Cooperative Process: Execution of one process affects the execution of other
processes.
Process Synchronization
Prof. K. Adisesha (Ph. D)
28
Process Synchronization:
Race Condition:
➢ When serval process access and manipulates the same data at the same time, they may enter into a race
condition
➢ Race condition occurs among process that share common storage for read and write.
➢ Race condition occurs due to improper synchronization of shared memory access.
Critical section problem:
➢ Critical section is a code segment that can be accessed by only one process at a time.
➢ Critical section contains shared variables which need to be synchronized to maintain consistency of data
variables.
➢ Any solution to the critical section problem must satisfy three requirements:
❖ Mutual Exclusion
❖ Progress
❖ Bounded Waiting.
Process Synchronization
Prof. K. Adisesha (Ph. D)
29
Semaphores:
A semaphore is a signaling mechanism and a thread that is waiting on a semaphore
can be signaled by another thread.
➢ A semaphore uses two atomic operations, wait and signal for process synchronization.
➢ Classical problems of Synchronization with Semaphore Solution:
❖ Bounded-buffer (or Producer-Consumer) Problem
❖ Dining- Philosophers Problem
❖ Readers and Writers Problem
❖ Sleeping Barber Problem
Process Synchronization
Prof. K. Adisesha (Ph. D)
30
Bounded-buffer (or Producer-Consumer) Problem:
Bounded Buffer problem is also called producer consumer problem. This problem is
generalized in terms of the Producer-Consumer problem.
➢ Solution to this problem is, creating two counting semaphores “full” and “empty” to
keep track of the current number of full and empty buffers respectively.
➢ Producers produce a product and consumers consume the product, but both use of one
of the containers each time.
Process Synchronization
Prof. K. Adisesha (Ph. D)
31
Dining- Philosophers Problem:
The Dining Philosopher Problem states that K philosophers seated around a circular
table with one chopstick between each pair of philosophers.
➢ There is one chopstick between each philosopher.
➢ A philosopher may eat if he can pickup the two chopsticks
adjacent to him.
➢ One chopstick may be picked up by any one of its adjacent
followers but not both.
➢ This problem involves the allocation of limited resources to a
group of processes in a deadlock-free and starvation-free
manner.
Process Synchronization
Prof. K. Adisesha (Ph. D)
32
Readers and Writers Problem:
Suppose that a database is to be shared among several concurrent processes. We
distinguish between these two types of processes by referring to the former as readers
and to the latter as writers.
➢ Precisely in OS we call this situation as the readers-writers problem.
➢ Problem parameters:
❖ One set of data is shared among a number of processes.
❖ Once a writer is ready, it performs its write. Only one writer may write at a time.
❖ If a process is writing, no other process can read it.
❖ If at least one reader is reading, no other process can write.
❖ Readers may not write and only read.
Process Synchronization
Prof. K. Adisesha (Ph. D)
33
Sleeping Barber Problem:
The Dining Philosopher Problem states that K philosophers seated around a circular
table with one chopstick between each pair of philosophers.
➢ Barber shop with one barber, one barber chair and N
chairs to wait in.
➢ When no customers the barber goes to sleep in barber
chair and must be woken when a customer comes in.
➢ When barber is cutting hair new customers take empty
seats to wait, or leave if no vacancy.
Deadlocks
Prof. K. Adisesha (Ph. D)
34
Deadlock:
Deadlock is a situation where a set of processes are blocked because each process is
holding a resource and waiting for another resource acquired by some other process.
➢ In operating systems when there are two or more processes
that hold some resources and wait for resources held by
other(s).
➢ Example:
❖ Process 1 is holding Resource 1 and waiting for resource 2
which is acquired by process 2, and process 2 is waiting
for resource 1.
Deadlocks
Prof. K. Adisesha (Ph. D)
35
Deadlock:
Methods for handling deadlock .
➢ There are three ways to handle deadlock:
❖ Deadlock prevention or avoidance: The idea is to not let the system into a
deadlock state. by using strategy of “Avoidance”, we have to make an assumption.
❖ Deadlock detection and recovery: Let deadlock occur, then do preemption to
handle it once occurred.
❖ Ignore the problem altogether: If deadlock is very rare, then let it happen and
reboot the system. This is the approach that both Windows and UNIX take.
Discussion
Prof. K. Adisesha (Ph. D)
36
Queries ?
Prof. K. Adisesha
9449081542

More Related Content

What's hot

Chapter 2 part 1
Chapter 2 part 1Chapter 2 part 1
Chapter 2 part 1rohassanie
 
Memory Management
Memory ManagementMemory Management
Memory Management
Shipra Swati
 
Processes and Threads in Windows Vista
Processes and Threads in Windows VistaProcesses and Threads in Windows Vista
Processes and Threads in Windows VistaTrinh Phuc Tho
 
process creation OS
process creation OSprocess creation OS
process creation OS
Kiran Kumar Thota
 
Complete Operating System notes
Complete Operating System notesComplete Operating System notes
Complete Operating System notes
Lakshmi Sarvani Videla
 
Chapter 2 (Part 2)
Chapter 2 (Part 2) Chapter 2 (Part 2)
Chapter 2 (Part 2) rohassanie
 
Processes and Processors in Distributed Systems
Processes and Processors in Distributed SystemsProcesses and Processors in Distributed Systems
Processes and Processors in Distributed Systems
Dr Sandeep Kumar Poonia
 
Process management
Process managementProcess management
Process managementMohd Arif
 
operating system question bank
operating system question bankoperating system question bank
operating system question bankrajatdeep kaur
 
Chapter 1 - Introduction
Chapter 1 - IntroductionChapter 1 - Introduction
Chapter 1 - IntroductionWayne Jones Jnr
 
Process coordination
Process coordinationProcess coordination
Process coordination
Sweta Kumari Barnwal
 
Operating system
Operating systemOperating system
Operating system
Kinza Razzaq
 
Operating system support in distributed system
Operating system support in distributed systemOperating system support in distributed system
Operating system support in distributed system
ishapadhy
 
Os Question Bank
Os Question BankOs Question Bank
Os Question Bank
Sonali Chauhan
 
Operating Systems - memory management
Operating Systems - memory managementOperating Systems - memory management
Operating Systems - memory management
Mukesh Chinta
 
Operating Systems Part III-Memory Management
Operating Systems Part III-Memory ManagementOperating Systems Part III-Memory Management
Operating Systems Part III-Memory Management
Ajit Nayak
 
CS9222 ADVANCED OPERATING SYSTEMS
CS9222 ADVANCED OPERATING SYSTEMSCS9222 ADVANCED OPERATING SYSTEMS
CS9222 ADVANCED OPERATING SYSTEMS
Kathirvel Ayyaswamy
 

What's hot (20)

Chapter 2 part 1
Chapter 2 part 1Chapter 2 part 1
Chapter 2 part 1
 
Lecture 5 process concept
Lecture 5   process conceptLecture 5   process concept
Lecture 5 process concept
 
Memory Management
Memory ManagementMemory Management
Memory Management
 
Processes and Threads in Windows Vista
Processes and Threads in Windows VistaProcesses and Threads in Windows Vista
Processes and Threads in Windows Vista
 
process creation OS
process creation OSprocess creation OS
process creation OS
 
Complete Operating System notes
Complete Operating System notesComplete Operating System notes
Complete Operating System notes
 
Chapter 2 (Part 2)
Chapter 2 (Part 2) Chapter 2 (Part 2)
Chapter 2 (Part 2)
 
Processes and Processors in Distributed Systems
Processes and Processors in Distributed SystemsProcesses and Processors in Distributed Systems
Processes and Processors in Distributed Systems
 
Process management
Process managementProcess management
Process management
 
operating system question bank
operating system question bankoperating system question bank
operating system question bank
 
Chapter 1 - Introduction
Chapter 1 - IntroductionChapter 1 - Introduction
Chapter 1 - Introduction
 
Process coordination
Process coordinationProcess coordination
Process coordination
 
Operating system
Operating systemOperating system
Operating system
 
Operating system support in distributed system
Operating system support in distributed systemOperating system support in distributed system
Operating system support in distributed system
 
Os Question Bank
Os Question BankOs Question Bank
Os Question Bank
 
OSCh9
OSCh9OSCh9
OSCh9
 
Operating Systems - memory management
Operating Systems - memory managementOperating Systems - memory management
Operating Systems - memory management
 
Operating Systems
Operating SystemsOperating Systems
Operating Systems
 
Operating Systems Part III-Memory Management
Operating Systems Part III-Memory ManagementOperating Systems Part III-Memory Management
Operating Systems Part III-Memory Management
 
CS9222 ADVANCED OPERATING SYSTEMS
CS9222 ADVANCED OPERATING SYSTEMSCS9222 ADVANCED OPERATING SYSTEMS
CS9222 ADVANCED OPERATING SYSTEMS
 

Similar to Operating system 2 by adi

Operating System-2 by Adi.pdf
Operating System-2 by Adi.pdfOperating System-2 by Adi.pdf
Operating System-2 by Adi.pdf
Prof. Dr. K. Adisesha
 
Process Management Operating Systems .pptx
Process Management        Operating Systems .pptxProcess Management        Operating Systems .pptx
Process Management Operating Systems .pptx
SAIKRISHNADURVASULA2
 
Process management1
Process management1Process management1
Process management1
muhammad Juman Dahar
 
OS_Unit II - Process Management_CATI.pptx
OS_Unit II - Process Management_CATI.pptxOS_Unit II - Process Management_CATI.pptx
OS_Unit II - Process Management_CATI.pptx
Gokhul2
 
OS-Process.pdf
OS-Process.pdfOS-Process.pdf
OS-Process.pdf
Rakibul Rakib
 
PROCESS.pptx
PROCESS.pptxPROCESS.pptx
PROCESS.pptx
DivyaKS18
 
Chapter -2 operating system presentation
Chapter -2 operating system presentationChapter -2 operating system presentation
Chapter -2 operating system presentation
chnrketan
 
In computing, scheduling is the action .
In computing, scheduling is the action .In computing, scheduling is the action .
In computing, scheduling is the action .
nathansel1
 
Os unit 3 , process management
Os unit 3 , process managementOs unit 3 , process management
Os unit 3 , process management
Arnav Chowdhury
 
UNIT - 3 PPT(Part- 1)_.pdf
UNIT - 3 PPT(Part- 1)_.pdfUNIT - 3 PPT(Part- 1)_.pdf
UNIT - 3 PPT(Part- 1)_.pdf
AyushSharma651966
 
OS - Process Concepts
OS - Process ConceptsOS - Process Concepts
OS - Process Concepts
Mukesh Chinta
 
Process management- This ppt contains all required information regarding oper...
Process management- This ppt contains all required information regarding oper...Process management- This ppt contains all required information regarding oper...
Process management- This ppt contains all required information regarding oper...
ApurvaLaddha
 
LM9 - OPERATIONS, SCHEDULING, Inter process xommuncation
LM9 - OPERATIONS, SCHEDULING, Inter process xommuncationLM9 - OPERATIONS, SCHEDULING, Inter process xommuncation
LM9 - OPERATIONS, SCHEDULING, Inter process xommuncation
Mani Deepak Choudhry
 
Os unit 2
Os unit 2Os unit 2
Os unit 2
Krupali Mistry
 
Process Basics.ppt
Process Basics.pptProcess Basics.ppt
Process Basics.ppt
CharuJain396881
 
Operating system 28 fundamental of scheduling
Operating system 28 fundamental of schedulingOperating system 28 fundamental of scheduling
Operating system 28 fundamental of scheduling
Vaibhav Khanna
 
Processes and operating systems
Processes and operating systemsProcesses and operating systems
Processes and operating systems
RAMPRAKASHT1
 
Schudling os presentaion
Schudling os presentaionSchudling os presentaion
Schudling os presentaion
inayat khan
 
UNIT I-Processes.pptx
UNIT I-Processes.pptxUNIT I-Processes.pptx
UNIT I-Processes.pptx
GaneshKumar537286
 

Similar to Operating system 2 by adi (20)

Operating System-2 by Adi.pdf
Operating System-2 by Adi.pdfOperating System-2 by Adi.pdf
Operating System-2 by Adi.pdf
 
Process Management Operating Systems .pptx
Process Management        Operating Systems .pptxProcess Management        Operating Systems .pptx
Process Management Operating Systems .pptx
 
Process Management
Process ManagementProcess Management
Process Management
 
Process management1
Process management1Process management1
Process management1
 
OS_Unit II - Process Management_CATI.pptx
OS_Unit II - Process Management_CATI.pptxOS_Unit II - Process Management_CATI.pptx
OS_Unit II - Process Management_CATI.pptx
 
OS-Process.pdf
OS-Process.pdfOS-Process.pdf
OS-Process.pdf
 
PROCESS.pptx
PROCESS.pptxPROCESS.pptx
PROCESS.pptx
 
Chapter -2 operating system presentation
Chapter -2 operating system presentationChapter -2 operating system presentation
Chapter -2 operating system presentation
 
In computing, scheduling is the action .
In computing, scheduling is the action .In computing, scheduling is the action .
In computing, scheduling is the action .
 
Os unit 3 , process management
Os unit 3 , process managementOs unit 3 , process management
Os unit 3 , process management
 
UNIT - 3 PPT(Part- 1)_.pdf
UNIT - 3 PPT(Part- 1)_.pdfUNIT - 3 PPT(Part- 1)_.pdf
UNIT - 3 PPT(Part- 1)_.pdf
 
OS - Process Concepts
OS - Process ConceptsOS - Process Concepts
OS - Process Concepts
 
Process management- This ppt contains all required information regarding oper...
Process management- This ppt contains all required information regarding oper...Process management- This ppt contains all required information regarding oper...
Process management- This ppt contains all required information regarding oper...
 
LM9 - OPERATIONS, SCHEDULING, Inter process xommuncation
LM9 - OPERATIONS, SCHEDULING, Inter process xommuncationLM9 - OPERATIONS, SCHEDULING, Inter process xommuncation
LM9 - OPERATIONS, SCHEDULING, Inter process xommuncation
 
Os unit 2
Os unit 2Os unit 2
Os unit 2
 
Process Basics.ppt
Process Basics.pptProcess Basics.ppt
Process Basics.ppt
 
Operating system 28 fundamental of scheduling
Operating system 28 fundamental of schedulingOperating system 28 fundamental of scheduling
Operating system 28 fundamental of scheduling
 
Processes and operating systems
Processes and operating systemsProcesses and operating systems
Processes and operating systems
 
Schudling os presentaion
Schudling os presentaionSchudling os presentaion
Schudling os presentaion
 
UNIT I-Processes.pptx
UNIT I-Processes.pptxUNIT I-Processes.pptx
UNIT I-Processes.pptx
 

More from Prof. Dr. K. Adisesha

Software Engineering notes by K. Adisesha.pdf
Software Engineering notes by K. Adisesha.pdfSoftware Engineering notes by K. Adisesha.pdf
Software Engineering notes by K. Adisesha.pdf
Prof. Dr. K. Adisesha
 
Software Engineering-Unit 1 by Adisesha.pdf
Software Engineering-Unit 1 by Adisesha.pdfSoftware Engineering-Unit 1 by Adisesha.pdf
Software Engineering-Unit 1 by Adisesha.pdf
Prof. Dr. K. Adisesha
 
Software Engineering-Unit 2 "Requirement Engineering" by Adi.pdf
Software Engineering-Unit 2 "Requirement Engineering" by Adi.pdfSoftware Engineering-Unit 2 "Requirement Engineering" by Adi.pdf
Software Engineering-Unit 2 "Requirement Engineering" by Adi.pdf
Prof. Dr. K. Adisesha
 
Software Engineering-Unit 3 "System Modelling" by Adi.pdf
Software Engineering-Unit 3 "System Modelling" by Adi.pdfSoftware Engineering-Unit 3 "System Modelling" by Adi.pdf
Software Engineering-Unit 3 "System Modelling" by Adi.pdf
Prof. Dr. K. Adisesha
 
Software Engineering-Unit 4 "Architectural Design" by Adi.pdf
Software Engineering-Unit 4 "Architectural Design" by Adi.pdfSoftware Engineering-Unit 4 "Architectural Design" by Adi.pdf
Software Engineering-Unit 4 "Architectural Design" by Adi.pdf
Prof. Dr. K. Adisesha
 
Software Engineering-Unit 5 "Software Testing"by Adi.pdf
Software Engineering-Unit 5 "Software Testing"by Adi.pdfSoftware Engineering-Unit 5 "Software Testing"by Adi.pdf
Software Engineering-Unit 5 "Software Testing"by Adi.pdf
Prof. Dr. K. Adisesha
 
Computer Networks Notes by -Dr. K. Adisesha
Computer Networks Notes by -Dr. K. AdiseshaComputer Networks Notes by -Dr. K. Adisesha
Computer Networks Notes by -Dr. K. Adisesha
Prof. Dr. K. Adisesha
 
CCN Unit-1&2 Data Communication &Networking by K. Adiaesha
CCN Unit-1&2 Data Communication &Networking by K. AdiaeshaCCN Unit-1&2 Data Communication &Networking by K. Adiaesha
CCN Unit-1&2 Data Communication &Networking by K. Adiaesha
Prof. Dr. K. Adisesha
 
CCN Unit-3 Data Link Layer by Dr. K. Adisesha
CCN Unit-3 Data Link Layer by Dr. K. AdiseshaCCN Unit-3 Data Link Layer by Dr. K. Adisesha
CCN Unit-3 Data Link Layer by Dr. K. Adisesha
Prof. Dr. K. Adisesha
 
CCN Unit-4 Network Layer by Dr. K. Adisesha
CCN Unit-4 Network Layer by Dr. K. AdiseshaCCN Unit-4 Network Layer by Dr. K. Adisesha
CCN Unit-4 Network Layer by Dr. K. Adisesha
Prof. Dr. K. Adisesha
 
CCN Unit-5 Transport & Application Layer by Adi.pdf
CCN Unit-5 Transport & Application Layer by Adi.pdfCCN Unit-5 Transport & Application Layer by Adi.pdf
CCN Unit-5 Transport & Application Layer by Adi.pdf
Prof. Dr. K. Adisesha
 
Introduction to Computers.pdf
Introduction to Computers.pdfIntroduction to Computers.pdf
Introduction to Computers.pdf
Prof. Dr. K. Adisesha
 
R_Programming.pdf
R_Programming.pdfR_Programming.pdf
R_Programming.pdf
Prof. Dr. K. Adisesha
 
Scholarship.pdf
Scholarship.pdfScholarship.pdf
Scholarship.pdf
Prof. Dr. K. Adisesha
 
Operating System-1 by Adi.pdf
Operating System-1 by Adi.pdfOperating System-1 by Adi.pdf
Operating System-1 by Adi.pdf
Prof. Dr. K. Adisesha
 
Operating System-adi.pdf
Operating System-adi.pdfOperating System-adi.pdf
Operating System-adi.pdf
Prof. Dr. K. Adisesha
 
Data_structure using C-Adi.pdf
Data_structure using C-Adi.pdfData_structure using C-Adi.pdf
Data_structure using C-Adi.pdf
Prof. Dr. K. Adisesha
 
JAVA PPT -2 BY ADI.pdf
JAVA PPT -2 BY ADI.pdfJAVA PPT -2 BY ADI.pdf
JAVA PPT -2 BY ADI.pdf
Prof. Dr. K. Adisesha
 
JAVA PPT -5 BY ADI.pdf
JAVA PPT -5 BY ADI.pdfJAVA PPT -5 BY ADI.pdf
JAVA PPT -5 BY ADI.pdf
Prof. Dr. K. Adisesha
 
JAVA PPT -3 BY ADI.pdf
JAVA PPT -3 BY ADI.pdfJAVA PPT -3 BY ADI.pdf
JAVA PPT -3 BY ADI.pdf
Prof. Dr. K. Adisesha
 

More from Prof. Dr. K. Adisesha (20)

Software Engineering notes by K. Adisesha.pdf
Software Engineering notes by K. Adisesha.pdfSoftware Engineering notes by K. Adisesha.pdf
Software Engineering notes by K. Adisesha.pdf
 
Software Engineering-Unit 1 by Adisesha.pdf
Software Engineering-Unit 1 by Adisesha.pdfSoftware Engineering-Unit 1 by Adisesha.pdf
Software Engineering-Unit 1 by Adisesha.pdf
 
Software Engineering-Unit 2 "Requirement Engineering" by Adi.pdf
Software Engineering-Unit 2 "Requirement Engineering" by Adi.pdfSoftware Engineering-Unit 2 "Requirement Engineering" by Adi.pdf
Software Engineering-Unit 2 "Requirement Engineering" by Adi.pdf
 
Software Engineering-Unit 3 "System Modelling" by Adi.pdf
Software Engineering-Unit 3 "System Modelling" by Adi.pdfSoftware Engineering-Unit 3 "System Modelling" by Adi.pdf
Software Engineering-Unit 3 "System Modelling" by Adi.pdf
 
Software Engineering-Unit 4 "Architectural Design" by Adi.pdf
Software Engineering-Unit 4 "Architectural Design" by Adi.pdfSoftware Engineering-Unit 4 "Architectural Design" by Adi.pdf
Software Engineering-Unit 4 "Architectural Design" by Adi.pdf
 
Software Engineering-Unit 5 "Software Testing"by Adi.pdf
Software Engineering-Unit 5 "Software Testing"by Adi.pdfSoftware Engineering-Unit 5 "Software Testing"by Adi.pdf
Software Engineering-Unit 5 "Software Testing"by Adi.pdf
 
Computer Networks Notes by -Dr. K. Adisesha
Computer Networks Notes by -Dr. K. AdiseshaComputer Networks Notes by -Dr. K. Adisesha
Computer Networks Notes by -Dr. K. Adisesha
 
CCN Unit-1&2 Data Communication &Networking by K. Adiaesha
CCN Unit-1&2 Data Communication &Networking by K. AdiaeshaCCN Unit-1&2 Data Communication &Networking by K. Adiaesha
CCN Unit-1&2 Data Communication &Networking by K. Adiaesha
 
CCN Unit-3 Data Link Layer by Dr. K. Adisesha
CCN Unit-3 Data Link Layer by Dr. K. AdiseshaCCN Unit-3 Data Link Layer by Dr. K. Adisesha
CCN Unit-3 Data Link Layer by Dr. K. Adisesha
 
CCN Unit-4 Network Layer by Dr. K. Adisesha
CCN Unit-4 Network Layer by Dr. K. AdiseshaCCN Unit-4 Network Layer by Dr. K. Adisesha
CCN Unit-4 Network Layer by Dr. K. Adisesha
 
CCN Unit-5 Transport & Application Layer by Adi.pdf
CCN Unit-5 Transport & Application Layer by Adi.pdfCCN Unit-5 Transport & Application Layer by Adi.pdf
CCN Unit-5 Transport & Application Layer by Adi.pdf
 
Introduction to Computers.pdf
Introduction to Computers.pdfIntroduction to Computers.pdf
Introduction to Computers.pdf
 
R_Programming.pdf
R_Programming.pdfR_Programming.pdf
R_Programming.pdf
 
Scholarship.pdf
Scholarship.pdfScholarship.pdf
Scholarship.pdf
 
Operating System-1 by Adi.pdf
Operating System-1 by Adi.pdfOperating System-1 by Adi.pdf
Operating System-1 by Adi.pdf
 
Operating System-adi.pdf
Operating System-adi.pdfOperating System-adi.pdf
Operating System-adi.pdf
 
Data_structure using C-Adi.pdf
Data_structure using C-Adi.pdfData_structure using C-Adi.pdf
Data_structure using C-Adi.pdf
 
JAVA PPT -2 BY ADI.pdf
JAVA PPT -2 BY ADI.pdfJAVA PPT -2 BY ADI.pdf
JAVA PPT -2 BY ADI.pdf
 
JAVA PPT -5 BY ADI.pdf
JAVA PPT -5 BY ADI.pdfJAVA PPT -5 BY ADI.pdf
JAVA PPT -5 BY ADI.pdf
 
JAVA PPT -3 BY ADI.pdf
JAVA PPT -3 BY ADI.pdfJAVA PPT -3 BY ADI.pdf
JAVA PPT -3 BY ADI.pdf
 

Recently uploaded

The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
Israel Genealogy Research Association
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
David Douglas School District
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
chanes7
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
The Diamond Necklace by Guy De Maupassant.pptx
The Diamond Necklace by Guy De Maupassant.pptxThe Diamond Necklace by Guy De Maupassant.pptx
The Diamond Necklace by Guy De Maupassant.pptx
DhatriParmar
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
Celine George
 
Digital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion DesignsDigital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion Designs
chanes7
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
Levi Shapiro
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
Peter Windle
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
DhatriParmar
 
Best Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDABest Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDA
deeptiverma2406
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
thanhdowork
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Dr. Vinod Kumar Kanvaria
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
camakaiclarkmusic
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 

Recently uploaded (20)

The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
The Diamond Necklace by Guy De Maupassant.pptx
The Diamond Necklace by Guy De Maupassant.pptxThe Diamond Necklace by Guy De Maupassant.pptx
The Diamond Necklace by Guy De Maupassant.pptx
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
 
Digital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion DesignsDigital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion Designs
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
 
Best Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDABest Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDA
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 

Operating system 2 by adi

  • 1. Introduction to Operating Systems - 2 PROF. K. ADISESHA Process management
  • 2. Process management Process Concept Threads Process Scheduling CPU Scheduling Algorithm Inter process Communication 2 Process management
  • 3. Introduction Prof. K. Adisesha (Ph. D) 3 Introduction to Process: A process is basically a program in execution. The execution of a process must progress in a sequential fashion. ➢ When a program is loaded into the main memory it becomes a process. ➢ It can be divided into four sections ─ ❖ Stack: The process Stack contains the temporary data such as method/function parameters, return address and local variables ❖ Heap: This is dynamically allocated memory to a process during its run time ❖ Text: This includes the current activity represented by the value of Program Counter and the contents of the processor's registers. ❖ Data: This section contains the global and static variables.
  • 4. Introduction Prof. K. Adisesha (Ph. D) 4 Process Life Cycle: When a process executes, it passes through different states. These stages may differ in different operating systems, and the names of these states are also not standardized. ➢ A process can have one of the following five states at a time. ❖ Start ❖ Ready ❖ Running ❖ Waiting ❖ Terminated or Exit
  • 5. Introduction Prof. K. Adisesha (Ph. D) 5 Process Life Cycle: ➢ Start: This is the initial state when a process is first started/created. ➢ Ready: The process is waiting to be assigned to a processor. Ready processes are waiting to have the processor allocated to them by the OS so that they can run. ➢ 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. ➢ 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. ➢ 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.
  • 6. Introduction Prof. K. Adisesha (Ph. D) 6 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. ➢ The PCB is maintained for a process throughout its lifetime, and is deleted once the process terminates.
  • 7. Threading Prof. K. Adisesha (Ph. D) 7 Thread: A thread is also called a lightweight process. A thread is a flow of execution through the process code. ➢ A thread shares with its peer threads few information like code segment, data segment and open files. ➢ Threads provide a way to improve application performance through parallelism. ➢ All threads can share same set of open files, child processes. ➢ Multiple threaded processes use fewer resources. ➢ Threads are implemented in following two ways − ❖ User Level Threads − User managed threads. ❖ Kernel Level Threads − Operating System managed threads acting on kernel, an operating system core.
  • 8. Threading Prof. K. Adisesha (Ph. D) 8 Multithreading Models: Some operating system provide a combined user level thread and Kernel level thread facility. ➢ In a combined system, multiple threads within the same application can run in parallel on multiple processors and a blocking system call need not block the entire process. ➢ Multithreading models are three types ❖ Many to many relationship ❖ Many to one relationship ❖ One to one relationship
  • 9. Threading Prof. K. Adisesha (Ph. D) 9 Thread: Difference between User-Level & Kernel-Level Thread. User-Level Threads Kernel-Level Thread User-level threads are faster to create and manage. Kernel-level threads are slower to create and manage. Implementation is by a thread library at the user level. Operating system supports creation of Kernel threads. User-level thread is generic and can run on any operating system. Kernel-level thread is specific to the operating system. Multi-threaded applications cannot take advantage of multiprocessing. Kernel routines themselves can be multithreaded.
  • 10. Threading Prof. K. Adisesha (Ph. D) 10 Advantages of Thread: The various advantages of using Thread are: ➢ Threads minimize the context switching time. ➢ Use of threads provides concurrency within a process. ➢ Efficient communication. ➢ It is more economical to create and context switch threads. ➢ Threads allow utilization of multiprocessor architectures to a greater scale and efficiency..
  • 11. Swapping Prof. K. Adisesha (Ph. D) 11 Swapping: Swapping is a mechanism in which a process can be swapped temporarily out of main memory to secondary storage and make that memory available to other processes. ➢ Swapping is also known as a technique for memory compaction. ➢ The total time taken by swapping process includes the time it takes to move the entire process to a secondary disk and then to copy the process back to memory
  • 12. Process Scheduling Prof. K. Adisesha (Ph. D) 12 Process Scheduling: The process scheduling is the activity of the process manager that handles the removal of the running process from the CPU on the basis of a particular strategy. ➢ Process scheduling is an essential part of a Multiprogramming operating systems. ➢ The OS maintains all PCBs in 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. ❖ Device queues: The processes which are blocked due to unavailability of an I/O device constitute this queue
  • 13. Process Scheduling Prof. K. Adisesha (Ph. D) 13 Schedulers: Schedulers are special system software which handle process scheduling in various ways. ➢ The 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: ▪ It is also called a job scheduler. ▪ A long-term scheduler determines which programs are admitted to the system for processing. ❖ 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. ❖ Medium-Term Scheduler: ▪ Medium-term scheduling is a part of swapping. ▪ It removes the processes from the memory. It reduces the degree of multiprogramming.
  • 14. Process Scheduling Prof. K. Adisesha (Ph. D) 14 Scheduling Criteria: Schedulers selects the processes in memory that are ready to execute, and allocates the CPU based on certain scheduling Criterias. ➢ Scheduling Criteria are based on: ❖ CPU utilization – keep the CPU as busy as possible ❖ Throughput – No. of processes that complete their execution per time unit ❖ Turnaround time – amount of time to execute a particular process ❖ Waiting time – amount of time a process has been waiting in the ready queue ❖ Response time – amount of time it takes from when a request was submitted until the first response is produced, not output (for time-sharing environment)
  • 15. Process Scheduling Prof. K. Adisesha (Ph. D) 15 Scheduling algorithms: A Process Scheduler schedules different processes to be assigned to the CPU based on particular scheduling algorithms. ➢ These algorithms are either non-preemptive or preemptive ➢ There are popular process scheduling algorithms: ❖ First-Come, First-Served (FCFS) Scheduling ❖ Shortest-Job-Next (SJN) Scheduling ❖ Priority Scheduling ❖ Round Robin(RR) Scheduling ❖ Multiple-Level Queues Scheduling.
  • 16. Scheduling Algorithms Prof. K. Adisesha (Ph. D) 16 First Come First Serve (FCFS): In First Come First Serve (FCFS) scheduling, Jobs are executed on first come, first serve basis. ➢ It is a non-preemptive, pre-emptive scheduling algorithm. ➢ Easy to understand and implement. ➢ Its implementation is based on FIFO queue. ➢ Poor in performance as average wait time is high..
  • 17. Scheduling Algorithms Prof. K. Adisesha (Ph. D) 17 First Come First Serve (FCFS): In First Come First Serve (FCFS) scheduling, Jobs are executed on first come, first serve basis. Example: FCFS Scheduling
  • 18. Scheduling Algorithms Prof. K. Adisesha (Ph. D) 18 Shortest Job Next (SJN): This is also known as shortest job first, associate with each process the length of its next CPU burst. Use these lengths to schedule the process with the shortest time. ➢ This is a non-preemptive, pre-emptive scheduling algorithm. ➢ Best approach to minimize waiting time. ➢ Easy to implement in Batch systems where required CPU time is known in advance. ➢ Impossible to implement in interactive systems where required CPU time is not known. ➢ The processer should know in advance how much time process will take..
  • 19. Scheduling Algorithms Prof. K. Adisesha (Ph. D) 19 Shortest Job Next (SJN): This is also known as shortest job first, associate with each process the length of its next CPU burst. Use these lengths to schedule the process with the shortest time. ➢ Example:
  • 20. Scheduling Algorithms Prof. K. Adisesha (Ph. D) 20 Priority Scheduling: Priority scheduling is a priority based algorithm and one of the most common scheduling algorithms in batch systems. ➢ Each process is assigned a priority. Process with highest priority is to be executed first and so on. ➢ Processes with same priority are executed on first come first served basis. ➢ Priority can be decided based on memory requirements, time requirements or any other resource requirement.
  • 21. Scheduling Algorithms Prof. K. Adisesha (Ph. D) 21 Priority Based Scheduling: Priority scheduling is a non-preemptive algorithm and one of the most common scheduling algorithms in batch systems. ➢ Example:
  • 22. Scheduling Algorithms Prof. K. Adisesha (Ph. D) 22 Round Robin Scheduling: Each process gets a small unit of CPU time (time quantum), after this time has elapsed, the process is preempted and added to the end of the ready queue. ➢ Round Robin is the preemptive process scheduling algorithm. ➢ Each process is provided a fix time to execute, it is called a quantum. ➢ Once a process is executed for a given time period, it is preempted and other process executes for a given time period. ➢ Context switching is used to save states of preempted processes.
  • 23. Scheduling Algorithms Prof. K. Adisesha (Ph. D) 23 Round Robin Scheduling: Each process gets a small unit of CPU time (time quantum), after this time has elapsed, the process is preempted and added to the end of the ready queue. ➢ Example:
  • 24. Scheduling Algorithms Prof. K. Adisesha (Ph. D) 24 Multiple-Level Queues Scheduling: Multiple-level queues are not an independent scheduling algorithm. ➢ They make use of other existing algorithms to group and schedule jobs with common characteristics. ❖ Multiple queues are maintained for processes with common characteristics. ❖ Each queue can have its own scheduling algorithms. ❖ Priorities are assigned to each queue.
  • 25. Interprocess Communication Prof. K. Adisesha (Ph. D) 25 Inter process Communication (IPC): Inter process communication is a mechanism which allows processes to communicate with each other and synchronize their actions. ➢ The communication between these processes can be seen as a method of co-operation between them. ➢ Some of the methods to provide IPC: ❖ Message Queue. ❖ Shared Memory. ❖ Signal. ❖ Shared Files and Pipe ❖ Socket
  • 26. Process Synchronization Prof. K. Adisesha (Ph. D) 26 Process Synchronization: Process Synchronization means sharing system resources by processes in a such a way that, Concurrent access to shared data is handled thereby minimizing the chance of inconsistent data. ➢ Process Synchronization ensures a perfect co-ordination among the process. ➢ Maintaining data consistency demands mechanisms to ensure synchronized execution of cooperating processes. ➢ Process Synchronization can be provided by using several different tools like: ❖ Semaphores ❖ Mutual Exclusion or Mutex ❖ Monitor
  • 27. Process Synchronization Prof. K. Adisesha (Ph. D) 27 Process Synchronization: Process Synchronization means sharing system resources by processes in a such a way that, Concurrent access to shared data is handled thereby minimizing the chance of inconsistent data. ➢ Process synchronization problem arises in the case of Cooperative process also because resources are shared in Cooperative processes. ➢ On the basis of synchronization, processes are categorized as one of the following two types: ❖ Independent Process: Execution of one process does not affects the execution of other processes. ❖ Cooperative Process: Execution of one process affects the execution of other processes.
  • 28. Process Synchronization Prof. K. Adisesha (Ph. D) 28 Process Synchronization: Race Condition: ➢ When serval process access and manipulates the same data at the same time, they may enter into a race condition ➢ Race condition occurs among process that share common storage for read and write. ➢ Race condition occurs due to improper synchronization of shared memory access. Critical section problem: ➢ Critical section is a code segment that can be accessed by only one process at a time. ➢ Critical section contains shared variables which need to be synchronized to maintain consistency of data variables. ➢ Any solution to the critical section problem must satisfy three requirements: ❖ Mutual Exclusion ❖ Progress ❖ Bounded Waiting.
  • 29. Process Synchronization Prof. K. Adisesha (Ph. D) 29 Semaphores: A semaphore is a signaling mechanism and a thread that is waiting on a semaphore can be signaled by another thread. ➢ A semaphore uses two atomic operations, wait and signal for process synchronization. ➢ Classical problems of Synchronization with Semaphore Solution: ❖ Bounded-buffer (or Producer-Consumer) Problem ❖ Dining- Philosophers Problem ❖ Readers and Writers Problem ❖ Sleeping Barber Problem
  • 30. Process Synchronization Prof. K. Adisesha (Ph. D) 30 Bounded-buffer (or Producer-Consumer) Problem: Bounded Buffer problem is also called producer consumer problem. This problem is generalized in terms of the Producer-Consumer problem. ➢ Solution to this problem is, creating two counting semaphores “full” and “empty” to keep track of the current number of full and empty buffers respectively. ➢ Producers produce a product and consumers consume the product, but both use of one of the containers each time.
  • 31. Process Synchronization Prof. K. Adisesha (Ph. D) 31 Dining- Philosophers Problem: The Dining Philosopher Problem states that K philosophers seated around a circular table with one chopstick between each pair of philosophers. ➢ There is one chopstick between each philosopher. ➢ A philosopher may eat if he can pickup the two chopsticks adjacent to him. ➢ One chopstick may be picked up by any one of its adjacent followers but not both. ➢ This problem involves the allocation of limited resources to a group of processes in a deadlock-free and starvation-free manner.
  • 32. Process Synchronization Prof. K. Adisesha (Ph. D) 32 Readers and Writers Problem: Suppose that a database is to be shared among several concurrent processes. We distinguish between these two types of processes by referring to the former as readers and to the latter as writers. ➢ Precisely in OS we call this situation as the readers-writers problem. ➢ Problem parameters: ❖ One set of data is shared among a number of processes. ❖ Once a writer is ready, it performs its write. Only one writer may write at a time. ❖ If a process is writing, no other process can read it. ❖ If at least one reader is reading, no other process can write. ❖ Readers may not write and only read.
  • 33. Process Synchronization Prof. K. Adisesha (Ph. D) 33 Sleeping Barber Problem: The Dining Philosopher Problem states that K philosophers seated around a circular table with one chopstick between each pair of philosophers. ➢ Barber shop with one barber, one barber chair and N chairs to wait in. ➢ When no customers the barber goes to sleep in barber chair and must be woken when a customer comes in. ➢ When barber is cutting hair new customers take empty seats to wait, or leave if no vacancy.
  • 34. Deadlocks Prof. K. Adisesha (Ph. D) 34 Deadlock: Deadlock is a situation where a set of processes are blocked because each process is holding a resource and waiting for another resource acquired by some other process. ➢ In operating systems when there are two or more processes that hold some resources and wait for resources held by other(s). ➢ Example: ❖ Process 1 is holding Resource 1 and waiting for resource 2 which is acquired by process 2, and process 2 is waiting for resource 1.
  • 35. Deadlocks Prof. K. Adisesha (Ph. D) 35 Deadlock: Methods for handling deadlock . ➢ There are three ways to handle deadlock: ❖ Deadlock prevention or avoidance: The idea is to not let the system into a deadlock state. by using strategy of “Avoidance”, we have to make an assumption. ❖ Deadlock detection and recovery: Let deadlock occur, then do preemption to handle it once occurred. ❖ Ignore the problem altogether: If deadlock is very rare, then let it happen and reboot the system. This is the approach that both Windows and UNIX take.
  • 36. Discussion Prof. K. Adisesha (Ph. D) 36 Queries ? Prof. K. Adisesha 9449081542