Tuesday, January 10, 2012

HTML5 Portal

I have just started a new site which will aggregate articles from various sites. Visit it at www.html5portal.net

Thursday, October 29, 2009

I Hava a New Blog

This blog was not an active one :( You can visit my new blog Weird Sofware Engineering, Java and Me. I promise that my new blog will be more active. I will share my experiences in Software Engineering, Java, RTSJ, Operating System and other technical stuffs.

Tuesday, January 20, 2009

My Open Solaris 08.11 Experience

Today I have decided to give a try to open Solaris 08.11 on my old notebook with 734M RAM and and Pentium M CPU. It is a 4 years old computer. I am writing this blog on my newly installed open solaris machine.

My previous experience with Open Solaris was 1 yeara ago and I stopped using it in a few days due to various problems with wifi, sound and general system stability. It somehow stop booting from time to time and fall back to maintenance console after boot-up.
I have downloaded bootable cd through torrent, and I am still seeding it. Booting from bootable cd was very easy, only questions asked were which language to use and keyboard layout. After that I decided to install by using the desktop icon placed for this purpose. Again it was very easy, only critical question is which partition to use.

Open Solaris comes with a automatic wifi configuration application. Although it successfully found my network it somehow could not get an IP address from my ADSL router. So I have switched to manual network configuration.
1) added id address and hosname to /etc/hosts
192.168.1.187 jazz
2) added ip address to /etc/hostname.iwi0 (iwi0 is name of my network interface, yours may be different)
192.168.1.187
3) added open dns name servers to /etc/resolv.conf
nameserver 208.67.222.222
nameserver 208.67.220.220
4) added dns option for hostname resolution to /etc/nsswitch.conf by changing following lines
hosts: files dns
ipnodes: files dns

Although gnome volume control applet is added there were no sound. So I have downloaded Open Sound system. Installed it using pkgadd -d oss-solaris-v4.1-1051-i386.pkg and rebooted (there is no package for v5). After reboot volume control applet is gone and there were no sound either. I have reinstalled the application. Tested it osstest and sound works :)

I have visited youtube and there were no flash player installed :( I have downloaded flash player for solaris from Adobe site and put it in /usr/lib/firefox/plugins/ folder. After restarting firefox flash 9 was working fine :)

Java 6 update 10 and plugin for firefox were already installed. Now I am installing RTSJ 2.1 90 days evaluation version.

The biggest thing about open solaris is ZFS. I am using zfs-fuse on my Ubuntu machine. Although it works perfectly I want to try a native ZFS implementation. This was the reason I am trying opensolaris from time to time. ZFS already saved my home folder several times and I can not consider storing my files in any other file system. Open Solaris also contains an application called "Time Slider" which takes automatic zfs snapshots from time to time. With zfs-fuse you can not use zfs on you root partition but open solaris uses zfs on root partition.

One little thing, I could not get compiz running in my old notebook with Intel GMA 950 onboard card, although I haven't tried much yet.

Sunday, February 3, 2008

Preparing for Real Time Java Development

To start development with Real time java you need suitable virtual machine and a real time operating system that meets criterias required by your virtual machine.
Specification of real-time java is defined through JSR 1 and JSR 282 (small improvements). As far as I know there are four compliant implementations.

  • Sun's Java RTS : Current version is 2.1. It supports real-time Linux on x86 and Solaris 10 on x86 and sparc. Although previous versions did not have a real-time garbage collector (a more predictable garbage collector), latest version has one. More information can be found at : http://java.sun.com/javase/technologies/realtime/
  • IBM's Websphere Realtime : Current version is 1.0. It only works only on real-time Linux. In addition to real-time java specification it contains a real-time garbage collector (metronome) and supports a head of time compilation. These two features are not required by real time java specification. More information can be found at : http://www.ibm.com/software/webservers/realtime/
  • Aonix' PERC : Has different versions Ultra, Pico and Raven. It has also a real-time garbage collector, and supports a head of time compilation. More information can be found at : http://www.aonix.com/perc.html
  • Timesys' RTSJ Reference Implementation : This is reference implementation and can not be used in production environment. But you can use it four practice. More information can be found at : http://www.timesys.com/java/

STEP 1 : Install Real Time Linux Kernel

I think the easiest way is to install ubuntu and later download a real-time extensions by following the instructions at http://wiki.ubuntu.com/RealTime. It is very simple, just execute apt-get just like installing a normal application. After that reboot your machine and select real-time kernel at startup from grub menu.


STEP 2 : Download and Install a Real Time JVM

You can obtain a 90 day fully working evaluation version of Sun' RTS 2.1 for Linux by registering with Sun's developer network. Just fill the Sun Java Real-Time System Survey form and a download link will be mailed to you. Althoug it is not supported on ubuntu, as far as I see it is working.
You may use other versions but I could not recomend working with Timesys reference implementation because it based on a very old virtual machine and does not support new classes and feature after java version 1.3. Sun's implemantation is fully compliant with JDK 5.0. Actually all RTSJ compliant implementations are required to pass test for JavaSE 5.0. That means you can run your JavaSE 5.0 applications as unmodified on a RTSJ compliant virtual machine by enjoying more determinism provided by real time garbage collector.


STEP 3: Prepare Eclipse

Open Window->Preferences and add Java RTS to Java->Installed JREs. Real time classes are in rt2.jar file in Sun's implementation. Right click on this file in eclipse and add javadoc located in RTS_INSTALLATION_FOLDER/doc/rtsj-docs as javadoc for this jar file.


STEP 4 : HelloRealTime

Following program will schedule a real time thread at every 100 miliseconds and put current time in an array allocated from immortal memory. At the end prints content of this array.

import javax.realtime.ImmortalMemory;
import javax.realtime.PeriodicParameters;
import javax.realtime.RealtimeThread;
import javax.realtime.RelativeTime;

public class HelloWorld extends RealtimeThread {
//allocate long array from immortal memory
public static long[] times = (long[]) ImmortalMemory.instance().newArray(long.class, 100);

public HelloWorld(PeriodicParameters pp) {
super(null, pp);
}

public void run() {
for (int i = 0; i < 100; i++) {
times[i] = System.currentTimeMillis();
waitForNextPeriod(); //wait for next period
}

}

public static void main(String[] argv) {
//schedule real time thread at every 100 milisecond
PeriodicParameters pp = new PeriodicParameters(new RelativeTime(100, 0));
HelloWorld rtt = new HelloWorld(pp);
rtt.start();

//wait real time thread to terminate
try {
rtt.join();
} catch (InterruptedException ex) {
ex.printStackTrace();
}

//print results
for (int i = 0; i < 100; i++) {
System.out.println(times[i]);
}
}
}

Resources