SlideShare a Scribd company logo
1 of 11
CS403PC: OPERATING SYSTEM
(R18 II(II Sem))
Department of computer science and engineering
(AI & ML)
LEC 10
by
Asst.Prof.M.Gokilavani
VITS
6/23/2023 Department of CSE (AI/ML) 1
Syllabus
6/23/2023 Department of CSE (AI/ML) 2
6/23/2023 Department of CSE (AI/ML) 3
TEXTBOOK:
• Operating System Principles- Abraham Silberchatz, Peter B.
Galvin, Greg Gagne 7th Edition, John Wiley.
• Advanced programming in the UNIX environment, W.R. Stevens,
Pearson education.
REFERENCES:
• Operating Systems – Internals and Design Principles Stallings,
Fifth Edition–2005, Pearson Education/PHI.
• Operating System A Design Approach- Crowley, TMH.
• Modern Operating Systems, Andrew S. Tanenbaum 2nd edition,
Pearson/PHI.
• UNIX programming environment, Kernighan and Pike, PHI/
Pearson Education.
• UNIX Internals -The New Frontiers, U. Vahalia, Pearson
Education
6/23/2023 Department of CSE (AI/ML) 4
Topics covered in Lec 10
6/23/2023 Department of CSE (AI/ML) 5
UNIT – II: Process and CPU Scheduling - Process
concepts and scheduling, Operations on processes,
Cooperating Processes, Threads, and Interposes
Communication, Scheduling Criteria, Scheduling
Algorithms, Multiple -Processor Scheduling.
System call interface for process management-fork,
exit, wait, waitpid, exec
Context Switching
• A context switching is the mechanism to store
and restore the state or context of a CPU in
Process Control block so that a process
execution can be resumed from the same point
at a later time.
• Using this technique, a context switcher
enables multiple processes to share a single
CPU.
• Context switching is an essential part of a
multitasking operating system features.
6/23/2023 6
Department of CSE (AI/ML)
6/23/2023 Department of CSE (AI/ML) 7
• When the scheduler switches the CPU from
executing one process to execute another, the
state from the current running process is stored
into the process control block.
• After this, the state for the process to run next
is loaded from its own PCB and used to set the
PC, registers, etc.
• At that point, the second process can start
executing.
6/23/2023 8
Department of CSE (AI/ML)
• Context switches are computationally intensive
since register and memory state must be saved
and restored.
• To avoid the amount of context switching time,
some hardware systems employ two or more
sets of processor registers.
• When the process is switched, the following
information is stored for later use.
6/23/2023 9
Department of CSE (AI/ML)
• Program Counter
• Scheduling information
• Base and limit register value
• Currently used register
• Changed State
• I/O State information
• Accounting information
6/23/2023 10
Department of CSE (AI/ML)
Topics to be covered in next Lec 11
• Operation of Process
6/23/2023 Department of CSE (AI/ML) 11
Thank you!!!

More Related Content

Similar to CS403PC Operating System Lec 10 context switching.pptx

System on Chip Based RTC in Power Electronics
System on Chip Based RTC in Power ElectronicsSystem on Chip Based RTC in Power Electronics
System on Chip Based RTC in Power Electronics
journalBEEI
 
An octa core processor with shared memory and message-passing
An octa core processor with shared memory and message-passingAn octa core processor with shared memory and message-passing
An octa core processor with shared memory and message-passing
eSAT Journals
 
Matlab Based High Level Synthesis Engine for Area And Power Efficient Arithme...
Matlab Based High Level Synthesis Engine for Area And Power Efficient Arithme...Matlab Based High Level Synthesis Engine for Area And Power Efficient Arithme...
Matlab Based High Level Synthesis Engine for Area And Power Efficient Arithme...
ijceronline
 
Arm A64fx and Post-K: Game-Changing CPU & Supercomputer for HPC, Big Data, & AI
Arm A64fx and Post-K: Game-Changing CPU & Supercomputer for HPC, Big Data, & AIArm A64fx and Post-K: Game-Changing CPU & Supercomputer for HPC, Big Data, & AI
Arm A64fx and Post-K: Game-Changing CPU & Supercomputer for HPC, Big Data, & AI
inside-BigData.com
 
