Archive for the ‘Operating Systems’ Category

CPU Scaling and distributed.net

June 25th, 2011

Greg’s tip of the day!

I like to run distributed.net on my computers. I want the CPU frequency to stay pinned at the lowest possible frequency while distributed.net is running. I also want my computer to boost it’s CPU speed if I’m using it for something else. Using Linux, this is easy to accomplish. First you’ll want to make sure that distributed.net is running with a low ‘nice’ priority level (it does this by default). Secondly, you’ll want to add this to your /etc/rc.local:

echo 1 > /sys/devices/system/cpu/cpufreq/ondemand/ignore_nice_load

By doing this, you’re telling Linux to use the minimum CPU speed possible for programs with a ‘nice’ (e.g. low) priority level while giving it permission to boost the CPU speed if necessary for other software running on computer. Lower CPU speeds require less electricity and this leads to cheaper electric bills – both a good thing :)

One final caveat… after all that work, your computer will probably still use a few more watts than it would if it were completely idle at the lowest clock speed. This is because it is doing work that requires the CPU to use more circuits than it would in a normal idle loop. Caveat aside, you’ll still be using a lot less power than if your CPU were allowed to run at the top clock speed, and only a small amount more than it would normally idle!

Posted in Debian, Operating Systems | Comments (0)

Moving Files Using netcat and tar

June 25th, 2011

Time for an upgrade. I’ve got this (really old) box running OpenBSD 4.9:
real mem = 234561536 (223MB)
avail mem = 226095104 (215MB)
mainbus0 at root: SUNW,SPARCstation-5
cpu0 at mainbus0: MB86904 @ 85 MHz, on-chip FPU

And a new one running Debian that is a lot faster…

CPU0: Intel(R) Pentium(R) M processor 1.60GHz stepping 06
503MB LOWMEM available.

I need to copy around 100GB of data from the SPARCstation to the new server. The SPARCstation is able to push around 300KB/sec tops unencrypted over the network. Normally I’d be using rsync over ssh, but in this case, it will actually slow things down. So slow that it would literally take over a week to copy this data! The fastest way I’ve found is to use netcat and tar together. By using this combination I’m freeing up the CPU on the SPARCstation to do more important things like read data off of the disks and push it over the network!

Notice that I’m not using compression with tar… once again, sparky just isn’t fast enough :)


#Sender (SPARCStation)
tar cf - * | netcat receiver_host_name_or_ip 7000


#Receiver (new computer)
netcat -l -p 7000 | tar xv

Posted in Debian, Open BSD, Operating Systems | Comments (0)

Mailing Lists and Procmail

June 11th, 2011

I like having procmail sort my mail for me. In the case of mailing lists, the header of choice is the List-ID field. But there’s a problem… notice how each example below is slightly different. I want to pull the bold portion of the mailing list and use that as the folder name:

List-ID: <linux-kernel.vger.kernel.org>
List-Id: Learn about the Linux kernel <kernelnewbies.kernelnewbies.org>
List-Id: cocci.diku.dk

To get started, let’s state in English what we want to find: Dear procmail; please find the word that immediately precedes the first period in a line that begins with “List-Id:”

Finding these headers is easy with a regular expression… IF… you’re allowed to use look ahead: ^List-Id:.*?( (?!.*<)|<)([^.]*)

BUT, procmail doesn’t do look ahead :(

So let’s try with procmail’s regular expressions. Aside from look ahead/behind, there are two other major differences between procmail’s regular expressions and the rest of the world. First, procmail uses \/ to mark the portion of the expression that will be copied into $MATCH. Secondly, the part of the regular expression to the left of the \/ uses non-greedy matching. So when you write .* procmail treats it like .*? this is the feature that makes matching the three list headers I want to grab quite difficult.

With this in mind:
Matches the linux-kernel list:
^List-Id: *<\/[^.]*

Matches linux-kernel and kernelnewbies:
^List-Id: .*<\/[^<]?[^.]*

Notice the extra [^<]? which tells procmail that we want $MATCH to start after the < character. This is what allows the rule to find kernelnewbies without pulling < into $MATCH. This is necessary because procmail isn’t being greedy when it matches to the left side of \/.

Now, our remaining problem is the cocci mailing list. This one really makes life difficult. I decided that using a single regular expression just isn’t possible, so that means we’ll need two. One to grab the cocci mailing list and one to grab everything else. Here’s the completed procmail rule (note: I use Maildir and not mbox on my mailserver).

:0
* ^List-Id: \/[^.]+
{
        #list with <>
        #e.g. List-Id: Learn about the Linux kernel <kernelnewbies.kernelnewbies.org>
        #e.g. List-Id: <linux-kernel.vger.kernel.org>
        :0
        * $MATCH ?? ^.*<\/[^<]+
        .MailingLists.$MATCH/

        #list without <>
        #e.g. List-Id: cocci.diku.dk
        :0
        .MailingLists.$MATCH/
}

Posted in Debian, Open BSD, Operating Systems, Software Development | Comments (0)

Youtube problems with DroidWall

May 24th, 2011

Youtube isn’t working when DroidWall is enabled!? Here’s how to fix it:

First, enable YouTube in DroidWall (yeah, obvious). This lets YouTube do searches and the like. But videos still won’t play. To get them working, check the boxes next to “Media server” in DroidWall’s list of apps. There, all better :)

