• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Controlling execution priority of a script
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Controlling execution priority of a script


  • Subject: Controlling execution priority of a script
  • From: Brian Johnson <email@hidden>
  • Date: Fri, 10 Jun 2005 14:07:11 -0700 (PDT)


I have an OSX web server that runs some applescript acgi applications as well as some routine (scheduled) background applescript jobs. Occasionally the CGI events happen during heavy ("batch or background") use and end up taking substantially longer to return. This raises the question of whether a script can control its own execution priority (or that of another script). A little google searching suggests nice, renice, getpriority, and setpriority might be candidates.


I'd like the 'batch' process to be able to downgrade it's own priority. I've tried this simple script (in SE) to explore this a bit, (alternately uncommenting the first or second line) and hit a snag..

--do shell script "renice 20 -p 30000"
--do shell script "#include <sys/time.h>;#include <sys/resource.h>; getpriority(PRIO_PROCESS,30000)"
result as number

(fyi, the second parameter of getpriority is the pid, and 0 => current-process). If the pid in the renice call is legitimate, it always seems to return 0, which is OK. If it's whacky (like the above) it throws an error ("renice: 30000: getpriority: No such process" -- suggesting renice uses getpriority). However, when I uncomment line 2, I always get 0 returned, so I can't really tell if renice is doing what I need...

Ideas or suggestions?

 - brian johnson, dept of architecture, university of washington, seattle
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: Script Objects - help please!!
  • Next by Date: Re: Scripting text edit
  • Previous by thread: Re: Script Objects - help please!!
  • Next by thread: Of files, lnks and existence
  • Index(es):
    • Date
    • Thread