VMBuilder

November 12, 2006

I’m working on a new utility that is going to be able to create configuration files for both VMware Player and Xen virtual machines from the same tool. It’ll be written using C# on the Mono Runtime and Gtk#. I’m writing this because currently you’ve got to have VMWare Workstation installed on Linux to create machines for Player. The only utility that I’ve found that can create VMWare Player images is Windows based and doesn’t work with Wine. Hopefully I’ll have it ready for release in the next couple of weeks, the virtual disk spec from VMWare is extremely helpfull.


Fedora Core 6 and Wireless

November 5, 2006

Finally had the time this afternoon to figure out the setup of my wireless card, a Dlink DWL-G120 under Fedora Core 6.   Again i set it up using ndiswrapper instead of using the open source firmware that’s currently under development.  I did have to use the Conexant driver (the version is listed below) to get it functioning properly. The Dlink driver that’s on the CD doesn’t work with the new kernel version (and a new version of ndiswrapper).  I use the atrpms ndiswrapper packages to install ndiswrapper.

Conexant,04/06/2004, 1.00.15.0


Fedora Core 6 Mini Review

October 25, 2006

I upgraded my desktop to Fedora Core 6 which was released earlier this week.  Its a pretty sweet system.  One of the coolest features is that  booting and installing from USB devices finally works as advertised.  Installing from my USB hard drive took about 15 minutes, even faster than the network installations.  Gnome 2.16 is pretty sweet and Fedora has lots of new eye candy.

Most of the external repositories such as Freshrpms and Livna already have the majority of their RPMS built for FedoraCore 6, at least on i386.  This made a huge difference in pulling in alot of the smaller applications that don’t fall under the Fedora Extras umbrella, due to licensing restrictions or other reasons.

All in all it’s a great release and it is definitely worth the time and the hassle that sometimes come along with upgrading Linux distributions.


Fedore Core 5 and Ndiswrapper

October 8, 2006

So I’ve upgraded to wireless on my desktop because I’ve gotten to frustrated with having constantly run an ethernet cable from my bedroom through the kitchen to my living room.  I went with a Dlink DWL-G120.It’s a smaller USB 2.0 based network adapter with a long cable so you can move it to get the best possible reception.  The adapter is based on the prism54 chipset that does have some Linux support that is currently in development.  I chose to use Ndiswrapper to use the Windows driver because it will be more stable.

The driver that was included on the CD (Version 2.00) that came with the adapter did work after a little bit of work.  It didn’t work with the latest version of Ndiswrapper,  and the latest Fedora kernel but it did work with Ndiswrapper version 1.18 and kernel version 2.6.17-1.2187_FC5


Hello Ada

October 7, 2006

Here’s a simple Hello World program written in Ada.  Its as simple as any other Hello World program in most modern languages.

with Ada.Text_IO;

procedure Hello is
begin
Ada.Text_IO.Put_Line(“Hello, world!”);
end Hello;

To compile and execute this execute with gnat, with the make option.  gnat make and then that will create a hello execute that you can then execute like any other program.


A little bit about Ada

October 4, 2006

A lot of people have barely heard of Ada.  It’s an older language but has alot of features that aren’t found in many modern languages.  These features make it great for embedded systems and other large and very complex systems.  Some of these features include some of the features found in modern OOP based languages.  They include

  • Generics
  • Packages
  • Thread support

In addition to the features of most modern OOP languages it also has support for lower level hardware based programming that makes the code much more maintainable that C.  There are several different Ada compilers and IDEs available.  GCC contains support for Ada through the Gnat compiler.  There is also an IDE that integrates with Gnat called Gps.  It can be downloaded here.


Kernel Development

March 9, 2006

For the kernel hacking class that I’m in it looks like I’m going to be adding support for turnstiles to the Linux kernel.  Turnstiles can be found in Open Solaris and they are used in Semaphores instead of wait queues in Linux.  Turnstiles are different from wait queues because they also take priority into account when they are selecting the process that will receive the lock.  This helps solve the priority inversion problem.  I’ll also need to come up with a way to prevent process starvation.


Solaris Locking Primitives

March 6, 2006

Mutexes – There are two types of mutexes that are currently implemented in the kernel. They are spin and adaptive mutexes. Adaptive mutexes are designed to either spin or block when a lock is held; depending on what state the holder of the lock is in. Spin locks have to be used in high-level interrupt handlers, because blocking means you are forced to have a context switch.

Conditional Variables – Conditional variables are kernel thread level synchronization primitives. These are implemented as a structure, and they also use a mutex to provide the locking ability. The mutex is passed into the functions as necessary, it is not part of the conditional variable structure.

Semaphores – The semaphores that are included in Solaris are standard counting semaphores that we’re used to using. They should be used in situations that the speed of mutexes and rwlocks aren’t necessary. The fact that they are a counting semaphore makes it very natural for them to be used for resource allocation and deallocation. They also use standard sleep queues, unlike mutexes which use turnstiles when the processes block on a given resources.
Contracts – These are a much more complicated synchronization primitive. There main purpose to help enrich the relationship between a process and the system resources. These system resources can include pages, threads, and they can also be used for asynchronously reporting errors to a process. This primitive depends on the contracts file system to provide an interface to user level processes. Contract types are used to implement the different relationships between processes and system resources.

