Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C Moderated > [comp.lang.c.mo...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 6 of 7 Topic 1072 of 1126
Post > Topic >>

[comp.lang.c.moderated] Re: Program hangs with no output

by Val <Valery_Creux@[EMAIL PROTECTED] > Apr 4, 2008 at 10:35 AM

On Apr 1, 7:17 pm, David Given <d...@[EMAIL PROTECTED]
> wrote:
> Okay, I've been staring at this for hours now, and I've no idea what's
> going wrong. I'm pretty sure I'm doing everything right --- everything
> here is pretty straightforward C89, and the algorithms are dead simple,
> but it simply hangs solid using all the CPU about half-way through. It's
> not just slow --- I've let it run for a while and nothing whatsoever
> happens. Any suggestions?
>
> (I should probably get my CPU fan looked at, too. It got awfully hot
> during that long run. I'm sure I can smell something burning...)
>

This is a standard unix-like behaviour.

The contents of a file (that could be read and written) is removed
only when the associated reference-counter is zero.
Opening a file increments the counter.

So before deleting (rm -f) the reference was 2 (1 from the directory
structure, 1 from application that has opened the file).
rm -f remove the link from the directory structure, so the file is no
more visible but the counter is 1 so you can still read and write to
it.
When the applicaiton close the file, the couinter is decremented, is
zero and the content is remove from the filesystem.

This behaviour has been used by many application thsat needed some
storage but wanted to keep it invisible from a (non experienced) user.

Incidently, it is the reason why the command (and the same for the C
API) is "rm" i.e. remove link and not delete.
-- 
comp.lang.c.moderated - moderation address: clcm@[EMAIL PROTECTED]
 -- you must
have an appropriate newsgroups line in your header for your mail to be
seen,
or the newsgroup name in square brackets in the subject line.  Sorry.
 




 7 Posts in Topic:
Program hangs with no output
David Given <dg@[EMAIL  2008-04-01 12:17:08 
Re: Program hangs with no output
Kenneth Brody <kenbrod  2008-04-04 10:34:10 
Re: Program hangs with no output
Jack Klein <jackklein@  2008-04-04 10:35:01 
Re: Program hangs with no output
Barry Schwarz <schwarz  2008-04-04 10:35:08 
Re: Program hangs with no output
Jens Schweikhardt <use  2008-04-04 10:35:15 
[comp.lang.c.moderated] Re: Program hangs with no output
Val <Valery_Creux@[EMA  2008-04-04 10:35:19 
Re: Program hangs with no output
dwolffxx@[EMAIL PROTECTED  2008-04-04 10:35:36 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed Jul 9 0:40:53 CDT 2008.