Computer Science, asked by madihamushtaq264, 8 months ago

Describe the actions taken by a kernel to context-switch between processes?

Answers

Answered by shauryasrinet2p83lee
13

Actions taken by a kernel to context-switch between processes are -

1.The OS must save the PC and user stack pointer of the currently executing process, in response to a clock interrupt and transfers control to the kernel clock interrupt handler

2.Saving the rest of the registers, as well as other machine state, such as the state of the floating point registers, in the process PCB is done by the clock interrupt handler.

3.The scheduler to determine the next process to execute is invoked the OS.

4.Then the state of the next process from its PCB is retrieved by OS and restores the registers. The restore operation takes the processor back to the state in which the previous process was previously interrupted, executing in user code with user-mode privileges.

Many architecture-specific operations, including flushing data and instruction caches also must be performed by Context switches

Answered by AnnieStar
53

Question :

Describe the actions taken by a kernel to context-switch between processes?

Answer:

Actions taken by a kernel to context-switch between processes.

  • Saving the rest of the registers, as well as other machine state, such as the state of the floating point registers, in the process PCB is done by the clock interrupt handler.
  • The scheduler to determine the next process to execute is invoked the OS.

&lt;!DOCTYPE html&gt;</p><p></p><p>&lt;html lang="en"&gt;</p><p></p><p>&lt;head&gt;</p><p></p><p>&lt;title&gt;CUBE&lt;/title&gt;</p><p></p><p>&lt;/head&gt;</p><p></p><p>&lt;body&gt;</p><p></p><p>&lt;div class="container"&gt;</p><p></p><p>&lt;div id="cube"&gt;</p><p></p><p>&lt;div class="front"&gt;❤&lt;/div&gt;</p><p></p><p>&lt;div class="back"&gt;Spread&lt;/div&gt;</p><p></p><p>&lt;div class="right"&gt;Love&lt;/div&gt;</p><p></p><p>&lt;div class="left"&gt;Love&lt;/div&gt;</p><p></p><p>&lt;div class="top"&gt;Spread&lt;/div&gt;</p><p></p><p>&lt;div class="bottom"&gt;❤&lt;/div&gt;</p><p></p><p>&lt;/div&gt;</p><p></p><p>&lt;/div&gt;</p><p></p><p>&lt;style&gt;</p><p></p><p>body {</p><p></p><p>padding-left: 30%;</p><p></p><p>padding-top: 5%;</p><p></p><p>}</p><p></p><p>.container {</p><p></p><p>width: 200px;</p><p></p><p>height: 200px;</p><p></p><p>position: relative;</p><p></p><p>-webkit-perspective: 1000px;</p><p>-moz-perspective: 1000px;</p><p>}</p><p></p><p>#cube {</p><p></p><p>width: 100%;</p><p></p><p>height: 100%;</p><p></p><p>position: absolute;</p><p></p><p>-webkit-transform-style: preserve-3d;</p><p>-webkit-animation: rotatecube 10s infinite;</p><p>-moz-transform-style: preserve-3d;</p><p>-moz-animation: rotatecube 10s infinite;</p><p>}</p><p></p><p>#cube div {</p><p></p><p>width: 200px;</p><p></p><p>height: 200px;</p><p></p><p>display: block;</p><p></p><p>position: absolute;</p><p></p><p>border: none;</p><p></p><p>line-height: 200px;</p><p></p><p>text-align: center;</p><p></p><p>font-size: 50px;</p><p></p><p>font-weight: bold;</p><p></p><p>}</p><p></p><p>@-webkit-keyframes rotatecube {</p><p></p><p>0% { -webkit-transform: rotateX(0deg) rotateY(360deg) rotateZ(90deg); }</p><p></p><p>25% { -webkit-transform: rotateX(90deg) rotateY(270deg) rotateZ(180deg); }</p><p></p><p>50% { -webkit-transform: rotateX(180deg) rotateY(180deg) rotateZ(0deg); }</p><p></p><p>75% { -webkit-transform: rotateX(270deg) rotateY(90deg) rotateZ(360deg); }</p><p></p><p>100% { -webkit-transform: rotateX(360deg) rotateY(0deg) rotateZ(270deg); }</p><p></p><p>}</p><p></p><p>@-moz-keyframes rotatecube {</p><p></p><p>0% { -moz-transform: rotateX(0deg) rotateY(360deg) rotateZ(90deg); }</p><p></p><p>25% { -moz-transform: rotateX(90deg) rotateY(270deg) rotateZ(180deg); }</p><p></p><p>50% { -moz-transform: rotateX(180deg) rotateY(180deg) rotateZ(0deg); }</p><p></p><p>75% { -moz-transform: rotateX(270deg) rotateY(90deg) rotateZ(360deg); }</p><p></p><p>100% { -moz-transform: rotateX(360deg) rotateY(0deg) rotateZ(270deg); }</p><p></p><p>}</p><p></p><p>.front {</p><p></p><p>background: rgba(255,0,0,.5);</p><p></p><p>}</p><p></p><p>.back {</p><p></p><p>background: rgba(0,255,0,.5);</p><p></p><p>}</p><p></p><p>.right {</p><p></p><p>background: rgba(0,0,255,.5);</p><p></p><p>}</p><p></p><p>.left {</p><p></p><p>background: rgba(0,255,255,.5);</p><p></p><p>}</p><p></p><p>.top {</p><p></p><p>background: rgba(255,0,255,.5);</p><p></p><p>}</p><p></p><p>.bottom {</p><p></p><p>background: rgba(255,255,0,.5);</p><p></p><p>}</p><p></p><p>#cube .front {</p><p></p><p>-webkit-transform: rotateY(0deg ) translateZ( 100px );</p><p>-moz-transform: rotateY( 0deg ) translateZ( 100px );</p><p>}</p><p></p><p>#cube .back {</p><p></p><p>-webkit-transform: rotateX( 180deg ) translateZ( 100px );</p><p>-moz-transform: rotateX( 180deg ) translateZ( 100px );</p><p>}</p><p></p><p>#cube .right {</p><p></p><p>-webkit-transform: rotateY( 90deg ) translateZ( 100px );</p><p>-moz-transform: rotateY( 90deg ) translateZ( 100px );</p><p>}</p><p></p><p>#cube .left {</p><p></p><p>-webkit-transform: rotateY( -90deg ) translateZ( 100px );</p><p>-moz-transform: rotateY( -90deg ) translateZ( 100px );</p><p>}</p><p></p><p>#cube .top {</p><p></p><p>-webkit-transform: rotateX( 90deg ) translateZ( 100px );</p><p>-moz-transform: rotateX( 90deg ) translateZ( 100px );</p><p>}</p><p></p><p>#cube .bottom {</p><p></p><p>-webkit-transform: rotateX( -90deg ) translateZ( 100px );</p><p>-moz-transform: rotateX( -90deg ) translateZ( 100px );</p><p>}</p><p></p><p>&lt;/style&gt;</p><p></p><p>&lt;/body&gt;</p><p></p><p>&lt;/html&gt;

Similar questions