Turnstiles – Turnstiles are another synchronization primitive that provide blocking and wakeup support, and priority inheritance for synchronization primitives, which include mutexes and rwlocks. This is very similar to the linux kernel wait queue, but the difference is that this helps prevent priority inversion. It does this be supporting priority inheritance and not being a standard FIFO data structure like the linux kernel wait queue.

Dispatcher Locks – This is a type of kernel locking primitive that is specific to the Solaris scheduler. There are two types of these locks they are spin locks and locks that also have the ability to raise the priority level of a process. They are used almost exclusively in the scheduler, they see extremely limited use in other parts of the kernel. This is needed because you cannot handle interrupts when you are modifying the dispatch queues. This is very similar to Linux spin locks that also disable interrupts on the system. This is a one byte data structure that also has the ability to disable the irqs and is implemented in assembly language all platforms.


Using MDB, the Modular Debugger

February 27, 2006

MDB or the modular debugger is used for extremely low level debugging. It falls into the category of debuggers that are used in combination with core files and the platform assembly language to diagnose and correct problems. Its main use is for analyzing the state of the program that you are running at the assembly language level.
MDB allows programmers to implement modules that will execute commands while you are debugging your programs. There are already modules for kernel, and device driver debugging that are included with Solaris. Using the kernel debugging modules you can do the following things:
• Locate a kernel thread’s memory
• Print a picture of a kernel stream
• Determine the type of structure that an address points to
• Detect memory leaks
• Locate stack traces

MDB currently supports debugging and examining the following targets.
• User level processes
• User level core files
• Viewing operating system execution using /dev/kmem and /dev/ksyms
• Controlling operating system execution using kmdb
• Kernel crash dumps
• Elf object files
• Raw data files
To start the kernel level debugger kmdb you should start mdb with the –k option.

Debugging Kernel Crash Dumps:

When the Solaris kernel crashes it will leave a core file in /var/crash on the system that has crash. The debugger needs to be invoked on a system that is the same architecture and solaris version as the system that crashed. If you do not do this then debugging will not work.

Command What it does
::showrev Prints the kernel version information
::status Prints the module and cause of the kernel panic
::panicinfo Prints the registers and there values at the time of the panic
::msgbuf Shows the content of the kernel message buffer
$C Prints a kernel level stack trace for the kernel thread that had the kernel panic
Functionname::dis Prints the disassembly of the function that you specify.
::cpuinfo Shows a large amount of information about the cpus in the system.
::threadlist Prints a listing of all the kernel threads that are available in the kernel
::findleaks Helps detect memory leaks. Needs a decent amount of kernel options turned on at build time.
::vatopfn Translates a virtual address to a physical address
::whatis Determines if the address is a pointer to a buffer or a different type of special memory region

Using the Kernel Modular Debugger:
KMDB is extremely powerfull. It not only allows you to view what is going on in the system at the instruction level, it also allows you to modify the values of those instructions and execute your own instructions. There is no safety net, you can do whatever you want on the system.

There are two ways to start kmdb on the system that you are trying to debug. The first one is to start mdb with the –k option from the system’s console login. The second one is to pass the –k option to the kernel boot arguments. On the x86 platform you can do this be modifying the grub configuration file. Also if you need to set any breakpoints for the boot process you can supply the –d flag and the kernel will enter the debugger so you can set kernel variables and breakpoints to the values that you want. If you are working on the SPARC platform you can pass the options at the boot prompt, but you must also specify the command kmdb.

The commands that are used for debugging kernel crash dumps can also be used when you are debugging the kernel.


Nexenta Review

February 22, 2006

Install:

The installation of Nexenta isn’t exactly the easiest thing in the world, but it’s not the hardest. It’s on par with a more advanced Debian installation. My only real gripe with the installer was it was slow. It took 2 hours to install under VMWare with no other programs running. That’s just way to much, especially when I can install Fedora in about an hour and a half and install my complete development environment.

User Interface:

The user inteface is the quite similiar to Ubuntu. It is based on it after all. The only other thing that annoyed me was the fact that they still included all the KDE applications in the Gnome menus and they didn’t bother to put them in another submenu. It just seems to clutter everything up and really bother me.

Package Management:

Nexenta uses apt for its package management.  This is much better and easier to use than the regular Solaris tool, pkg-add which doesn’t fetch any of the dependencies when you go to install a package.  One thing that I found disappointing is that they don’t have a package of the Sun Studio Compilers.  You’ve got to go and download it yourself, they have gcc as the default which doesn’t easily build open solaris kernels.  You’ve got to have some extra tools and packages.

Overall Nexenta is a pretty decent Unix distribution.  It is a huge step up from Open Solaris and the Java Desktop System.  It just can’t really compare to most of the Linux distributions that are available, especially in the installation process.