
when a program is executed, it becomes a process and the operating system reserves a memory block for it. within this block, there’s a memory segment called the text section which contains the executable code for the program.
we know that the cpu contains a special register called the address register, also known as the program counter. this register points to the next instruction to be executed.
but remember that what enters the queue isn’t actually a process, but its process control block.
but many applications such as servers or background services are designed to run indefinitely. if we allocate the cpu to a process that never ends, all subsequent processes would be indefinitely waiting in the queue. if we assume that a process can only get the cpu fact is that programs in execution don’t use the cpu continuously.
eventually the final cpu burst ends with a system request to terminate execution.
the scheduler should allocate it only until the process’s current cpu burst ends.
so even though it is now ready to continue running, it must wait for its turn.for most of their lifetime, processes cycle between these three states: ready, running, and waiting.
after making a system call to exit, the operating system must free allocated resources, including memory.
dispatcher.when a running process enters an io waiting state and the cpu becomes available the dispatcher steps in with one single purpose.allocate the cpu to the process at the head of the ready q.
in other words, perform the context switch.
分享文章
生成精美分享图或复制链接,与更多人分享本文。
继续阅读
换条路线
从其他文章中稳定抽取
最后更新于 ,距今已过 125 天
部分内容可能已过时