Tags:
Posted in Android | Comments (0)

Cyanogen Mod 7.0.3

May 21st, 2011

The apps on my phone which has been rooted and is now running Cyanogen Mod v7.0.3!  I’ve marked the apps in bold that are definitely must haves :) Next up, how to get dropbear running on the phone :)

  • Agenda Widget
  • Barcode Scanner
  • Bump
  • Compass
  • Connect Bot
  • Dolphin Browser HD
  • Droidwall
  • Google Maps
  • Google Street View
  • Google Sky Map
  • Google Voice
  • K-9 Mail
  • Listen
  • Netflix
  • Pandora
  • Ringdroid
  • Skype
  • Swype
  • Voice Caller ID
  • The Weather Channel
  • Youtube

Tags:
Posted in Android, Operating Systems | Comments (0)

OpenBSD Package Path

May 13th, 2011

Add this to your ~/.profile (or something a lot like it)
export PKG_PATH=ftp://ftp.openbsd.org/pub/OpenBSD/`uname -r`/packages/sparc/

It makes upgrading and installing packages a breeze – once you log in, the package path is setup automatically based on the release you’re running. The next time you use pkg_add, there’ll be no thinking involved and that’s a good thing!

Posted in Open BSD, Operating Systems | Comments (0)

Virtual Box

May 11th, 2011

I’ve been trying Virtual Box (currently 4.0.6) out for the past few weeks on Windows 7 x64. I’ve got to say it’s scary to use. Especially after I got some emails from the daily/weekly anacron runs last night which simply state “Segmentation fault” from a test VM that I setup and left running. Ouch! I’ve also observed other random virtual disk corruption…

The only problem here is that the killer feature that no one else “supports” is the raw disk access. I want to use this for my primary file server. Can I trust Virtual Box? Maybe… the file server is running Nexenta with ZFS  over two 1TB disks in a Raid 1 configuration… or I could leave it on real hardware where it has a real chance of working without any problems :)

Posted in Operating Systems, Windows | Comments (0)

kexec-tools

April 27th, 2011

This has been around for awhile, but I only recently learned of it. If you’re running linux (and only linux on your computer) then you might want to try installing kexec-tools (Debian/Ubuntu).

After you do this, your computer will be able to reboot without going through the BIOS POST tests. On my computer this speeds up the boot time by around 12 seconds!

Very nice!

Posted in Debian, Operating Systems | Comments (0)

Some Pretty Awesome Quotes

December 24th, 2008

Some funny quotes. An interesting article.

Posted in Operating Systems | Comments (0)

The User Doesn’t Want To Wait

December 9th, 2008

Too often user interfaces are muddied by this fact that seems lost on software developers. When I install software, I want to answer all of the questions UP FRONT and then let the computer do the dirty work. I should be able to leave without wondering if the computer will need babysitting later on! Not only should user interfaces do this, but they should INDICATE when they are doing this so that I know it’s safe to leave :)

Some prime examples:

  • Operating System Install
  • New Software Installation
  • Upgrades
    • Redesign debian apt-get to ask any and all configuration questions up-front! I realize there are technical challenges to this, but we’re software developers, and I’m sure there are harder things to figure out…
    • FreeBSD could do the same with portupgrade, etc…
    • Ironically, Microsoft has this just about right with Windows Update – although Debian is quite similar if you schedule a cron job to download and install the updates.
  • Microsoft Windows – Deleting files should be a background process (at least optionally). The file system should be able to mark a tree for deletion so that explorer doesn’t see it, etc… and then the delete should just happen. I don’t really care when it finishes! If the user wants to create a new file that conflicts with a file scheduled for deletion, then the OS should be able to deal with that too …

The goal should be to let the user do as much as possible in as short amount of time as possible. The software should save the time intensive tasks for later and manage them in a way that does not impact the user.

Posted in Favorites, Operating Systems, Software Development | Comments (0)