Operating system Q/A
Operating system Q/AOperating system Q/A
Operating system Q/A
Abdul Munam
 

Similar to CS403PC Operating System Lec 10 context switching.pptx (20)

CS403: Operating System : Lec 7 OS Properties.pptx
CS403: Operating System : Lec 7 OS Properties.pptxCS403: Operating System : Lec 7 OS Properties.pptx
CS403: Operating System : Lec 7 OS Properties.pptx
 
Unit 1_Micrprocessors and microcontrollers_PPT_S3 16_8_2023.pptx
Unit 1_Micrprocessors and microcontrollers_PPT_S3 16_8_2023.pptxUnit 1_Micrprocessors and microcontrollers_PPT_S3 16_8_2023.pptx
Unit 1_Micrprocessors and microcontrollers_PPT_S3 16_8_2023.pptx
 
CS403: Operating System : Lec 5 System calls.pptx
CS403: Operating System : Lec 5 System calls.pptxCS403: Operating System : Lec 5 System calls.pptx
CS403: Operating System : Lec 5 System calls.pptx
 
CS403: Operating System : Lec 4 OS services.pptx
CS403: Operating System : Lec 4 OS services.pptxCS403: Operating System : Lec 4 OS services.pptx
CS403: Operating System : Lec 4 OS services.pptx
 
Parallex - The Supercomputer
Parallex - The SupercomputerParallex - The Supercomputer
Parallex - The Supercomputer
 
System on Chip Based RTC in Power Electronics
System on Chip Based RTC in Power ElectronicsSystem on Chip Based RTC in Power Electronics
System on Chip Based RTC in Power Electronics
 
An octa core processor with shared memory and message-passing
An octa core processor with shared memory and message-passingAn octa core processor with shared memory and message-passing
An octa core processor with shared memory and message-passing
 
Matlab Based High Level Synthesis Engine for Area And Power Efficient Arithme...
Matlab Based High Level Synthesis Engine for Area And Power Efficient Arithme...Matlab Based High Level Synthesis Engine for Area And Power Efficient Arithme...
Matlab Based High Level Synthesis Engine for Area And Power Efficient Arithme...
 
035
035035
035
 
files_1575611773_2100523175.pdf
files_1575611773_2100523175.pdffiles_1575611773_2100523175.pdf
files_1575611773_2100523175.pdf
 
Towards processing and reasoning streams of events in knowledge driven manufa...
Towards processing and reasoning streams of events in knowledge driven manufa...Towards processing and reasoning streams of events in knowledge driven manufa...
Towards processing and reasoning streams of events in knowledge driven manufa...
 
Aca2 01 new
Aca2 01 newAca2 01 new
Aca2 01 new
 
Arm A64fx and Post-K: Game-Changing CPU & Supercomputer for HPC, Big Data, & AI
Arm A64fx and Post-K: Game-Changing CPU & Supercomputer for HPC, Big Data, & AIArm A64fx and Post-K: Game-Changing CPU & Supercomputer for HPC, Big Data, & AI
Arm A64fx and Post-K: Game-Changing CPU & Supercomputer for HPC, Big Data, & AI
 
PRETZEL: Opening the Black Box of Machine Learning Prediction Serving Systems
PRETZEL: Opening the Black Box of Machine Learning Prediction Serving SystemsPRETZEL: Opening the Black Box of Machine Learning Prediction Serving Systems
PRETZEL: Opening the Black Box of Machine Learning Prediction Serving Systems
 
Spie2006 Paperpdf
Spie2006 PaperpdfSpie2006 Paperpdf
Spie2006 Paperpdf
 
The CAOS framework: democratize the acceleration of compute intensive applica...
The CAOS framework: democratize the acceleration of compute intensive applica...The CAOS framework: democratize the acceleration of compute intensive applica...
The CAOS framework: democratize the acceleration of compute intensive applica...
 
