LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Process works after deleting it? (https://www.linuxquestions.org/questions/linux-newbie-8/process-works-after-deleting-it-811470/)

Mr. Alex 06-01-2010 07:55 AM

Process works after deleting it?
 
If I delete some program, let's say - PulseAudio, it still runs and I need to kill this process. Why? How can it work if it's no more on the HDD? And if I just reboot the PC after deleting PulseAudio (without killing it), it won't be in memory then?

alli_yas 06-01-2010 08:12 AM

From what I understand if you've started a process that loads the application into memory, deleting the binary doesn't kill the process.

You'd need to explicitly do a

Code:

# kill -9 <PID>
If you delete the binaries and reboot - definitely the process will not be started (if you have a startup script it should fail).

PS: Be careful with the kill command (especially the -9 option) - this will forcefully kill any process you specify which can cause problems.

cospengle 06-01-2010 08:20 AM

A process is a running program. It is not exactly the same as having a program stored on a hard disk.

When you run a program, the file containing the program is read into your system's memory and the process uses this information to run. If you delete the file in secondary storage (on your hard disk) the program is still contained in the memory so it can still run until the memory is cleared (in the case of virtual memory systems, this generally happens when the process is terminated or the system reboots).

When you restart your system, if your program is not on your hard drive it can't be loaded back into memory (also, since there is no program to run, the operating system won't create a new process at all).

Mr. Alex 06-01-2010 01:12 PM

Can I kill processes with htop by "SIGTERM"?

grail 06-01-2010 07:08 PM

I am hoping by 'delete' you mean you uninstalled the application/driver as simply deleting could cause issues for other programs who are still looking for this information.

Mr. Alex 06-02-2010 01:36 AM

Sure, I meant
Code:

apt-get purge ...

johnsfine 06-02-2010 04:22 AM

Quote:

Originally Posted by cospengle (Post 3988633)
When you run a program, the file containing the program is read into your system's memory and the process uses this information to run. If you delete the file in secondary storage (on your hard disk) the program is still contained in the memory so it can still run until the memory is cleared

I don't think that is exactly correct.

When you run a program, the file containing the program is mapped into your virtual address space. Individual pages are read on demand. The file is still required.

If you tell the OS to delete the file, the directory entry will go away. But the OS will recognize that a process still needs the file and won't really delete the file. When the process closes the file, the OS will remember that the file has no directory entry and will delete it then.


All times are GMT -5. The time now is 11:34 AM.