在操作系统关闭过程中会发生什么? [英] What happens during the shutdown process of an OS?

查看:101
本文介绍了在操作系统关闭过程中会发生什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望这与编程有关.

在操作系统关闭过程中到底发生了什么,让我们在这里将Linux作为其开放源代码,并且对此可能会有更多的了解.

What exactly happens during the shutdown process of an Operating-System, let's take Linux here as its open-source and there may be more knowledge around about this.

  • (如何)终止内核线程?
  • 计算机处于清除"状态时,电源是否停止供电(明显)?我的意思是清楚的状态是CPU上不再有任何操作,等等.

  • (How) are the kernel threads terminated?
  • Does the power-supply stop supplying power (captain obvious) when the computer is in a "clear" state? What I mean with clear state is that there isn't anything going on in the CPU anymore, etc.

为什么大多数操作系统都需要很长时间才能关闭?我的意思是,他们不需要初始化某些东西,甚至不需要将资源加载到内存中.

Why do most operating systems take so long to shutdown? I mean hey, they don't need to initialize something or even load resources into memory.

为什么操作系统不像嘿,没关系-让我们终止所有进程,只需关闭电源就可以了"?

Why don't operating systems go like "Hey, nevermind - let's just terminate all the processes end just turn the power off"?

推荐答案

  1. 好吧,有时候操作系统确实只是拔掉了插头.给重新启动"正确的控制参数,然后 splat .

如果对文件的修改在内存中但没有刷新到磁盘怎么办?您可能想先将它们取出.

What if modifications to a file are in memory and not flushed to disk? You might want to get them out first.

如果某个守护进程正在文件的某些复杂更新中途该怎么办?您可能希望它完成.

What if some daemon process is partway through some complex update of a file? You might want it to finish.

如果守护程序需要告诉网络上的其他消息它打算安排有序的离开,该怎么办?

What if a daemon needs to tell something else on the network that it is going away to arrange an orderly departure?

要处理所有这些问题,操作系统必须有序地关闭程序.在Linux上,您可以通过在/etc/rcN.d中查找N = 0、1、2、3、4来观察未加工的香肠.

To deal with all of these, operating systems have orderly shutdown procedures. On linux, you can watch the sausages being unmade by looking in /etc/rcN.d, for N=0,1,2,3,4.

以'K'开头的符号链接是关闭过程.

The symbolic links that begin with 'K' are the shutdown process.

在此过程结束时,在现代硬件上,操作系统会关闭电源.当然,这意味着什么取决于硬件.

One way or the other, at the end of the process, on modern hardware, the operating system turns off the power. What that means depends, of course, on the hardware.

这篇关于在操作系统关闭过程中会发生什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