05 Preparing for Extreme Geterogeneity in HPC
05 Preparing for Extreme Geterogeneity in HPC05 Preparing for Extreme Geterogeneity in HPC
05 Preparing for Extreme Geterogeneity in HPC
 
Operating system Q/A
Operating system Q/AOperating system Q/A
Operating system Q/A
 
Barcelona Supercomputing Center, Generador de Riqueza
Barcelona Supercomputing Center, Generador de RiquezaBarcelona Supercomputing Center, Generador de Riqueza
Barcelona Supercomputing Center, Generador de Riqueza
 
CS304PC:Computer Organization and Architecture Session 31 Multiprogramming.pptx
CS304PC:Computer Organization and Architecture  Session 31 Multiprogramming.pptxCS304PC:Computer Organization and Architecture  Session 31 Multiprogramming.pptx
CS304PC:Computer Organization and Architecture Session 31 Multiprogramming.pptx
 

More from Asst.prof M.Gokilavani

More from Asst.prof M.Gokilavani (20)

CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
 
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfCCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
 
IT8073_Information Security_UNIT I _.pdf
IT8073_Information Security_UNIT I _.pdfIT8073_Information Security_UNIT I _.pdf
IT8073_Information Security_UNIT I _.pdf
 
IT8073 _Information Security _UNIT I Full notes
IT8073 _Information Security _UNIT I Full notesIT8073 _Information Security _UNIT I Full notes
IT8073 _Information Security _UNIT I Full notes
 
GE3151 PSPP UNIT IV QUESTION BANK.docx.pdf
GE3151 PSPP UNIT IV QUESTION BANK.docx.pdfGE3151 PSPP UNIT IV QUESTION BANK.docx.pdf
GE3151 PSPP UNIT IV QUESTION BANK.docx.pdf
 
GE3151 PSPP UNIT III QUESTION BANK.docx.pdf
GE3151 PSPP UNIT III QUESTION BANK.docx.pdfGE3151 PSPP UNIT III QUESTION BANK.docx.pdf
GE3151 PSPP UNIT III QUESTION BANK.docx.pdf
 
GE3151 UNIT II Study material .pdf
GE3151 UNIT II Study material .pdfGE3151 UNIT II Study material .pdf
GE3151 UNIT II Study material .pdf
 
GE3151 PSPP All unit question bank.pdf
GE3151 PSPP All unit question bank.pdfGE3151 PSPP All unit question bank.pdf
GE3151 PSPP All unit question bank.pdf
 
GE3151_PSPP_All unit _Notes
GE3151_PSPP_All unit _NotesGE3151_PSPP_All unit _Notes
GE3151_PSPP_All unit _Notes
 
GE3151_PSPP_UNIT_5_Notes
GE3151_PSPP_UNIT_5_NotesGE3151_PSPP_UNIT_5_Notes
GE3151_PSPP_UNIT_5_Notes
 
GE3151_PSPP_UNIT_4_Notes
GE3151_PSPP_UNIT_4_NotesGE3151_PSPP_UNIT_4_Notes
GE3151_PSPP_UNIT_4_Notes
 
GE3151_PSPP_UNIT_3_Notes
GE3151_PSPP_UNIT_3_NotesGE3151_PSPP_UNIT_3_Notes
GE3151_PSPP_UNIT_3_Notes
 
GE3151_PSPP_UNIT_2_Notes
GE3151_PSPP_UNIT_2_NotesGE3151_PSPP_UNIT_2_Notes
GE3151_PSPP_UNIT_2_Notes
 
AI3391 Artificial intelligence Unit IV Notes _ merged.pdf
AI3391 Artificial intelligence Unit IV Notes _ merged.pdfAI3391 Artificial intelligence Unit IV Notes _ merged.pdf
AI3391 Artificial intelligence Unit IV Notes _ merged.pdf
 
AI3391 Artificial intelligence Session 29 Forward and backward chaining.pdf
AI3391 Artificial intelligence Session 29 Forward and backward chaining.pdfAI3391 Artificial intelligence Session 29 Forward and backward chaining.pdf
AI3391 Artificial intelligence Session 29 Forward and backward chaining.pdf
 
AI3391 Artificial intelligence Session 28 Resolution.pptx
AI3391 Artificial intelligence Session 28 Resolution.pptxAI3391 Artificial intelligence Session 28 Resolution.pptx
AI3391 Artificial intelligence Session 28 Resolution.pptx
 
AI3391 Artificial intelligence session 27 inference and unification.pptx
AI3391 Artificial intelligence session 27 inference and unification.pptxAI3391 Artificial intelligence session 27 inference and unification.pptx
AI3391 Artificial intelligence session 27 inference and unification.pptx
 
AI3391 Artificial Intelligence Session 26 First order logic.pptx
AI3391 Artificial Intelligence Session 26 First order logic.pptxAI3391 Artificial Intelligence Session 26 First order logic.pptx
AI3391 Artificial Intelligence Session 26 First order logic.pptx
 

Recently uploaded

Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power Play
Epec Engineered Technologies
 
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
AldoGarca30
 
Introduction to Robotics in Mechanical Engineering.pptx
Introduction to Robotics in Mechanical Engineering.pptxIntroduction to Robotics in Mechanical Engineering.pptx
Introduction to Robotics in Mechanical Engineering.pptx
hublikarsn
 
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills KuwaitKuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
jaanualu31
 
INTERRUPT CONTROLLER 8259 MICROPROCESSOR
INTERRUPT CONTROLLER 8259 MICROPROCESSORINTERRUPT CONTROLLER 8259 MICROPROCESSOR
INTERRUPT CONTROLLER 8259 MICROPROCESSOR
TanishkaHira1
 

Recently uploaded (20)

8086 Microprocessor Architecture: 16-bit microprocessor
8086 Microprocessor Architecture: 16-bit microprocessor8086 Microprocessor Architecture: 16-bit microprocessor
8086 Microprocessor Architecture: 16-bit microprocessor
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power Play
 
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
 
PE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and propertiesPE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and properties
 
litvinenko_Henry_Intrusion_Hong-Kong_2024.pdf
litvinenko_Henry_Intrusion_Hong-Kong_2024.pdflitvinenko_Henry_Intrusion_Hong-Kong_2024.pdf
litvinenko_Henry_Intrusion_Hong-Kong_2024.pdf
 
Online food ordering system project report.pdf
Online food ordering system project report.pdfOnline food ordering system project report.pdf
Online food ordering system project report.pdf
 
Adsorption (mass transfer operations 2) ppt
Adsorption (mass transfer operations 2) pptAdsorption (mass transfer operations 2) ppt
Adsorption (mass transfer operations 2) ppt
 
Basic Electronics for diploma students as per technical education Kerala Syll...
Basic Electronics for diploma students as per technical education Kerala Syll...Basic Electronics for diploma students as per technical education Kerala Syll...
Basic Electronics for diploma students as per technical education Kerala Syll...
 
Max. shear stress theory-Maximum Shear Stress Theory ​ Maximum Distortional ...
Max. shear stress theory-Maximum Shear Stress Theory ​  Maximum Distortional ...Max. shear stress theory-Maximum Shear Stress Theory ​  Maximum Distortional ...
Max. shear stress theory-Maximum Shear Stress Theory ​ Maximum Distortional ...
 
Introduction to Robotics in Mechanical Engineering.pptx
Introduction to Robotics in Mechanical Engineering.pptxIntroduction to Robotics in Mechanical Engineering.pptx
Introduction to Robotics in Mechanical Engineering.pptx
 
Electromagnetic relays used for power system .pptx
Electromagnetic relays used for power system .pptxElectromagnetic relays used for power system .pptx
Electromagnetic relays used for power system .pptx
 
Worksharing and 3D Modeling with Revit.pptx
Worksharing and 3D Modeling with Revit.pptxWorksharing and 3D Modeling with Revit.pptx
Worksharing and 3D Modeling with Revit.pptx
 
