SlideShare a Scribd company logo
1 of 8
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

What's hot

Operating system memory management
Operating system memory managementOperating system memory management
Operating system memory managementrprajat007
 
Stack organization
Stack organizationStack organization
Stack organizationchauhankapil
 
OS - Process Concepts
OS - Process ConceptsOS - Process Concepts
OS - Process ConceptsMukesh Chinta
 
Time space trade off
Time space trade offTime space trade off
Time space trade offanisha talwar
 
Shortest job first Scheduling (SJF)
Shortest job first Scheduling (SJF)Shortest job first Scheduling (SJF)
Shortest job first Scheduling (SJF)ritu98
 
RPC: Remote procedure call
RPC: Remote procedure callRPC: Remote procedure call
RPC: Remote procedure callSunita Sahu
 
Real time Operating System
Real time Operating SystemReal time Operating System
Real time Operating SystemTech_MX
 
Os Swapping, Paging, Segmentation and Virtual Memory
Os Swapping, Paging, Segmentation and Virtual MemoryOs Swapping, Paging, Segmentation and Virtual Memory
Os Swapping, Paging, Segmentation and Virtual Memorysgpraju
 
Multiprogramming&timesharing
Multiprogramming&timesharingMultiprogramming&timesharing
Multiprogramming&timesharingTanuj Tyagi
 
Types of environment in Artificial Intelligence
Types of environment in Artificial IntelligenceTypes of environment in Artificial Intelligence
Types of environment in Artificial IntelligenceNoman Ullah Khan
 
Routing algorithm
Routing algorithmRouting algorithm
Routing algorithmBushra M
 
Memory Management in OS
Memory Management in OSMemory Management in OS
Memory Management in OSvampugani
 

What's hot (20)

Operating system memory management
Operating system memory managementOperating system memory management
Operating system memory management
 
Stack organization
Stack organizationStack organization
Stack organization
 
Process state in OS
Process state in OSProcess state in OS
Process state in OS
 
OS - Process Concepts
OS - Process ConceptsOS - Process Concepts
OS - Process Concepts
 
Time space trade off
Time space trade offTime space trade off
Time space trade off
 
Shortest job first Scheduling (SJF)
Shortest job first Scheduling (SJF)Shortest job first Scheduling (SJF)
Shortest job first Scheduling (SJF)
 
Memory Management
Memory ManagementMemory Management
Memory Management
 
RPC: Remote procedure call
RPC: Remote procedure callRPC: Remote procedure call
RPC: Remote procedure call
 
Real time Operating System
Real time Operating SystemReal time Operating System
Real time Operating System
 
Os Swapping, Paging, Segmentation and Virtual Memory
Os Swapping, Paging, Segmentation and Virtual MemoryOs Swapping, Paging, Segmentation and Virtual Memory
Os Swapping, Paging, Segmentation and Virtual Memory
 
Multiprogramming&timesharing
Multiprogramming&timesharingMultiprogramming&timesharing
Multiprogramming&timesharing
 
Process scheduling
Process schedulingProcess scheduling
Process scheduling
 
Process of operating system
Process of operating systemProcess of operating system
Process of operating system
 
Parallelism
ParallelismParallelism
Parallelism
 
Memory management
Memory managementMemory management
Memory management
 
Interrupts and types of interrupts
Interrupts and types of interruptsInterrupts and types of interrupts
Interrupts and types of interrupts
 
Types of environment in Artificial Intelligence
Types of environment in Artificial IntelligenceTypes of environment in Artificial Intelligence
Types of environment in Artificial Intelligence
 
Routing algorithm
Routing algorithmRouting algorithm
Routing algorithm
 
Interrupts
InterruptsInterrupts
Interrupts
 
Memory Management in OS
Memory Management in OSMemory Management in OS
Memory Management in OS
 

Similar to Context switching

Evolution, Strutcture and Operations.pptx
Evolution, Strutcture and Operations.pptxEvolution, Strutcture and Operations.pptx
Evolution, Strutcture and Operations.pptxssuser000e54
 
Operating system 08 time sharing and multitasking operating system
Operating system 08 time sharing and multitasking operating systemOperating system 08 time sharing and multitasking operating system
Operating system 08 time sharing and multitasking operating systemVaibhav Khanna
 
Chapter -2 operating system presentation
Chapter -2 operating system presentationChapter -2 operating system presentation
Chapter -2 operating system presentationchnrketan
 
Operating system 17 process management
Operating system 17 process managementOperating system 17 process management
Operating system 17 process managementVaibhav Khanna
 
Ios103 ios102 iv-operating-system-memory-management_wk4
Ios103 ios102 iv-operating-system-memory-management_wk4Ios103 ios102 iv-operating-system-memory-management_wk4
Ios103 ios102 iv-operating-system-memory-management_wk4Anwal Mirza
 
PROCESS.pptx
PROCESS.pptxPROCESS.pptx
PROCESS.pptxDivyaKS18
 
LM10,11,12 - CPU SCHEDULING algorithms and its processes
LM10,11,12 - CPU SCHEDULING algorithms and its processesLM10,11,12 - CPU SCHEDULING algorithms and its processes
LM10,11,12 - CPU SCHEDULING algorithms and its processesmanideepakc
 
Unit 2_OS process management
Unit 2_OS process management Unit 2_OS process management
Unit 2_OS process management JayeshGadhave1
 
Lecture-4.1-Operating-System.pptx
Lecture-4.1-Operating-System.pptxLecture-4.1-Operating-System.pptx
Lecture-4.1-Operating-System.pptxAngelaClarito1
 
Operating System-Concepts of Process
Operating System-Concepts of ProcessOperating System-Concepts of Process
Operating System-Concepts of ProcessShipra Swati
 
Operating system 33 swapping
Operating system 33 swappingOperating system 33 swapping
Operating system 33 swappingVaibhav Khanna
 
Multilevel queue scheduling
Multilevel queue schedulingMultilevel queue scheduling
Multilevel queue schedulingAditiPawaskar5
 
Lecture- 2_Process Management.pdf
Lecture- 2_Process Management.pdfLecture- 2_Process Management.pdf
Lecture- 2_Process Management.pdfHarika Pudugosula
 

Similar to Context switching (20)

Evolution, Strutcture and Operations.pptx
Evolution, Strutcture and Operations.pptxEvolution, Strutcture and Operations.pptx
Evolution, Strutcture and Operations.pptx
 
Process Management
Process ManagementProcess Management
Process Management
 
Process scheduling
Process schedulingProcess scheduling
Process scheduling
 
Lecture 2 process
Lecture 2   processLecture 2   process
Lecture 2 process
 
Lecture 4 process cpu scheduling
Lecture 4   process cpu schedulingLecture 4   process cpu scheduling
Lecture 4 process cpu scheduling
 
Operating system 08 time sharing and multitasking operating system
Operating system 08 time sharing and multitasking operating systemOperating system 08 time sharing and multitasking operating system
Operating system 08 time sharing and multitasking operating system
 
Chapter -2 operating system presentation
Chapter -2 operating system presentationChapter -2 operating system presentation
Chapter -2 operating system presentation
 
Operating system 17 process management
Operating system 17 process managementOperating system 17 process management
Operating system 17 process management
 
Ios103 ios102 iv-operating-system-memory-management_wk4
Ios103 ios102 iv-operating-system-memory-management_wk4Ios103 ios102 iv-operating-system-memory-management_wk4
Ios103 ios102 iv-operating-system-memory-management_wk4
 
PROCESS.pptx
PROCESS.pptxPROCESS.pptx
PROCESS.pptx
 
LM10,11,12 - CPU SCHEDULING algorithms and its processes
LM10,11,12 - CPU SCHEDULING algorithms and its processesLM10,11,12 - CPU SCHEDULING algorithms and its processes
LM10,11,12 - CPU SCHEDULING algorithms and its processes
 
Operating System.pptx
Operating System.pptxOperating System.pptx
Operating System.pptx
 
Unit 2_OS process management
Unit 2_OS process management Unit 2_OS process management
Unit 2_OS process management
 
Lecture-4.1-Operating-System.pptx
Lecture-4.1-Operating-System.pptxLecture-4.1-Operating-System.pptx
Lecture-4.1-Operating-System.pptx
 
Operating System-Concepts of Process
Operating System-Concepts of ProcessOperating System-Concepts of Process
Operating System-Concepts of Process
 
Operating system 33 swapping
Operating system 33 swappingOperating system 33 swapping
Operating system 33 swapping
 
Lect07
Lect07Lect07
Lect07
 
Multilevel queue scheduling
Multilevel queue schedulingMultilevel queue scheduling
Multilevel queue scheduling
 
Lecture- 2_Process Management.pdf
Lecture- 2_Process Management.pdfLecture- 2_Process Management.pdf
Lecture- 2_Process Management.pdf
 
os ass.pptx
os ass.pptxos ass.pptx
os ass.pptx
 

Recently uploaded

Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsPrecisely
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfjimielynbastida
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 

Recently uploaded (20)

Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power Systems
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdf
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort ServiceHot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 

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.