Monday Jan 20, 2014

Giving my blogs a new home - TechMasonry

I acknowledge that I have been very very slow at blogging recently ( if you are kind enough to consider 4 years to be recent in your timescale. :-) ). But with 2014 setting in, I have decided to reboot my blogging habit and give my blog a new start.


The first step that I am taking in this direction is to give my blog a new home. Now, I would be blogging at TECHMASONRY.COM


For last four-five years, I have been working exclusively with high-end technologies, using them as building blocks for designing and delivering mission critical solutions for large enterprises. The experience of doing so was very close to that of a mason, who uses bricks and stones and mortar and many other things to build those massive buildings, only that in this case, I was using technology. Hence the name - TECHMASONRY :-)


Hope the readers would continue to follow my blog on its new home. 


Tuesday May 31, 2011

Hello, World Again!

It is nice to be back on blogs.. it's been ages since I wrote my last entry and when I did, it was a blogs.sun.com blog.. now its on blogs.oracle.com! So a welcome change. I intend to keep the blogs updated so stay tuned.. And just for a kicker, check out this lovely wiki which eloquently demonstrate the capabilities of Crossbow, the newest kid in the Solaris town. And while going through this, you may as well want to download the "Network in the Box" Virtual Machine from OTN by going here.


Have any questions about Network Virtualization with Solaris 11? Just drop a comment below and let us get the discussion started! :-)

Saturday Nov 20, 2010

Deep Dive into what is new in Solaris 11 Express - Sysadmin wise!

Solaris 11 Express is now here for you to download! Keeping up the tradition of constant and relentless innovation, Solaris engineering team at Oracle has brought some great features into the hands of sysadmins, developers, IT managers and users. For this blog, I am pointing you to a particular Oracle Techcast video in which Rick Ramsey talks to Markus Flierl, Dan Price, and Liane Praza, from Solaris Core Engineering about what is new in Solaris 11 Express and discuss those features in depth which make the life of a Sysadmin and IT managers much easier!



This video is full of use cases and I strongly recommend you to watch the video if you want to learn more about how you and your organization can take advantage of the new features of Solaris 11 Express.


Just to give you a peek: Some of the features discussed in this video include



  • Solaris 11 Express can send you an email notification if a software of a hardware fails

  • How you can export a physical Solaris 10 instance into a Solaris 11 Express zone and run it without any modification

  • How you can do upgrades on Solaris 11 Express with a single command! 

And of course, much more! Enjoy! And for more such informative videos, check out the Oracle Solaris Video blog!

Tuesday Oct 26, 2010

My new start at Sun/Oracle

It was little more than 3 years ago that I joined Sun as a campus ambassador. Lot has changed since then, but one thing that still continues to be as it was is the fact that Sun is the best place to work for! Sun has the best "minded" and best "spirited" bunch of people and every day that I go to work, I come back with some new learning. 


Anyhow, now I am going to start a new innings at Sun/Oracle! I will be working as a Systems Engineer and will be based out of Mumbai! What does this mean? Well lots of things, but the most important one is, that I will get to work with Servers and Storage systems! And of course, I continue to get to work on Solaris!! What more could I ask for!! ;)


I am super excited about this new role and I am looking forward to go out in the field and do the thing that I like the most - advocating Sun (and now Oracle) technologies!!! :-)


Keep tuned to this blog as through this blog, I would now be sharing what I learn about systems!


Cheers!

Friday Aug 27, 2010

Using DTrace to profile function flows in your C programs

Quite often, you may would have come across scenarios where you would want to prepare a trace of your own program and understand what is the execution flow of a particular function in your C program. In this example I will show you how exactly you can do that using DTrace.



Here is a simple C Program which implements two functions (add and sub).


#include <stdio.h>
int add(int a, int b);
int sub(int a, int b);
int main()
{
    int a;
    int b;
    int c;
    printf("\\nEnter A and B: ";);
    scanf("%d%d", &a, &b);
    c = add(a, b);
    printf ("\\n Val - %d", c);

}

int add(int a, int b)
{
    return (sub(a, b));

}

int sub(int a, int b)
{
    int c = a - b;
    return (c);
}


