Monday, June 7, 2010

My hbagh. trip for DSS analysis

Hi, i am currently doing a summer project on a DSS. We are designing this for a local company. You might not expect much of my photographs as i was the one taking them.

I really enjoyed the trip. These are some of the snaps to cherish.

Ready

We in the hostel ready for taking the trip. I, Ganesh [left] and RKS[right]. At least we are the permanent members.

IMG_2545

Walking by the countryside and hoping that our ride from BIT more does not be late. We had a walk of at least 30 minutes.IMG_2549

We got the ride but very late. The chauffeur woke up late. I don't understand, these chauffeurs sleep all day in their vehicle and still needs the night for sleeping, had i been a chauffer, i would have gone to strip clubs at nights. That snoring bastard kept us waiting in that heat for 90 minutes. Any way the journey is on.

IMG_2551You now came the humpy bumpy. In the highway connecting the hbagh. and ranchi, there is a coalmine which is on fire. The fire recently emerged in the road that caused the vehicles to either take a long route or a short route from the woods. As usual we chose to see the short one. That is through the woods. though the route was somewhat bumpy but was filled with natural beauty.

IMG_2555

IMG_2558

At last, we reached the destination.

IMG_2568IMG_2567

The office of e-nibandhan, Jharkhand Automated Registration System (JARS), Department of Information Technology, Government of Jharkhand. SRO – Hazaribagh.

IMG_2563[Look at the serious people, working]

We were enquiring the employers about the operation in practice. We were killing their precious time. Most importantly we got full support from the very employers in building something that is going to make their professional life miserable in the future.

IMG_2566

Our work was over in an about 1 hr or so, we were lucky to have less crowd and our question answer session was smooth.

Mr. Manish, the divisional head [not included in the photo] was of great help along with above operators. Their experience in this matter was unmatched and the speed of executing an ORD was unexpectedly awesome with accuracy.

We had prepared a list of question to ask. All were answered in a very detailed way with example. And an ORD was processed in front of us to make sure that we get the process.

  NOW ITS THE FUN TIMEIMG_2570 IMG_2573

At last we are back at Mesra.

IMG_2576

Wednesday, February 3, 2010

Operating System Lab Practicals

2 processes ‘A’ and ‘B’ consist of an alternating sequence of CPU burst and IO burst. Each burst is of 1 second duration. There are 10 CPU burst and 9 IO burst in each job. If job ‘A’ runs first than job ‘B’, how much time does is take to run the two jobs ‘A’ and ‘B’.
  How much time will the job ‘A’ take for completion?
  How much time will job ‘B’ take for completion?
  How much time does the CPU remains idle?
  What is the percentage utilization of CPU?
  If two jobs are multi-programmed we start with job A. How much time will it take?

/* CALCULATING THE TIME TAKEN BY THE TWO PROCESSES
*     AUTHOR     : Saurajeet Dutta
*     EMAIL        : <vention.gothics> AT <gmail> DOT COM
*     DATE         : JAN 26 2010
*     INSTITUTE : Birla Institute of Technology, Mesra
*     LICENSE    : FREE (as in freedom not as in beer)
*           THE COMPILATION USES POSIX THREADING LIBRARIES.
*           DEVELOPED IN openSuSE 11.2
*/

#include <stdio.h>
#include <pthread.h>
#include <stdbool.h>
#include <stdlib.h>
#include <time.h>

//MACRO SECTION
    #define SINGLE_PROGRAMMING 0
    #define MULTI_PROGRAMMING 1
//END MACRO SECTION

//GLOBAL VARIABLE
    unsigned short cpu_timeA = 0;
    unsigned short cpu_timeB = 0;
    unsigned short io_timeA = 0;
    unsigned short io_timeB = 0;
//END GLOBAL VARIABLE

typedef struct
{    unsigned short thread_id;
    bool mode;
} thread_control_block;

