LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-15-2011, 03:52 AM   #1
clivebluston
LQ Newbie
 
Registered: Apr 2011
Posts: 2

Rep: Reputation: 0
Does the termination of a process release file and other resources.


If I forget to close a file, a socket or any other resource in a Linux process, and the the process terminates, will those resources be freed?
Is there a difference if the process terminates normally or is killed?
 
Old 04-15-2011, 04:15 AM   #2
ozanbaba
Member
 
Registered: May 2003
Location: İzmir
Distribution: Slackware64 15.0 Multilib
Posts: 778

Rep: Reputation: 135Reputation: 135
SIGKILL won't give a change to clean as it will terminate right away. With SIGTERM, programs can catch it and create clean up processes. there's posix call for exiting and cleaning before the exit (man 3 exit man 2 exit)
 
Old 04-15-2011, 05:28 AM   #3
clivebluston
LQ Newbie
 
Registered: Apr 2011
Posts: 2

Original Poster
Rep: Reputation: 0
What I was really asking was that if the death of a process that has not freed resources, can leave something lying around that will eventually bring the system to a standstill.
 
Old 04-15-2011, 06:13 AM   #4
NM04
Member
 
Registered: Jan 2011
Distribution: Back Track,Fedora,centos
Posts: 240

Rep: Reputation: 14
clive,
welcome to LQ. If a process terminates it usually frees the resources, so that other processes waiting for that resource can use it to execute themselves(this is known as CRITICAL SECTION when a process gets the resource and proceed towards the execution).

If you are talking about sockets, they are file descriptors. They are used by the application layer protocols to communicate with the transport layer protocols. You have to close them whenever the communication the is over.

In case you forgot to close sockets, they will remain open(this is the thing what we refer as port).

Last edited by NM04; 04-15-2011 at 06:21 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
In my project i want to release the resources which my drivers are using? rajeshwar27singh Linux - Kernel 1 11-28-2007 05:36 PM
core process eating up resources jaggy00 Linux - Newbie 2 04-23-2007 04:11 AM
SSH connection termination during a running process... jayemef Linux - General 1 08-16-2005 11:41 AM
How to know on termination or exit of a perticular process in Unix Pavan mahoorker Linux - Software 1 06-07-2005 06:28 AM
Linux process termination souvik Programming 1 04-12-2002 05:55 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:06 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration