简体   繁体   中英

How is allocated memory handled when kill command for a process is given?

Suppose I am running my application.During this in my code memory allocation has taken place for various objects . Now i execute a kill command on my unix terminal for the process. In that case how does all the memory deallocation process takes place ? Is this handled entirely by the operating system by deallocating the entire memory for the process ?

In general, at process termination, all resources allocated by this process are freed by operating system. (see 3.3.2 Operating System Concepts by Abraham Silberschatz , Peter B. Galvin, Greg Gagne http://www.amazon.com/Operating-System-Concepts-Abraham-Silberschatz/dp/0470128720 )

The kill command does not "kill" process, but sends signal to it. If the signal is SIGKILL (kill -9 PID) you can do nothing. Process is killed unconditionally. If signal is SIGTERM (default), you can serve it or ignore it. See: http://en.wikipedia.org/wiki/Unix_signal

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM