Twitter Delicious Facebook Digg Stumbleupon Favorites More

Sunday 4 September 2011

Thread in Operating System

Threads

As we all know that a Process is a single execution entity i.e a single thread of execution. If a process running as a word processor program then for a single thread of such process we can do only the job of writing at a time but we can't run a spell checker at the same time.

Hence we can define a Thread as    Thread is a single flow of execution or we can say that, Thread  is a light weight process.
So why we say Thread as light weight process. If we recapitulate our concept of process ( or you can take a look). Process is a combination of stack, code, data, file, PCB and since every Thread of that process share the code, data, file section and it has its own set of registers and stack.
Hence we can can do lots of work using multithreading technology at the same time, now a days most of the softwares are multithreaded just like a server which takes lots of request for different pages and provides one Thread for each one of them.
Using multithreaded processes in multicore environment is very beneficial, since two different works are happening at the same time on different processors, and using this speed of the execution increases with high reliability, since if one thread stops working process do not stop and user doesn't feel any overhead.  But the disadvantage of this is, If there is a program running parallel on multiple core so there are different execution paths hence it takes hard time in debugging.

0 comments:

Post a Comment

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Blogger Templates