void * fnA (void * tcbA)
{    thread_control_block *myTCB;
    unsigned short cpu_burst= 10;
    unsigned short io_burst = 9;
    unsigned long localCtr = 0;
    int dummy, i;
    myTCB = (thread_control_block *) tcbA; 
    if (myTCB->mode == SINGLE_PROGRAMMING)
    {    for (localCtr = 0; localCtr < cpu_burst; localCtr++)
        {         cpu_timeA++;
        }
        for (localCtr = 0; localCtr < io_burst; localCtr++)
        {         io_timeA++;
        }
    }
    if (myTCB->mode == MULTI_PROGRAMMING)
    {    //CPU burst
        for (localCtr = 0; localCtr < 800000000; localCtr++)
        {} 
        sleep(9);
    }
}

void * fnB (void * tcbB)
{    int dummy, i;
    thread_control_block * myTCB;
    unsigned short cpu_burst= 10;
    unsigned short io_burst = 9;
    unsigned long localCtr = 0;
    myTCB = (thread_control_block *) tcbB; 
    if (myTCB->mode == SINGLE_PROGRAMMING)
    {    for (localCtr = 0; localCtr < cpu_burst; localCtr++)
        {            cpu_timeB++;
        }
        for (localCtr = 0; localCtr < io_burst; localCtr++)
        {            io_timeB++;
        }
    }
    if (myTCB->mode == MULTI_PROGRAMMING)
    {        sleep (9);
        for (localCtr = 0; localCtr < 800000000; localCtr++)        //an average machine takes about 10s of cpu burst to compute this loop
        {}  
    }
}   

int main (void)
{    pthread_t threadA, threadB;
    int retCode = 0;
    int total_time = 0;
    float eff = 0;
    time_t time1, time2;

    //create thread control block
    thread_control_block tcb1;
    thread_control_block tcb2;
    tcb1.thread_id = 1;
    tcb1.mode = SINGLE_PROGRAMMING;
    tcb2.thread_id = 2;
    tcb2.mode = SINGLE_PROGRAMMING;

    //entering single programming mode
    fnA ((void *) &tcb1);
    fnB ((void *) &tcb2);

    //analysing results
    total_time = cpu_timeA + io_timeA;
    printf ("\n\n\tSINGLE PROGRAMMING\n\tThe total time taken by process A is %d\n", total_time);
    printf ("\tCPU time for A is %d\n", cpu_timeA);
    printf ("\tIO time for A is %d\n", io_timeA);
    printf ("\tCPU idle time for A is %d\n\n", total_time - cpu_timeA);
    total_time = cpu_timeB + io_timeB;
    printf ("\tThe total time taken by process B is %d\n",total_time);
    printf ("\tCPU time for B is %d\n", cpu_timeB);
    printf ("\tIO time for B is %d\n", io_timeB);
    printf ("\tCPU idle time for B is %d\n", total_time - cpu_timeB);
    eff = cpu_timeA + cpu_timeB;
    eff /= cpu_timeA + cpu_timeB + io_timeA  + io_timeB;
    eff *= 100;
    printf ("\n CPU EFFICIENCY [SINGLE PROGRAMMING] : %f\n", eff);
    //creating thread a;
    tcb1.mode = MULTI_PROGRAMMING;
    tcb2.mode = MULTI_PROGRAMMING;
    time (&time1);
    retCode = pthread_create (&threadA, NULL, fnA, (void *)&tcb1);
    if (retCode < 0)
    {    printf ("Error in creating the thread.\n");
        pthread_exit(NULL);
        return EXIT_FAILURE;
    }

    //creating thread b
    retCode = pthread_create (&threadB, NULL, fnB, (void *)&tcb2);
    if (retCode < 0)
    {    printf ("Error in creating thread B.\n");
        pthread_exit(NULL);
        return EXIT_FAILURE;
    }

    pthread_join (threadB, NULL);
    time(&time2);
    printf ("The total time taken for execution of 2 threads is: %d", time2 - time1);
    eff = 20;
    eff /= (time2 - time1 + 1);
    eff *= 100;
    printf ("\n\n\t CPU EFFICIENCY [MULTITASKING]: %f\n", eff);
    return EXIT_SUCCESS;
}

Wednesday, January 13, 2010

About Me

Hi i am Saurajeet Dutta,

I am a student at Birla Institute of Technology, Mesra
I am a keen learner and a programming enthusiast,

I mainly code on linux.

Currently i am persuing my Masters at the same institute.

I got my First Job in Directi Internet Solutions Private Limited.
And i m working there since 4th Jan 2012.