Home > Archive > Unix Programming > July 2007 > Question about running a file
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Question about running a file
|
|
|
| Hi,
my question is:
I have a fortran program under unix, and the execution of it can last
many minutes.
While this is running if i delete the file that i have just ran(from
the console) nothing happens, it finish is execution.
This is normal or just a coincidence? if i start a bin file its loaded
entirely into memory?so i can delete it from hd? o in some case it
could be an error?
thanks
Seth
| |
| Rainer Temme 2007-07-17, 7:07 pm |
| Seth wrote:
> I have a fortran program under unix, and the execution of it can last
> many minutes.
> While this is running if i delete the file that i have just ran(from
> the console) nothing happens, it finish is execution.
> This is normal or just a coincidence? if i start a bin file its loaded
> entirely into memory?so i can delete it from hd? o in some case it
> could be an error?
Erasing a running file isn't tricky at all.
If the system loads the entiry file into memory, it will
have no need to access the file again. Therefore it doesn't
care if you delete this file.
If a system only loads that parts of a file it actually needs,
it will have incremented the usage-counter of the inode holding
the file (and will not decrement it until the binary stops its
execution). Therefore, even if you delete the file ... you only
delete the reference on this file in a certain directory of
the filesystem, but the inode holding the content of the file
is still undestroyed, since its usage-counter isn't yet zero.
| |
| Pascal Bourguignon 2007-07-17, 7:07 pm |
| Seth <Seth7TS@gmail.com> writes:
> Hi,
> my question is:
> I have a fortran program under unix, and the execution of it can last
> many minutes.
> While this is running if i delete the file that i have just ran(from
> the console) nothing happens, it finish is execution.
> This is normal or just a coincidence? if i start a bin file its loaded
> entirely into memory?so i can delete it from hd? o in some case it
> could be an error?
Even if the file is not loaded entirely in memory, you can delete it,
and the kernel may still load missing parts later.
In unix, rm(1) or unlink(2) DO NOT delete the files.
There is NO syscall to delete any file in unix!
On the other hand, there is reference counting and a garbage collector.
When you use link(2) (ln(1) without -s) or open(2), you increment the
reference count.
When you use unlink(2) or close(2), you decrement the reference count.
The problem is that ls(1) only shows the reference count corresponding
to link/unlink, not to open/close. Nonetheless, removing a link
DOESN'T delete the file.
The only thing that may suscitate the garbage collection of an i-node
blocks, is for the reference count to reach 0.
--
__Pascal Bourguignon__ http://www.informatimago.com/
NOTE: The most fundamental particles in this product are held
together by a "gluing" force about which little is currently known
and whose adhesive power can therefore not be permanently
guaranteed.
|
|
|
|
|