[net.unix-wizards] vi & heavy loads

Robert_Toxen%anvil.UUCP@harvard.arpa (07/12/86)

A simple solution that I've implemented to allow reasonable response for
vi on a system with heavy loads such as lots of compiles and nroffs is
as follows.

Rename vi vi_foo. Create a program called vi, set-UID to root that boosts
its niceness to -10 and lock itself into core (for those UNIX versions
allowing such things), set its effective UID to its real UID, and exec
vi_foo with vi's arguments.

Even with those versions of UNIX that don't explicitly have the "lock in
core" feature you can fake it by copying code from ps that will find a
process's process table entry and find its flag word. Then turn on one
of the lock bits, perhaps the one for "lock in core for pending physical I/O".
Since vi doesn't do such things, this bit won't be cleared and viola you've
implemented the feature.

I don't have the source any more.

Bob Toxen
Stratus Computer
{ucbvax!ihnp4,harvard}!anvil!bob        (Please use THIS address to reply)
"panic: can't happen"

news@seismo.UUCP (07/14/86)

Great. The first thing I'll do when I log in is run vi, then
escape to a shell. Then my compiles won't take a long time either.

---rick

Robert_Toxen%anvil.UUCP@harvard.arpa (07/18/86)

Steps should be taken to prevent subshells spawned from vi from also running
at -10 priority. Since we all used csh (why would anyone use the other shell
[flames to /dev/null please]) we just added 'nice 0' the our .cshrc files.

Paranoid types and sh users can diddle vi appropriately.

Bob Toxen
Stratus Computer
{ucbvax!ihnp4,harvard}!anvil!bob        (Please use THIS address to reply)
"panic: can't happen"

guy@sun.uucp (Guy Harris) (07/19/86)

> Steps should be taken to prevent subshells spawned from vi from also running
> at -10 priority. Since we all used csh (why would anyone use the other shell
> [flames to /dev/null please])

Fine.  That statement was itself a flame; why wasn't it sent there?

> we just added 'nice 0' the our .cshrc files.
> 
> Paranoid types and sh users can diddle vi appropriately.

Since this "step" is voluntary, why "should" these steps be taken?  To be
"nice" (pun only partially intended)?  Sorry, but most administrators are
probably (to use your misapplied word) "paranoid".  Any admin who sets up
"vi" to run at -10 priority (Heaven help you if it goes into an infinite
loop, unless your shell is running at better than -10 priority when you type
"kill" at it), and doesn't *enforce* that it won't give this priority to
subshells, deserves to have the knowledgable users abuse the hell out of
such a facility.
-- 
	Guy Harris
	{ihnp4, decvax, seismo, decwrl, ...}!sun!guy
	guy@sun.com (or guy@sun.arpa)