Wednesday, 30 December 2015

Embedded Operating System Notes - Unit 1

1. Real Time Tasks :
i) It is a task in which performance is judged on the basis of time. It means computation is correct only if it has produced its correct output within specified time constrained.
Correct Result = Correct time + Within Specified time

ii) Failure to time constraint is designated either as system failure or reduced value of quality of service
Following are the examples with real - time tasks are -
           - Robotics
           - Air traffic control
           - Weapon guidance system
           - Telecommunications
           - Medical diagnostic & life support systems
           - Anti - lock banking system
           - Real time database
In all the above applications time is important parameter. Eg. In Air traffic control, aircraft are guided accurately for landing & navigation. Any delay in response will result in disaster in terms of human life.0

 

1.1 Real Time Video / Speech Processing
i) A moving picture or speech sample of 1 second is processed in 1 second makes real time processing. If it takes more than 1 second then it is not a real time processing.

1.2 Are Real time and Embedded systems same?
i) No. Embedded systems are designed for specific set of applications. When such system requires time constraint operation, it becomes real time embedded system.
ii) All embedded systems are not real time. For Eg Printer is example of embedded system but it not a real time where as Robot is an exaple of real time.


Terms :
1. Ready Time 
Time instance at which task is ready for execution.

2. Scheduling Time
Time instance at which task gets chance to execute.

3. Completion Time
This is time at which task completes its execution.

4. Deadline
This is instant of time by which execution of the task should be completed.

5. Run Time
Time taken to complete the task without any interruption.

6. Tardiness 
Amount of time by which a task misses the deadline. It is difference between completion time instance and deadline. 

7. Laxity
Laxity of task is maximum amount of time it can wait & still meet its deadline.




Thursday, 8 October 2015

Program to classify data using weka tool


package weka.api;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
import weka.classifiers.trees.J48;
import weka.core.Instances;

public class Classify{
public static void main(String[] args) throws Exception
{
    BufferedReader breader = null;
   
    breader = new BufferedReader(new FileReader("/home/sonali/11.arff"));

    Instances train = new Instances(breader);
    train.setClassIndex(train.numAttributes() -1);
    breader = new BufferedReader(new FileReader("/home/sonali/22.arff"));
    Instances test = new Instances(breader);
   
    test.setClassIndex(train.numAttributes() -1);
    breader.close();
   
     J48 tree = new J48();
   
    tree.buildClassifier(train);
       
    Instances labeled = new Instances(test);
     
   
    for(int i=0;i< test.numInstances();i++)
    {
        double clsLabel = tree.classifyInstance(test.instance(i));
        labeled.instance(i).setClassValue(clsLabel);
       
     }
    BufferedWriter bwriter =  new BufferedWriter(
            new FileWriter("/home/sonali/labeled1.arff"));
    bwriter.write(labeled.toString());
    bwriter.close();
  }
}


Steps to run the program - 




   
   

Wednesday, 7 October 2015

Program for Recursive Descent Parser

#include<iostream>
#include<string.h>
#include<ctype.h>
#include<stdio.h>

using namespace std;


class recursive
{
public:
char in[20];
int j,error;
void E();
void F();

};

main()
{ recursive obj;
  obj.j=0;
  obj.error=0;
  cout<<"Enter an arithmetic expression   :  ";
                cin>>obj.in;
  obj.E();

if(obj.in[obj.j]=='$' && obj.in[obj.j+1]=='\0')
       cout<<"\n String Accepted. . !!\n";
 else
       cout<<"\n String Rejected. . !!\n";
}

void recursive::E()
{
  if(isalpha(in[j]))
 {  j++;
    F();
 }
}


void recursive::F()
{ if(in[j]=='+' && in[j+1]!='$')
 { j++;
   if(isalpha(in[j]))
   {
     j++;
     F();
   }
 }

}


Explaination :-

Grammar - E -> iF
                  F -> +iF /


 i is any alphabet from a to z.
Accepted Strings - i+i$ , i+i+i$ , . .etc
Rejected Strings - i++, (i), ++i . . etc

In recursive descent parser, for every variable, we are gonna write a function. In function E(), if first symbol is alphabet then increment pointer to next location and call F().
       In function F(), if first symbol is +(plus) then increment pointer to next location and if next symbol is again alphabet then increment pointer and call F().
    



















Embedded Operating System Notes - Unit 1

1. Real Time Tasks : i) It is a task in which performance is judged on the basis of time. It means computation is correct only if it has...