Computer Graphics Introduction To Curves
Computer Graphics Introduction To CurvesComputer Graphics Introduction To Curves
Computer Graphics Introduction To Curves
 
Signal Processing and Linear System Analysis
Signal Processing and Linear System AnalysisSignal Processing and Linear System Analysis
Signal Processing and Linear System Analysis
 
Introduction to Artificial Intelligence ( AI)
Introduction to Artificial Intelligence ( AI)Introduction to Artificial Intelligence ( AI)
Introduction to Artificial Intelligence ( AI)
 
Passive Air Cooling System and Solar Water Heater.ppt
Passive Air Cooling System and Solar Water Heater.pptPassive Air Cooling System and Solar Water Heater.ppt
Passive Air Cooling System and Solar Water Heater.ppt
 
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptxHOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
 
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills KuwaitKuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
 
INTERRUPT CONTROLLER 8259 MICROPROCESSOR
INTERRUPT CONTROLLER 8259 MICROPROCESSORINTERRUPT CONTROLLER 8259 MICROPROCESSOR
INTERRUPT CONTROLLER 8259 MICROPROCESSOR
 
Hostel management system project report..pdf
Hostel management system project report..pdfHostel management system project report..pdf
Hostel management system project report..pdf
 

CS403PC Operating System Lec 10 context switching.pptx

  • 1. CS403PC: OPERATING SYSTEM (R18 II(II Sem)) Department of computer science and engineering (AI & ML) LEC 10 by Asst.Prof.M.Gokilavani VITS 6/23/2023 Department of CSE (AI/ML) 1
  • 3. 6/23/2023 Department of CSE (AI/ML) 3
  • 4. TEXTBOOK: • Operating System Principles- Abraham Silberchatz, Peter B. Galvin, Greg Gagne 7th Edition, John Wiley. • Advanced programming in the UNIX environment, W.R. Stevens, Pearson education. REFERENCES: • Operating Systems – Internals and Design Principles Stallings, Fifth Edition–2005, Pearson Education/PHI. • Operating System A Design Approach- Crowley, TMH. • Modern Operating Systems, Andrew S. Tanenbaum 2nd edition, Pearson/PHI. • UNIX programming environment, Kernighan and Pike, PHI/ Pearson Education. • UNIX Internals -The New Frontiers, U. Vahalia, Pearson Education 6/23/2023 Department of CSE (AI/ML) 4
  • 5. Topics covered in Lec 10 6/23/2023 Department of CSE (AI/ML) 5 UNIT – II: Process and CPU Scheduling - Process concepts and scheduling, Operations on processes, Cooperating Processes, Threads, and Interposes Communication, Scheduling Criteria, Scheduling Algorithms, Multiple -Processor Scheduling. System call interface for process management-fork, exit, wait, waitpid, exec
  • 6. Context Switching • A context switching is the mechanism to store and restore the state or context of a CPU in Process Control block so that a process execution can be resumed from the same point at a later time. • Using this technique, a context switcher enables multiple processes to share a single CPU. • Context switching is an essential part of a multitasking operating system features. 6/23/2023 6 Department of CSE (AI/ML)
  • 7. 6/23/2023 Department of CSE (AI/ML) 7
  • 8. • When the scheduler switches the CPU from executing one process to execute another, the state from the current running process is stored into the process control block. • After this, the state for the process to run next is loaded from its own PCB and used to set the PC, registers, etc. • At that point, the second process can start executing. 6/23/2023 8 Department of CSE (AI/ML)
  • 9. • Context switches are computationally intensive since register and memory state must be saved and restored. • To avoid the amount of context switching time, some hardware systems employ two or more sets of processor registers. • When the process is switched, the following information is stored for later use. 6/23/2023 9 Department of CSE (AI/ML)
  • 10. • Program Counter • Scheduling information • Base and limit register value • Currently used register • Changed State • I/O State information • Accounting information 6/23/2023 10 Department of CSE (AI/ML)
  • 11. Topics to be covered in next Lec 11 • Operation of Process 6/23/2023 Department of CSE (AI/ML) 11 Thank you!!!