shoes – A cross-platform Windowing Applikit

Posted on in Categories GNU/Open source, Linux, Linux desktop, Open source coding, OpenBSD, OS X, package management, programming, RedHat/Fedora Linux, Ubuntu Linux, Windows, windows vista last updated August 16, 2008

Shoes is a very informal graphics and windowing toolkit. It’s for making regular old apps that run on Windows, Mac OS X and Linux. It’s a blend of my favorite things from the Web, some Ruby style, and a sprinkling of cross-platform widgets. Shoes uses Ruby as its interface language.

ktrace – FreeBSD / Mac OS X Process Tracing and Reporting Tool

Posted on in Categories FreeBSD, Howto, Monitoring, OpenBSD, OS X, programming, Sys admin, Troubleshooting last updated April 16, 2008

Under Linux you can use strace or valgrind tool for reporting and finding a bug. However, under *BSD / Mac OS X you need to use ktrace as replacement for strace tool.

kreace runs on the following platforms:
=> FreeBSD
=> OpenBSD
=> Mac OS X
=> NetBSD

The ktrace utility enables kernel trace logging for the specified processes. Kernel trace data is logged to the file ktrace.out. The kernel operations that are traced include system calls, namei translations, sig nal processing, and I/O. Once tracing is enabled on a process, trace data will be logged until either the process exits or the trace point is cleared. A traced process can generate enormous amounts of log data quickly; It is strongly suggested that users memorize how to disable tracing before attempting to trace a process.

To trace all kernel operations for process id # 2546, enter:
$ ktrace -p 2546
To disable all tracing of process # 2546, enter:
$ ktrace -cp 2546
To disable tracing on all user-owned processes, and, if executed by root, all processes in the system:
# ktrace -C
Attach to process id # 123 and log trace records to myapp.dbg.log instead of ktrace.out.
$ ktrace -p 123 -f myapp.dbg.log
To enable tracing of I/O on process # 123
$ ktrace -ti -p 123
The -t option is very useful to trace various kernel trace points, one per letter. The following table equates the letters with the trace points:

  • c : trace system calls
  • n : trace namei translations
  • i : trace I/O
  • s : trace signal processing
  • u : userland traces
  • w : context switches
  • + : trace the default set of trace points – c, n, i, s, u

Run the command called myapp and track only system calls, enter:
$ ktrace -tc ./myapp
Please note that the output of ktrace is not as informative as strace, but it does help to solve many problems.

truss: trace system calls

FreeBSD has another tool called truss. It traces the system calls called by the specified process or program. Output is to the specified output file, or standard error by default.
Attach to an already-running process # 123, enter
$ truss -p 123
Follow the system calls used myapp
$ truss ./myapp -d /tmp -f 120
Same as above, but put the output into a file called /tmp/myapp.dbg
$ truss -o /tmp/truss.out ./myapp -d /tmp -f 120

strace under FreeBSD

You can install strace under FreeBSD and other *BSD like oses.

Further readings:

  • ktrace man page
  • truss man page

DIY: Create Robots with Linux

Posted on in Categories Hardware, Linux, programming last updated March 26, 2008

ASIMO is a humanoid robot manufactured by Honda which is quite high tech and expensive gadget. You can hired out it for US $166,000 per year. However, as usual Linux provides you an opportunity to build your own robot. Linux-based robots are tricky to create, but Michael Surran’s Robotics class found out it can be done:

Robots have been a passion of mine since I was a child, so imagine my excitement when I was given the opportunity to add a robotics class to our high school’s computer curriculum! We recently celebrated our second year of offering robotics at Greater Houlton Christian Academy (GHCA), the school where I teach. During this time, we’ve produced three different robots, each based on a PC running Linux. We work with a tight budget, so we have to be creative in our design, use of materials and tools. This results in robots that any do-it-yourself hobbyist can build.

Though, this article doesn’t give step-by-step instructions on how to build a DIY robot. It proivdes some getting started hints. Linux and robotics are a perfect combination!

=> Do-It-Yourself Robots with Linux

Programming: Understanding Linux Completely Fair Scheduler

Posted on in Categories Links, Linux, programming last updated January 11, 2008

The new Linux scheduler extends scheduling capabilities by introducing scheduling classes and also simplifies debugging by improving schedule statistics. Completely Fair Scheduler (CFS) is getting good reviews when tested for thread-intensive applications including 3D games. CFS handles CPU resource allocation for executing processes, and aims to maximize overall CPU utilization while maximizing interactive performance. CFS considered as the first implementation of a fair queuing process scheduler in a widely used general-purpose operating system.

The Linux 2.6.23 kernel comes with a modular scheduler core and a CFS, which is implemented as a scheduling module. In this article, get acquainted with the major features of the CFS, see how it works, and look ahead to some of the expected changes for the 2.6.24 release.

=> Introducing the CFS for Linux