Live data from Hacker News

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

github.com

101–110 of 117 posts

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

#101
post #95
post #65

As someone who doesn't understand much of what's going on here, what resources would you suggest I study to improve?

A more pragmatic book is The Linux Programming Interface, by Michael Kerrisk. It is Linux-specific though, but that's probably fine. Uninterruptible process sleep is covered in section 22.3. Threads, in chapters 29–33. Signals, chapters 20–22. The proc file system in section 12.1. Memory mappings, chapters 49–50.

The version I have covers kernel 2.6. Is that new enough to still be useful?

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

#102
post #80

Earlier quoted context omitted.

The thing about the "money" argument is that one could just as strongly claim that you went to 1st grade "for money".

And at the end, we end up with the capitalists dream: "I was born... for money"

I was born into debt. Then, I was forced to go to schools that taught obedience to authority, getting a job, and paying taxes. Then, I saw ads that told me I needed to buy products and run up debt. Then, I eventually didn't care about money except where absolutely necessary.

Everything in between made it seem like making money my No. 1 focus was necessary, though. A lifetime of being manipulated and pressured. It all gets better when you can finally pull back the curtain seeing what's really there. :)

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

#103

Earlier quoted context omitted.

Use your OS's own packaging system to install python-fuse. It may already be installed!

The python-fuse package on Ubuntu 18.04 does not seem to work (too old?). $ python2 fs.py x Traceback (most recent call last): File "fs.py", line 8, in class fs(fuse.Operations): AttributeError: 'module' object has no attribute 'Operations' $ python2 Python 2.7.17 (default, Nov 7 2019, 10:07:09) [GCC 7.4.0] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import fuse >>> fuse.__ver…

You probably have to change the import to something like

    from fuse import fuse

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

#104
https://lwn.net/Articles/288056/

Excerpt:

"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.

The user-space side, too, must realize that a system call was interrupted and respond accordingly; not all user-space programmers are known for their diligence in this regard.

Making a sleep uninterruptible eliminates these problems, but at the cost of being, well, uninterruptible. If the expected wakeup event does not materialize, the process will wait forever and there is usually nothing that anybody can do about it short of rebooting the system.

This is the source of the dreaded, unkillable process which is shown to be in the "D" state by ps.

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.

As recently noted by Alan Cox:

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."

That's the whyness to all of this...

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

#105

Earlier quoted context omitted.

The python-fuse package on Ubuntu 18.04 does not seem to work (too old?). $ python2 fs.py x Traceback (most recent call last): File "fs.py", line 8, in class fs(fuse.Operations): AttributeError: 'module' object has no attribute 'Operations' $ python2 Python 2.7.17 (default, Nov 7 2019, 10:07:09) [GCC 7.4.0] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import fuse >>> fuse.__ver…

You probably have to change the import to something like from fuse import fuse

That’s not it. Grep shows the word Operations isn’t present in the fuse module.

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

#106
post #60
post #11

I'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't get SIGCHLD, and wait() doesn't return. (So, for example, your favorite init/supervisor won't restart the process o…

For anyone who was wondering, I found a post explaining why threads can be in "uninterruptible sleep" in the first place: https://eklitzke.org/uninterruptible-sleep

This isn't a UNIX thing, it happens on Windows too. See non-alertable kernel-mode waits in [1], [2].

[1] https://docs.microsoft.com/en-us/windows-hardware/drivers/dd...

[2] https://docs.microsoft.com/en-us/windows-hardware/drivers/ke...

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

#107

https://lwn.net/Articles/288056/ Excerpt: "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. The user-space side, too, m…

https://eklitzke.org/uninterruptible-sleep

> If the process is in uninterruptible sleep then the process can’t be interrupted, which will cause the strace process itself to hang forever. Remarkably, it appears that the ptrace(2) system call is itself uninterruptible, which means that if this happens you may not be able to kill the strace process!

Everything about this is broken and makes no sense. The Night Watch is as relevant as ever. (https://www.usenix.org/system/files/1311_05-08_mickens.pdf)

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

#108

Earlier quoted context omitted.

I've had projects that - eventually and incidentally - brought me money, but were not started or done for money.

The thing about the "money" argument is that one could just as strongly claim that you went to 1st grade "for money".

except that there is a certain lack of autonomy both legally, mentally, and physically that prevents first grade aged children from refusing to go to school in many nations.

In other words : you can't derive a motivation from an action an individual does if it's something that they're forced to do so socially or legally.

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

#109
post #43

Earlier quoted context omitted.

Can someone write a program to tell me how much money I’d need to give you?

Give me time and I'll tell you at the end how much money you need to give me.

Sounds like a good deal if we don't need to pay until you're done!
Post reply on HN