Now I would like to trace the function add in this program and see what functions, in turn, are invoked when add is executed.



DTrace Code:


pid$1:test:$2:entry
{
    self->trace = 1;
}

pid$1::$2:return
/self->trace/
{
    self->trace = 0;
}

pid$1:::entry,
pid$1:::return
/self->trace/
{
}



I will my binary test (using -o flag) and I will be exacuting this
binary by ./test. In another terminal, I will execute this DTrace
script, which uses the pid provider.
Notice the probe description, the module part of it carries the name of
my program binary (this way only those function calls made in the
context of my program will be traced. If you leave the module part
blank in the probe description, all function calls (including system
calls) will be included in the trace).

Let us compile this application (I am using Sun compiler, you can use gcc as well)

kumar@sunsolaris:~/Desktop$ cc -o test myc.c


Now let us  run the DTrace script in another terminal window:


kumar@sunsolaris:~/Desktop$ dtrace -F -s myfunc.d `pgrep test` add



 And here is the output:



As you can see, the script tells me that add function calls sub. Just imagine your C application having 1000 functions, and the simplicity that you can bring to the whole debugging process if you can understand the flow with this ease.



Tuesday Feb 16, 2010

What Sun means to me...

This might very well be my last personal blog entry in this blogroll... But I got some stuff to share which I would love to talk about... I saw many people in last few days who spoke about how much they love Sun as a company... How much the respect the people who worked with them here and how they lived there whole adult life working for Sun and still love every day of it.. It did not take me long to fall in love with Sun as well.. When I joined Sun in 2007 as the Campus Ambassador for my university, I was still a student... and very fresh to almost everything which was even remotely corporate... But then not even on the first day of my work anyone made me feel that I am novice.. In past three years, I have worked on many assignments, most of them were in areas like Marketing, and Administration, in which I have no formal training.. But not even once I felt I cannot do it... People with whom I worked, they had some magical power in them which could infuse confidence... There is so much to say about everyone that I worked with that I wouldn't know where to stop. So I put together some of the pictures I took over during these years.. and I have put them in a video with my favorite song (My Brilliant Feat by Colin Hay) in the background... Those who shared these moments with me, will know the context and the beauty and passion that is attached with it...



I may not have worked for Sun for decades, but I still love this company. And I will love it forever. I am glad that it is the first company I ever worked for and that wherever Sun guys would go, they will bring positive energy, passion and daredevil-like attitude in abundance.! There is no stopping them! Ever!

Wednesday Feb 10, 2010

Fast Track to OpenSolaris minibook - Now available for download

EDIT: If you are having troubles downloading the PDF of the book from Scribd, you can download it from my personal server (follow this link).

