LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 09-09-2010, 04:51 PM   #1
rbpember
LQ Newbie
 
Registered: Sep 2010
Posts: 8

Rep: Reputation: 0
how can I tell "at" not to "nice" the job?


I used "at" to schedule some (single threaded) timing runs (using /usr/bin/time) of a computationally intensive, I/O unintensive (as in just 2-3 pages of text output) program I'm working on last night, e.g.,

at -f script 23:59

where "script" in invoking the program a number of times.

The output this morning showed that each run of the program had taken ~2-3x as long to run as normal, i.e., the reported user time is 2-3x as large as when I run interactively. I just looked at a small subset of the test, and, yep, the program does run more slowly under at. Just checked using "crontab" to do the same thing and did not see any slowdown from running interactively. The only hint I saw is that with "at" the program is niced to 2 while with crontab the program runs at a nice of 0. Sure enough, when I run interactively with a nice value of 2 I see the same slow down -- which puzzles me because while running with a nice of 2, top reports that I am getting 100% of a CPU. BTW, the runs are long enough to be significant -- ~105 seconds of CPU time, ~300 sec under "at". So my 2 questions are:

1) how can I tell "at" not to nice my job?

2) why would running with a nice of 2 when there's no load on the machine slow my job down so?

Any thoughts would be appreciated. For what it's worth, I'm running Ubuntu 7.10, but I'm pretty sure this unrelated to the distro.
 
Old 09-09-2010, 05:16 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
2 is the default nice value of atd. Try 'echo "sleep 2s; nice"|at -q A now; echo "sleep 2s; nice"|at -q Z now;' to see the difference and nice limits of queues.
 
Old 09-09-2010, 05:34 PM   #3
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541

Rep: Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065
All the "batch" family of utilities (at, batch, atq, atrm) execute a designated program at a lower priority by design. That has also been traditionally true for anything you execute in background -- it runs at a lower priority.

You can use nice to make things speed up, but that kind of defeats the purpose of running in the middle of the night. The values of "nice" range from -20 to 19 where -20 is go all out and 19 is go whenever nothing else is running (that's why a "nice" value of 2 runs slower -- you use negative values of nice to go faster). As a user, you can't increase the priority to more that "0" (you can specify a negative value to nice but that won't matter); the super user can specify a negative value, however.

The idea of the batch utilities is to run stuff that requires a lot of resources or a long time to complete so other users aren't bothered by them; i.e., it's the way they're supposed to work.

Why you're using a lot of CPU would be something to look into in your program design I would think. Without knowing what the program does and how it does it... well, I dunno.

So, basically, it's working the way is should be and I wouldn't worry about it (or, use cron; as you've noted it'll run faster).

Hope this helps some.
 
Old 09-10-2010, 06:09 PM   #4
rbpember
LQ Newbie
 
Registered: Sep 2010
Posts: 8

Original Poster
Rep: Reputation: 0
> Why you're using a lot of CPU would be something to look into in
> your program design I would think.
> Without knowing what the program does and how it does it...
> well, I dunno.

Well, it turns out it has nothing to do with the program itself. I took the same program, ran it on my officemate's machine (Ubuntu 9.10), and saw no difference in run time between "no nice" and "nice +4".

My machine must be somehow configured differently, but in what way I don't have a clue.
 
Old 09-10-2010, 07:46 PM   #5
rbpember
LQ Newbie
 
Registered: Sep 2010
Posts: 8

Original Poster
Rep: Reputation: 0
I've determined that the problm has something to do with how my machined is configured. I'm going to mark this thread as "solved" and post a new thread with a more correct version of the problem I'm having.
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
net working eth0 eth1 wlan0 "no connection" "no LAN" "no wi-fi" Cayitano Linux - Newbie 5 12-09-2007 07:11 PM
Standard commands give "-bash: open: command not found" even in "su -" and "su root" mibo12 Linux - General 4 11-11-2007 10:18 PM
LXer: Displaying "MyComputer", "Trash", "Network Servers" Icons On A GNOME Desktop LXer Syndicated Linux News 0 04-02-2007 08:31 AM
Where to find a "nice" Howto" for modem setup and use for IPS usage xerxesii Linux - Hardware 2 03-27-2007 12:21 AM
Any way to get "Alice"; "Call of Duty" series and "Descent 3" to work? JBailey742 Linux - Games 13 06-23-2006 01:34 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 07:55 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