So what's so nice about nice()?

So what's so nice about nice()?

Post by Tim Kirku » Sun, 07 Mar 1999 04:00:00



what is a nice() ?


>Like to share something with u pple out there.

>I tried to use nice() in a C programme to control the prioritisation of a
>group of  process. Guess what? I can't kill the process after that, not
even
>with a "kill -9". Am I missing something? No process that I know of can
stop
>a -9. Any opinions welcome.

>Anyway, no more nice() for me.

>Leon

 
 
 

So what's so nice about nice()?

Post by Leon » Mon, 08 Mar 1999 04:00:00


Like to share something with u pple out there.

I tried to use nice() in a C programme to control the prioritisation of a
group of  process. Guess what? I can't kill the process after that, not even
with a "kill -9". Am I missing something? No process that I know of can stop
a -9. Any opinions welcome.

Anyway, no more nice() for me.

Leon

 
 
 

So what's so nice about nice()?

Post by Lawrence Kir » Mon, 08 Mar 1999 04:00:00



>This is not a C question. It is a Unix question. Only one of your
>cross-posted newsgroups is appropriate for this question, and this
>(comp.lang.c) isn't the one.

Unfortunately if Leon only reads comp.unix.programmer he won't see your
response.

Quote:

>--

>Paul Lutus
>www.arachnoid.com

Incldentially since I'm seeing this your -- line isn't working, it is
probably missing the space at the end. However if you fix that make sure
the sig goes at the end of the article otherwise what you quote will
get chopped off for any reply.


>>Like to share something with u pple out there.

>>I tried to use nice() in a C programme to control the prioritisation of a
>>group of  process. Guess what? I can't kill the process after that, not
>even
>>with a "kill -9". Am I missing something? No process that I know of can
>stop
>>a -9. Any opinions welcome.

>>Anyway, no more nice() for me.

As Paul indicates nice() is a Unix (in fact POSIX) function it isn't
defined by the C language so it was inappropriate to cross-post this
to comp.lang.c.

--
-----------------------------------------


-----------------------------------------

 
 
 

So what's so nice about nice()?

Post by Paul Lutu » Mon, 08 Mar 1999 04:00:00


<< Unfortunately if Leon only reads comp.unix.programmer he won't see your
response. >>

Yes, but the alternative would be worse -- I could have cross-posted my
reply, chiding him for being off-topic in only one of his list of
newsgroups. I have justly been given the business for this in the past.

<< However if you fix that make sure
the sig goes at the end of the article otherwise what you quote will
get chopped off for any reply. >>

The "--(space)" device appears only to work on some newsreaders. I prefer to
manually snip any parts of the prior post I think are not necessary.

--

Paul Lutus
www.arachnoid.com

<snip>

 
 
 

So what's so nice about nice()?

Post by Peter Roozema » Mon, 08 Mar 1999 04:00:00


[ followups to comp.unix.programmer ]


Quote:> I tried to use nice() in a C programme to control the prioritisation of a
> group of  process. Guess what? I can't kill the process after that, not even
> with a "kill -9". Am I missing something? No process that I know of can stop
> a -9. Any opinions welcome.

The most likely cause is that you send the kill from another user's account
than the proces owner. (Does your program run suid root to get a higher
priority?)
The other cases where a kill -9 may fail are kernel bugs (extremely rare)
or defective hardware (a proces "hangs" during disk i/o, I've seen that
a few times)

Nice, combined with batch queues, makes a great tool when you have lots of
users and processes (with different performance requirements) on a system.

Peter
--
Peter Roozemaal
... Never attribute to malice that which may be explained by stupidity.

 
 
 

So what's so nice about nice()?

Post by Nate Eldredg » Mon, 08 Mar 1999 04:00:00



> Like to share something with u pple out there.

> I tried to use nice() in a C programme to control the prioritisation of a
> group of  process. Guess what? I can't kill the process after that, not even
> with a "kill -9". Am I missing something? No process that I know of can stop
> a -9. Any opinions welcome.

> Anyway, no more nice() for me.

If a `kill -9' succeeds (assuming 9 is SIGKILL for you) and the process
doesn't die, AFAIK and IMHO, that constitutes an OS bug.  Are you sure
the `kill' call succeeds?  Maybe the process is using so much CPU that
the `kill' doesn't get to run?  Have you the permissions?
--

Nate Eldredge

 
 
 

So what's so nice about nice()?

Post by Leon » Wed, 10 Mar 1999 04:00:00


I tried using root and the permission was definitely right.

Anyway, the process disappeared from the ps queue 1 day after the kill -9.
Initially, after running the kill -9 <process_id> with no error message,  ps
shows <the process id> is still there but kill -9 is not there.  So I dun
think the kill -9 was in on hold. Incidentally, the CPU load was pretty high
that day. Anyway, if u can, plse try it out.

Leon



>> Like to share something with u pple out there.

>> I tried to use nice() in a C programme to control the prioritisation of a
>> group of  process. Guess what? I can't kill the process after that, not
even
>> with a "kill -9". Am I missing something? No process that I know of can
stop
>> a -9. Any opinions welcome.

>> Anyway, no more nice() for me.

>If a `kill -9' succeeds (assuming 9 is SIGKILL for you) and the process
>doesn't die, AFAIK and IMHO, that constitutes an OS bug.  Are you sure
>the `kill' call succeeds?  Maybe the process is using so much CPU that
>the `kill' doesn't get to run?  Have you the permissions?
>--

>Nate Eldredge


 
 
 

So what's so nice about nice()?

Post by Barry Margoli » Wed, 10 Mar 1999 04:00:00




>I tried using root and the permission was definitely right.

