Thread:
Definitions
n A thread is a basic unit
of CPU utilization.
n It is a light weight
process.
n If a process has multiple
thread of control, it can perform more than one task at a time.
n Seamless execution of two
or more sections of a program at the same time. Threads allows us to do this.
n Writing multithreaded
programs can be tricky,
n Although human mind can
function concurrently, people find it difficult to jump between parallel
thoughts.
n Why it is difficult to
handled multithreaded applications or programs, just see the example,
n Open three books to page
1, and try reading the books concurrently,
n Read a few words from book
1, then from 2 and then from 3rd one.
n Execute the same work
repeatedly.
n After this experiment, you
will appreciate some of the key challenges of the multithreading.
n i.e. switching between
books, reading briefly, remembering your place in each book etc are hectic at
the end.
n Thread possesses a subset
of the resources contained in a process, such as,
n Processor registers,
n Stack and other,
n TSD (thread specific data)
n Such as signal masks (data
that describes which signals a thread will not receive)
n Many OS supports threads,
n Win32 threads à used by MS-32 bit
Windows.
n C-threads à these are created from a
thread library in the MAC Microkernel.
n POSIX threads à Pthread standards
n Java threads à Thread Class / runnable
interface
n The primary goal of POSIX
is to allow Multithreaded programs to be portable across multiple OS platforms.
n POSIX has been implemented
in a variety of OS, Including,
n Solaris
n Linux
n Windows XP etc.
n
EmoticonEmoticon