process-thread-model

March 13, 2009 at 6:59 am 1 comment

I had to overcome with acute nostalgia as i write this blog . I couldn’t resist myself penning some of my hilarious moments of  yesteryears at the company.

It was just over a couple of months that i had joined as a new recruit, a fresher in an MNC. This was a transitional phase for me from juvenile student world to a more responsible, money and business centric corporate world. aha! … everything you see and do at office was new, starting from the Macintosh Imac computer that i was using(which i had never seen i my entire life) to the all new cubicle i had to sit. It was truly an amazing experience with sense of achievement in the air all the time.

my iMac

I was the youngest in terms of age in the team with no prior work experience. So my manager designated one of my colleague, who was actually the best in the business, be it technical or management, to mentor me. Well …  he was actually  (tor)mentor to me . Under his guidance i went on to understand Unix Operating System and its Internals. During this training there was one particular topic which i have to mention was to learn about UNIX Processes and Threads.  The OS definition of Process — is an instance of a program under execution which is competing for a resource in the Operating System.  I read and wrote some tutorial programs  just to get some hands on.

That afternoon i was going for lunch when i saw a good looking female (with all due respect) walk past me with her male colleagues. She was in the center with others walking on the either sides of her. I stared at them for a moment and observed that all her male counterparts were trying to talk with her and never among themselves( I know that’s obvious ). Then suddenly a real weird idea stuck my head. They formed what i call the “PROCESS-THREAD MODEL”. I had read in some book that processes are just like human beings and they generate one or more  child process and threads and i was imagining this line as i saw process and its threads in perfect sync LIVE. For me the lady was like  a process which had spawned 5 threads. Conceptually, threads exists with in a Process and in Unix world you create a thread with this system call
pthread_create(&thread_id, NULL, &talk_to_process, NULL);
all threads are identified by their thread ID’s and upon creation of thread they execute thread function talk_to_process.

As days passed by there was instances when the lady stopped talking to few of her colleagues. So i thought probably  the thread behaved in an undefined  manner so she (process) might have terminated the thread by passing it’s thread ID to 🙂
pthread_kill(pthread_t thread, int sig);

To create a new process fork() system call is used. The process that invokes a fork() will be the parent, while the new process is the child.  Again conforming to my PROCESS-THREAD MODEL a few months later she forked() and gave birth to a child process.  Isn’t it amazing to see how Unix  is so close to our human lives .Hopefully my (tor)mentor would be pleased if i say that i never forgot this concept after this. Last but no the least heaps of thanks to our lady … “SHE PROCESS”.

— Go Green, Save a Tree —

Advertisements

Entry filed under: Uncategorized.

Making Money Many Happy Returns World Wide Web

1 Comment Add your own

  • 1. Sachin  |  March 14, 2009 at 3:56 pm

    Gedde!

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Trackback this post  |  Subscribe to the comments via RSS Feed


March 2009
M T W T F S S
« Feb   Apr »
 1
2345678
9101112131415
16171819202122
23242526272829
3031  

%d bloggers like this: