SlideShare a Scribd company logo
3
Most read
4
Most read
5
Most read
ADVANCE
OPERATING SYSTEM
DARAKHSHAN NAYAB
MSC IT
Ms (Computer Science)
Dept.of Computer Science
Content
■ Context Switching
■ Example
■ Reason
■ Advantages
■ Disadvantages
Context Switching
■ Switching from one process to another in a system require
Saving the state of old process & loading saved state of new
process.
■ In Context Switching, the process is stored in PCB to save the
new state. So that,the old process can be removed from the
same part it was left.
■ To make it efficient we use register.
Example
■ Pure multitasking doesn’t exist.
■ It is impossible to perform two mentally challenging tasks
at the same time.
■ Therefore, when we multitask, what we really do is
constantly switch from one task to another. That’s what
context switching is.
■ It is just as applicable to mental tasks performed by
humans. After all, the human mind is similar to a CPU in
many ways.
Reason due to Context Switching happen
■ When a process of high priority comes in the ready state. In this
case, the execution of the running process should be stopped
and the higher priority process should be given the CPU for
execution.
■ When an interruption occurs then the process in the running
state should be stopped and the CPU should handle the interrupt
before doing something else.
■ When a transition between the user mode and kernel mode is
required then you have to perform the context switching
Advantages
■ Context switching is used to achieve multitasking i.e.
multiprogramming with time-sharing. Multitasking gives an
illusion to the users that more than one process are being
executed at the same time.
■ Context switching is so fast that the user feels that the CPU is
executing more than one task at the same time.
Disadvantages
■ It requires some time for context switching i.e. the context
switching time.
■ Time is required to save the context of one process that is
in the running state and then getting the context of another
process that is about to come in the running state.
Context switching

More Related Content

PPTX
Process state in OS
Khushboo Jain
 
PPTX
Real time Operating System
Tech_MX
 
PPTX
Email spam detection
PratisthaSingh5
 
PPTX
Marketing - Definições e Tipos
André Zambon
 
PPTX
Air quality monitoring system
Pravin Shinde
 
PPTX
Tinker cad intro
Archita Singh
 
PPTX
Process scheduling
Deepika Balichwal
 
PDF
Datacenter - Apresentação
Ruy Mendonça
 
Process state in OS
Khushboo Jain
 
Real time Operating System
Tech_MX
 
Email spam detection
PratisthaSingh5
 
Marketing - Definições e Tipos
André Zambon
 
Air quality monitoring system
Pravin Shinde
 
Tinker cad intro
Archita Singh
 
Process scheduling
Deepika Balichwal
 
Datacenter - Apresentação
Ruy Mendonça
 

What's hot (20)

PPT
Memory Management in OS
vampugani
 
PPTX
Interrupts
Urwa Shanza
 
PPTX
Memory Management in OS
Kumar Pritam
 
PPTX
memory hierarchy
sreelakshmikv
 
PPTX
Multiprogramming&timesharing
Tanuj Tyagi
 
PDF
Memory management
Rajni Sirohi
 
PDF
Processor Organization and Architecture
Vinit Raut
 
PPTX
Process scheduling
Riya Choudhary
 
PDF
Address Binding Scheme
Rajesh Piryani
 
PPTX
Demand paging
Trinity Dwarka
 
PPTX
Process management os concept
priyadeosarkar91
 
PPTX
Multithreading models.ppt
Luis Goldster
 
PPTX
Dead Lock in operating system
Ali Haider
 
PDF
Multithreading
Dr. A. B. Shinde
 
PDF
Deadlock Avoidance - OS
MsAnita2
 
PPT
CPU Scheduling Algorithms
Shubhashish Punj
 
PPT
Thrashing allocation frames.43
myrajendra
 
PPT
Introduction to System Calls
Vandana Salve
 
PPTX
Operating system memory management
rprajat007
 
PPT
Context Switching
franksvalli
 
Memory Management in OS
vampugani
 
Interrupts
Urwa Shanza
 
Memory Management in OS
Kumar Pritam
 
memory hierarchy
sreelakshmikv
 
Multiprogramming&timesharing
Tanuj Tyagi
 
Memory management
Rajni Sirohi
 
Processor Organization and Architecture
Vinit Raut
 
Process scheduling
Riya Choudhary
 
Address Binding Scheme
Rajesh Piryani
 
Demand paging
Trinity Dwarka
 
Process management os concept
priyadeosarkar91
 
Multithreading models.ppt
Luis Goldster
 
Dead Lock in operating system
Ali Haider
 
Multithreading
Dr. A. B. Shinde
 
Deadlock Avoidance - OS
MsAnita2
 
CPU Scheduling Algorithms
Shubhashish Punj
 
Thrashing allocation frames.43
myrajendra
 
Introduction to System Calls
Vandana Salve
 
Operating system memory management
rprajat007
 
Context Switching
franksvalli
 
Ad

Similar to Context switching (20)

PPTX
CONTEXT SWITCHING,PREEMPTIVE,NONPREEMPTIVE.pptx
LIGHTNINGBOLT5
 
PPTX
CNT_Lecture 8.pptx operating system computer
karishmaNoursai
 
PPTX
Evolution, Strutcture and Operations.pptx
ssuser000e54
 
PPTX
Process Management
Aditya Chaudhari
 
PPTX
Process scheduling
V.V.Vanniaperumal College for Women
 
PPTX
Lecture 2 process
Kumbirai Junior Muzavazi
 
PPTX
THEPROCESS SCHEDULING BASIC CONCEPT .pptx
geethasenthil2706
 
PPTX
Lecture 4 process cpu scheduling
Kumbirai Junior Muzavazi
 
PDF
process.pdfzljwiyrouyaeutoaetodtusiokklhh
abhinandpk2405
 
PPTX
UNIT 2 OS.pptx Introduction of Operating System
DevPatel62412
 
PDF
TYPES-OF-OSvnxbjxgjsjgsgjsgj gjzutsugsugsgussgj.pdf
abhishekknpsingh7
 
PPTX
Operating system 08 time sharing and multitasking operating system
Vaibhav Khanna
 
PDF
Process Control Block (PCB) print 4.pdf
fentahunmuluye23
 
PPTX
Chapter -2 operating system presentation
chnrketan
 
PPTX
OSModule1 important topics in detailed with examples
JithinS34
 
PPTX
AOS_Module_4ssssssssssssssssssssssss.pptx
rapiwip803
 
PPTX
Operating system 17 process management
Vaibhav Khanna
 
PPTX
topic cpu scheduling in operating system.pptx
iotsaprofessor
 
PPT
Ios103 ios102 iv-operating-system-memory-management_wk4
Anwal Mirza
 
PPTX
PROCESS.pptx
DivyaKS18
 
CONTEXT SWITCHING,PREEMPTIVE,NONPREEMPTIVE.pptx
LIGHTNINGBOLT5
 
CNT_Lecture 8.pptx operating system computer
karishmaNoursai
 
Evolution, Strutcture and Operations.pptx
ssuser000e54
 
Process Management
Aditya Chaudhari
 
Lecture 2 process
Kumbirai Junior Muzavazi
 
THEPROCESS SCHEDULING BASIC CONCEPT .pptx
geethasenthil2706
 
Lecture 4 process cpu scheduling
Kumbirai Junior Muzavazi
 
process.pdfzljwiyrouyaeutoaetodtusiokklhh
abhinandpk2405
 
UNIT 2 OS.pptx Introduction of Operating System
DevPatel62412
 
TYPES-OF-OSvnxbjxgjsjgsgjsgj gjzutsugsugsgussgj.pdf
abhishekknpsingh7
 
Operating system 08 time sharing and multitasking operating system
Vaibhav Khanna
 
Process Control Block (PCB) print 4.pdf
fentahunmuluye23
 
Chapter -2 operating system presentation
chnrketan
 
OSModule1 important topics in detailed with examples
JithinS34
 
AOS_Module_4ssssssssssssssssssssssss.pptx
rapiwip803
 
Operating system 17 process management
Vaibhav Khanna
 
topic cpu scheduling in operating system.pptx
iotsaprofessor
 
Ios103 ios102 iv-operating-system-memory-management_wk4
Anwal Mirza
 
PROCESS.pptx
DivyaKS18
 
Ad

Recently uploaded (20)

PDF
Security features in Dell, HP, and Lenovo PC systems: A research-based compar...
Principled Technologies
 
PDF
Presentation about Hardware and Software in Computer
snehamodhawadiya
 
PPTX
Dev Dives: Automate, test, and deploy in one place—with Unified Developer Exp...
AndreeaTom
 
PDF
MASTERDECK GRAPHSUMMIT SYDNEY (Public).pdf
Neo4j
 
PPTX
OA presentation.pptx OA presentation.pptx
pateldhruv002338
 
PPTX
Applied-Statistics-Mastering-Data-Driven-Decisions.pptx
parmaryashparmaryash
 
PDF
How ETL Control Logic Keeps Your Pipelines Safe and Reliable.pdf
Stryv Solutions Pvt. Ltd.
 
PDF
Economic Impact of Data Centres to the Malaysian Economy
flintglobalapac
 
PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
PDF
AI Unleashed - Shaping the Future -Starting Today - AIOUG Yatra 2025 - For Co...
Sandesh Rao
 
PDF
Oracle AI Vector Search- Getting Started and what's new in 2025- AIOUG Yatra ...
Sandesh Rao
 
PPTX
Agile Chennai 18-19 July 2025 | Emerging patterns in Agentic AI by Bharani Su...
AgileNetwork
 
PDF
Get More from Fiori Automation - What’s New, What Works, and What’s Next.pdf
Precisely
 
PDF
Structs to JSON: How Go Powers REST APIs
Emily Achieng
 
PDF
The Future of Artificial Intelligence (AI)
Mukul
 
PPTX
IT Runs Better with ThousandEyes AI-driven Assurance
ThousandEyes
 
PPTX
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
PDF
Software Development Methodologies in 2025
KodekX
 
PDF
GDG Cloud Munich - Intro - Luiz Carneiro - #BuildWithAI - July - Abdel.pdf
Luiz Carneiro
 
PDF
NewMind AI Weekly Chronicles - July'25 - Week IV
NewMind AI
 
Security features in Dell, HP, and Lenovo PC systems: A research-based compar...
Principled Technologies
 
Presentation about Hardware and Software in Computer
snehamodhawadiya
 
Dev Dives: Automate, test, and deploy in one place—with Unified Developer Exp...
AndreeaTom
 
MASTERDECK GRAPHSUMMIT SYDNEY (Public).pdf
Neo4j
 
OA presentation.pptx OA presentation.pptx
pateldhruv002338
 
Applied-Statistics-Mastering-Data-Driven-Decisions.pptx
parmaryashparmaryash
 
How ETL Control Logic Keeps Your Pipelines Safe and Reliable.pdf
Stryv Solutions Pvt. Ltd.
 
Economic Impact of Data Centres to the Malaysian Economy
flintglobalapac
 
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
AI Unleashed - Shaping the Future -Starting Today - AIOUG Yatra 2025 - For Co...
Sandesh Rao
 
Oracle AI Vector Search- Getting Started and what's new in 2025- AIOUG Yatra ...
Sandesh Rao
 
Agile Chennai 18-19 July 2025 | Emerging patterns in Agentic AI by Bharani Su...
AgileNetwork
 
Get More from Fiori Automation - What’s New, What Works, and What’s Next.pdf
Precisely
 
Structs to JSON: How Go Powers REST APIs
Emily Achieng
 
The Future of Artificial Intelligence (AI)
Mukul
 
IT Runs Better with ThousandEyes AI-driven Assurance
ThousandEyes
 
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
Software Development Methodologies in 2025
KodekX
 
GDG Cloud Munich - Intro - Luiz Carneiro - #BuildWithAI - July - Abdel.pdf
Luiz Carneiro
 
NewMind AI Weekly Chronicles - July'25 - Week IV
NewMind AI
 

Context switching

  • 1. ADVANCE OPERATING SYSTEM DARAKHSHAN NAYAB MSC IT Ms (Computer Science) Dept.of Computer Science
  • 2. Content ■ Context Switching ■ Example ■ Reason ■ Advantages ■ Disadvantages
  • 3. Context Switching ■ Switching from one process to another in a system require Saving the state of old process & loading saved state of new process. ■ In Context Switching, the process is stored in PCB to save the new state. So that,the old process can be removed from the same part it was left. ■ To make it efficient we use register.
  • 4. Example ■ Pure multitasking doesn’t exist. ■ It is impossible to perform two mentally challenging tasks at the same time. ■ Therefore, when we multitask, what we really do is constantly switch from one task to another. That’s what context switching is. ■ It is just as applicable to mental tasks performed by humans. After all, the human mind is similar to a CPU in many ways.
  • 5. Reason due to Context Switching happen ■ When a process of high priority comes in the ready state. In this case, the execution of the running process should be stopped and the higher priority process should be given the CPU for execution. ■ When an interruption occurs then the process in the running state should be stopped and the CPU should handle the interrupt before doing something else. ■ When a transition between the user mode and kernel mode is required then you have to perform the context switching
  • 6. Advantages ■ Context switching is used to achieve multitasking i.e. multiprogramming with time-sharing. Multitasking gives an illusion to the users that more than one process are being executed at the same time. ■ Context switching is so fast that the user feels that the CPU is executing more than one task at the same time.
  • 7. Disadvantages ■ It requires some time for context switching i.e. the context switching time. ■ Time is required to save the context of one process that is in the running state and then getting the context of another process that is about to come in the running state.