Monday, April 16, 2007

Some very silly question faced in day today life.

1. How to visualize the memory utilization in clusters ?
Ans : There is one usual way to use top and see the running process memory utilization.

2. Suppose one program takes lots of memory and one decided to put that onto the cluster.But he/she wants to see that the program should not exceeds the memory limits. so that one wants to visualize the memory used by the program and also the free memory.

Ans : one can use
prstat -p # see the RSS/Size of the process
If you want to look at system memory consumption, you could try running
vmstat or sar

3. Suppose you have a big process and you don't want it to run in the home as it affect your other process. So what could be solution ?
Ans : the solution will be run it into the cluster.

4. Now the actual question , suppose you have a process which requires some 14 GB from scratch. How do you handle such situation in the clusters ? (problem : if it doen't reserve space then sometimes the jobs runout of the space and the generated output files are not proper.)

Ans : One can use the command sqsub to the process manager. and this will submitt an executable script to the particular cluster only if it found the desired amount of space.

Thursday, April 12, 2007

Handling jar files

Following commands needs to be executed for various purposes in managing Jar files.
  1. jar cf jar-file inputfiles: It is used to create new JAR.
  2. jar tf jar-file: It is used to view all the files of the JAR.
  3. jar xf jar-file: It is used to extract the JAR.
  4. java -jar app.jar: It is used to run a JAR if the manifest file is present in the JAR. This manifest file contains the information of the file having main method.
Code to find the contents in the jar file:
    import java.io.IOException;
    import java.util.Enumeration;
    import java.util.jar.JarFile;
    import java.util.zip.ZipEntry;

    public class ExtractJar {
        public static void main(String args[]){
       JarFile jarfile = null;
       try {
           jarfile = new JarFile("test1.jar");
       } catch (IOException e) {
          e.printStackTrace();
       }
       Enumeration entries = jarfile.entries();
       while (entries.hasMoreElements()){
          ZipEntry entry = (ZipEntry)entries.nextElement();
          System.out.println(entry.getName());
          }
       }
      }