vankuik.nl RecentChanges 2012-02-08 XML TXT

OS X

Process priority

You use the terminal to give a process a lower priority. To give a certain process a lower priority, first find the process ID (hereafter: pid), then lower its priority:

  $ top

(In top, type 'ocpu' to sort on CPU usage. The first column gives you the process ID.

 ID    COMMAND      %CPU  TIME     #TH  #WQ  #PORT #MREG RPRVT  RSHRD  RSIZE  VPRVT  VSIZE  PGRP  PPID
 30395  aircrack-ng  192.0 03:13:26 4/2  0    34    38    6272K  240K   6436K  33M    2394M  30395 28154

Remember the process ID, then type 'q' to exit top. Now use the 'renice' command as follows:

  $ sudo renice -20 -p 30395

Note that the first parameter after renice is different from what you're used to on your Linux system. -20 means: relatively decrease to the lowest priority, while 20 means: relatively increase.

Use the ps command to see if it worked:

 $ ps -l
  UID   PID  PPID        F CPU PRI NI       SZ    RSS WCHAN     S     ADDR TTY           TIME CMD
  502 28154 28153     4006   0  31  0  2435764   1836 -      S     81c8a80 ttys000    0:00.30 -bash
  502 30395 28154     4006   0  51 -20  2451444   6436 -      R<+   9f8aa80 ttys000  190:47.41 aircrack-ng -a 
  502 24840 24839     4006   0  31  0  2435764   1808 -      S+    aa512a0 ttys001    0:00.10 -bash
  502 28315 28314     4006   0  31  0  2435764   1840 -      S     81b52a0 ttys002    0:00.37 -bash

As you'll see in the PRI column, the priority has been lowered by twenty points. The NI (nice) column reflects this relative decrease.

After installation

My basic steps after installation:

Then, I disable Bonjour advertising:

 sudo defaults write /System/Library/LaunchDaemons/com.apple.mDNSResponder ProgramArguments -array-add "-NoMulticastAdvertisements"

Using rsync for backups

To back up to a remote Linux server, use rsync.

 for i in ~/Pictures ~/Documents "/Volumes/External Drive/Pictures"
 # Use the --exclude flag to skip certain directories
 # --exclude "Vuze Downloads"
 do
   if [ -d "$i" ]
   then
     rsync -av "$i" user@remotemachine:/mnt/data/backup
   fi
 done

Tips & Tweaks

If you run OS X from a small SSD drive, you'll probably want to reclaim lots of space. First, reclaim 4 GB from the following link:
Optimizing OS X for SSD drives

Then disable secure virtual memory:
Disable secure virtual memory

You can also (temporarily) disable virtual memory altogether as per this link:
How to disable virtual memory

If you want to place your swapfiles some place else rather than on the SSD drive, use the information on this link:
[1]