TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Show HN: A “living” Linux process with no memory

312 点作者 izabera大约 5 年前

13 条评论

geofft大约 5 年前
I&#x27;ve now seen a similar case multiple times in the wild - if a process has a thread in uninterruptible sleep (e.g., blocked on a bad disk or a stuck network filesystem) and you kill it, the process dies, but the kernel waits forever for that thread before informing the parent process. The parent doesn&#x27;t get SIGCHLD, and wait() doesn&#x27;t return. (So, for example, your favorite init&#x2F;supervisor won&#x27;t restart the process or even realize the process has died and raise an alert.) If the thread wasn&#x27;t the first thread, then the process looks like it&#x27;s gone and stops having most information in &#x2F;proc&#x2F;$pid, but it&#x27;s still got the thread in &#x2F;proc&#x2F;$pid&#x2F;tasks&#x2F;.<p>I&#x27;ve taken to calling such a process a &quot;lich,&quot; because it&#x27;s not quite a zombie - the parent can reap a zombie by calling wait(), but the lich has used magic to avoid true death.
评论 #22695267 未加载
评论 #22695496 未加载
评论 #22698496 未加载
评论 #22694404 未加载
评论 #22696865 未加载
评论 #22695200 未加载
评论 #22708988 未加载
croo大约 5 年前
&gt; Why? I don&#x27;t know. I thought it was funny<p>This is the profit.<p>While job searching I went on an interview where I got asked why I did a side gig listed on my resumee. &quot;For friend or for money?&quot; It was neither and I said &quot;I don&#x27;t know, because programming is fun?&quot;<p>I got hired.
评论 #22694292 未加载
评论 #22695299 未加载
peter_d_sherman大约 5 年前
<a href="https:&#x2F;&#x2F;lwn.net&#x2F;Articles&#x2F;288056&#x2F;" rel="nofollow">https:&#x2F;&#x2F;lwn.net&#x2F;Articles&#x2F;288056&#x2F;</a><p>Excerpt:<p>&quot;There are advantages and disadvantages to each type of sleep. Interruptible sleeps enable faster response to signals, but they make the programming harder. Kernel code which uses interruptible sleeps must always check to see whether it woke up as a result of a signal, and, if so, clean up whatever it was doing and return -EINTR back to user space.<p>The user-space side, too, must realize that a system call was interrupted and respond accordingly; <i>not all user-space programmers are known for their diligence in this regard.</i><p>Making a sleep uninterruptible eliminates these problems, but at the cost of being, well, uninterruptible. If the expected wakeup event does not materialize, <i>the process will wait forever and there is usually nothing that anybody can do about it short of rebooting the system.</i><p>This is the source of the dreaded, unkillable process which is shown to be in the &quot;D&quot; state by ps.<p>Given the highly obnoxious nature of unkillable processes, one would think that interruptible sleeps should be used whenever possible. The problem with that idea is that, in many cases, the introduction of interruptible sleeps is likely to lead to application bugs.<p>As recently noted by <i>Alan Cox:</i><p><i>Unix tradition (and thus almost all applications) believe file store writes to be non signal interruptible. It would not be safe or practical to change that guarantee.</i>&quot;<p>That&#x27;s the <i>whyness</i> to all of this...
评论 #22700289 未加载
kees99大约 5 年前
Did anybody try to run it? Python part of this PoC depends on python2 module &quot;fuse&quot;, which in turn depends on &quot;gunpowder&quot;, &quot;a library to facilitate machine learning on large, multi-dimensional images&quot;. What is even going on here?<p><pre><code> $ pip2 install fuse Collecting fuse Downloading https:&#x2F;&#x2F;files.pythonhosted.org&#x2F;packages&#x2F;c3&#x2F;f6&#x2F;82777531d0dd0fa1d1b509258873f4b48e1ec702dcf0258214fafb474895&#x2F;fuse-0.1.3.tar.gz ERROR: Packages installed from PyPI cannot depend on packages which are not also hosted on PyPI. fuse depends on gunpowder@ git+https:&#x2F;&#x2F;github.com&#x2F;funkey&#x2F;gunpowder@721718b6569b47a2f5d5d6633c76c85f779e25c7</code></pre>
评论 #22694756 未加载
评论 #22694665 未加载
评论 #22694663 未加载
评论 #22698467 未加载
plumsempy大约 5 年前
...and thus pure consciousness was born.
评论 #22696833 未加载
kdom13大约 5 年前
As someone who doesn&#x27;t understand much of what&#x27;s going on here, what resources would you suggest I study to improve?
评论 #22695721 未加载
评论 #22699050 未加载
Arch-TK大约 5 年前
Really neat!<p>Not sure why people care what it&#x27;s written in. I&#x27;m pretty sure people wouldn&#x27;t complain if this was a blog post written in english rather than a program written in C and python2.
emmelaich大约 5 年前
Can it be done without fuse?<p>Fuse is restricted; probably for reasons like this.
评论 #22698992 未加载
seqizz大约 5 年前
I am not sure if uninterruptable sleep is considered &quot;living&quot;, but fun experiment.
anonu大约 5 年前
Can&#x27;t think of any way to profit from this. Just reboot your box.
评论 #22694395 未加载
fierro大约 5 年前
how does the FUSE filesystem interact with the c program running? I don&#x27;t see the C program attempting to r&#x2F;w to that x directory
评论 #22696729 未加载
hsnewman大约 5 年前
Can this be implemented in Go?
评论 #22694923 未加载
评论 #22694576 未加载
评论 #22695205 未加载
评论 #22694231 未加载
评论 #22694287 未加载
fierro大约 5 年前
why do we need to JIT the munmap code? Can we not just call munmap(2)
评论 #22698335 未加载