Last month was pretty happening. I, in capacity of being leader for Mumbai OpenSolaris User Group (http://hub.opensolaris.org/bin/view/User+Group+mmosug/), spent last month working with the editorial team of Digit Magazine (http://www.thinkdigit.com) to come up with a minibook on OpenSolaris. Even though we got a very little time to finish a massive project like this, but with help of everyone, finally we could finish it in time and on the first day of this month (1/FEB/2010) 100,000 copies of the book- "Fast Track to OpenSolaris", along with a OpenSolaris CD with each copy, hit the newsstands all across the country! It took me 10 days to finish the book and it was the first time that I found myself writing a book of any sort.

Now Fast Track to OpenSolaris is available for download: http://www.scribd.com/doc/26659478/Fast-Track-to-OpenSolaris

Fast Track to OpenSolaris

Digit and Mumbai OSUG are jointly running a online Quiz competition (OpenSolaris Geek Hunt) at http://www.thinkdigit.com/opensolaris  Participate in this quiz to test your OpenSolaris skills and even win a Acer Aspire One Netbook, 1 TB or 500 GB external hard disk and many more OpenSolaris goodies!

OpenSolaris Geek Hunt


I hope you all like the quiz and enjoy the book. Please feel free to drop me a line if you find any errors in the book. Also, please note that I wrote this book as a OpenSolaris community member and not as a Sun Microsystems Inc employee. So all the views and opinion and facts mentioned in this book are essentially mine and Sun should not be held responsible for mistakes and errors, if any! Now go ahead and geek out with OpenSolaris!

Sunday Dec 20, 2009

What happens under the hood when you execute your C Programs?

I was a little curious to find out how my program gets executed. In order to find that out, I decided to write a simple c program which is here:



 #include <stdio.h>
int main()
{
    sleep(30);
    printf("Just testing an application!");
}



I have kept the sleep(30) in the beginning of the program so as to give me time to execute the DTrace script, about which I will be talking a little later.


Now i complied it with Sun Compiler and GCC



kumar@myosbox:~/Desktop/Demos$ suncc -o sunCCOutput simplec.c


kumar@myosbox:~/Desktop/Demos$ gcc -o gccOutput simplec.c



Now I wrote a simple DTrace script using the pid provider in order to figure out how printf is implemented (execution detail - functions which get invoked when printf function is called) in these compilers. The dtrace script is below:



pid$1::$2:entry
{
        self->trace = 1;
}

pid$1::$2:return
/self->trace/
{
        self->trace = 0;
}

pid$1:::entry,
pid$1:::return
/self->trace/
{
}



Now it was the time to execute this script and compare the outputs. I am going to redirect the output of this script into two text files (sunCCOutput.txt and gccOutput.txt).



kumar@myosbox:~/Desktop/Demos$ ./sunCCOutput 
kumar@myosbox:~/Desktop/Demos$ pfexec dtrace -F -s pid.d `pgrep sunCCOutput` printf > SunCCOutput.txt
dtrace: script 'pid.d' matched 6712 probes
kumar@myosbox:~/Desktop/Demos$ ./gccOutput
kumar@myosbox:~/Desktop/Demos$ pfexec dtrace -F -s pid.d `pgrep gccOutput` printf > gccOutput.txt
dtrace: script 'pid.d' matched 6714 probes



Now, the content of the file SunCCOutput.txt is as follows:



CPU FUNCTION                                 
1 -> printf
1 -> _setorientation
1 <- _setorientation
1 -> _ndoprnt
1 -> _findbuf
1 -> isatty
1 -> ___errno
1 <- ___errno
1 -> ioctl
1 <- ioctl
1 <- isatty
1 -> _setbufend
1 -> getxfdat
1 <- getxfdat
1 -> isseekable
1 -> ___errno
1 <- ___errno
1 -> fstat64
1 <- fstat64
1 -> ___errno
1 <- ___errno
1 <- isseekable
1 <- _setbufend
1 <- _findbuf
1 -> _realbufend
1 -> getxfdat
1 <- getxfdat
1 <- _realbufend
1 -> memcpy
1 <- memmove
1 <- memcpy
1 -> memchr
1 <- memchr
1 -> ferror
1 <- ferror
1 <- _ndoprnt
1 -> ferror
1 <- ferror


Contents of the file gccOutput.txt is as follows:



CPU FUNCTION                                 
1 -> printf
1 -> _setorientation
1 <- _setorientation
1 -> _ndoprnt
1 -> _findbuf
1 -> isatty
1 -> ___errno
1 <- ___errno
1 -> ioctl
1 <- ioctl
1 <- isatty
1 -> _setbufend
1 -> getxfdat
1 <- getxfdat
1 -> isseekable
1 -> ___errno
1 <- ___errno
1 -> fstat64
1 <- fstat64
1 -> ___errno
1 <- ___errno
1 <- isseekable
1 <- _setbufend
1 <- _findbuf
1 -> _realbufend
1 -> getxfdat
1 <- getxfdat
1 <- _realbufend
1 -> memcpy
1 <- memmove
1 <- memcpy
1 -> memchr
1 <- memchr
1 -> ferror
1 <- ferror
1 <- _ndoprnt
1 -> ferror
1 <- ferror

So you can see that there is no difference between gcc and suncc when if comes to implement the printf function. But its is so interesting to see that there are 19 function calls made everytime I use a printf in my c program! WOW! ;) I wonder if I could know it this easily if there was no Dtrace!

About

I am Abhishek and I work for Sun/Oracle! In this blog, I share my interest in systems, solaris, linux and other technologies :-)

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today