>Anyway, the process disappeared from the ps queue 1 day after the kill -9.
>Initially, after running the kill -9 <process_id> with no error message,  ps
>shows <the process id> is still there but kill -9 is not there.  So I dun
>think the kill -9 was in on hold. Incidentally, the CPU load was pretty high
>that day. Anyway, if u can, plse try it out.

The only time a kill -9 should fail is if the process is stuck in a kernel
I/O wait.  Nice shouldn't have anything to do with it, it may be just a
coincidence.  Perhaps you should post the ps listing for the process that
doesn't go away.

--

GTE Internetworking, Powered by BBN, Burlington, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.

 
 
 

So what's so nice about nice()?

Post by Nate Eldredg » Wed, 10 Mar 1999 04:00:00



> I tried using root and the permission was definitely right.

> Anyway, the process disappeared from the ps queue 1 day after the kill -9.
> Initially, after running the kill -9 <process_id> with no error message,  ps
> shows <the process id> is still there but kill -9 is not there.  So I dun
> think the kill -9 was in on hold. Incidentally, the CPU load was pretty high
> that day. Anyway, if u can, plse try it out.

Works fine here; Linux 2.2.1.  I ran as root a program that ignores all
signals and sits in a `while (1);' loop with nice -n -20, and `kill
-KILL' kills it just fine.
--

Nate Eldredge

 
 
 

So what's so nice about nice()?

Post by Roy Brokva » Thu, 11 Mar 1999 04:00:00


[snip]

Quote:>The only time a kill -9 should fail is if the process is stuck in a kernel
>I/O wait.  Nice shouldn't have anything to do with it, it may be just a
>coincidence.  Perhaps you should post the ps listing for the process that
>doesn't go away.

True. I experienced exactly this problem today, when a cron job tried to do
some work on an NFS-mounted device that wasn't there anymore.

[snip]

Regards,

Roy Brokvam

 
 
 

So what's so nice about nice()?

Post by J. Ben » Thu, 11 Mar 1999 04:00:00




> [snip]

> >The only time a kill -9 should fail is if the process is stuck in a kernel
> >I/O wait.  Nice shouldn't have anything to do with it, it may be just a
> >coincidence.  Perhaps you should post the ps listing for the process that
> >doesn't go away.

> True. I experienced exactly this problem today, when a cron job tried to do
> some work on an NFS-mounted device that wasn't there anymore.

Actually, we can reproduce this at will.  And it is also an NFS issue.  We have
a COBOL function, compiled with Microfocus COBOL, that is linked into a C
program.  If the C-ISAM data set for the process is housed on an NFS mounted
drive, the process trying to access it freezes up, and can not be killed, even
with kill -9.  If you simply copy the data set to another directory on a native
drive, it works fine.
 
 
 

So what's so nice about nice()?

Post by Andrew Giert » Thu, 11 Mar 1999 04:00:00


 J> Actually, we can reproduce this at will.  And it is also an NFS
 J> issue.  We have a COBOL function, compiled with Microfocus COBOL,
 J> that is linked into a C program.  If the C-ISAM data set for the
 J> process is housed on an NFS mounted drive, the process trying to
 J> access it freezes up, and can not be killed, even with kill -9.
 J> If you simply copy the data set to another directory on a native
 J> drive, it works fine.

This is a bug in your systems NFS implementation, in that case.

It's normal for programs accessing NFS filesystems to be unkillable
*if* the NFS server is down *and* the filesystem was mounted with
the 'hard' and 'nointr' attributes.

But for the program to be unkillable even though the NFS server is
up indicates a kernel bug.

--
Andrew.

comp.unix.programmer FAQ: see <URL: http://www.erlenstar.demon.co.uk/unix/>
                           or <URL: http://www.whitefang.com/unix/>

 
 
 

1. Nice. Nice nice nice.

So I'd heard about this Linux thing - let's face it, you can't spend
any more than a year online and NOT hear about it unless you're under
some cybernetic rock - and always felt I ought to give it a try at
some point. Picked up the friendly yellow 'For Dummies' book which
came with three CDs of RH7.0. Lots of nice hand-holding throughout the
install process (which got me safely through a major glitch when the X
installer, starting up reasonably enough in a no-risk 640x480, got the
screen geometry totally wrong and was illegible, and pointed me in the
right direction for LOADLIN when lilo couldn't cope with Linux being
at the back end of a big drive) and I soon got into the OS. Got it
online, no worries. Well, this is nice, I said to myself, but
eventually I largely forgot about the system lurking at the other end
of my drive and returned through force of habit to Windows95.

But not willing to just plain give up (there's a principle involved,
dammit!) I sent off for the RH7.2 CDs when it came out. Fifteen quid.
Well, bugger me sideways... this new KDE is seriously slick, it just
*feels* faster, smoother, the lot. I'd imagine a lot of the discussion
of new distributions on here centres on technical aspects of kernels
and so forth, but speaking as a Windows refugee fleeing the imminent
prospect of XP's Big Brother pirate protection, it's looking like
Linux can become a happy home.

So much so, in fact, that I'm planning on getting myself a new
computer in a year or so, and having whatever the latest RH Linux is
as the main OS. Bill's not seeing another penny if I can help it...
(he says, posting with a Hotmail address in a slightly embarrassed
tone)

Odds are a fair number of people reading had some input into this nice
new OS I'm using now, so I just have to say, thanks guys.

2. operating system missing?

3. Nice jobs aren't being nice.

4. Winmodems are bad? tell me more

5. SUMMARY: To "nice" or not to "nice" [LONG]

6. making diskless network

7. "Nice" or not to "nice" large jobs

8. help needed for QuickCam installation

9. Nice monitors for a nice price...

10. five nice little questions (not urgent, but would be nice to get some answers)

11. nice nice args etc.

12. nice vs. not-nice

13. 'priority' vs. 'nice'