process is a execution of a program and program contain set
of instructions but thread is a single sequence stream
within the process.thread is sometime called lightweight
process. single thread alows a os to perform singler task
ata time similarities between process and threads are:
4)if one thread is blocked then the next will be start to
run like process.
1)threads are not independent like process.
2)all threads can access every address in the task unlike
3)threads are design to assist onr another and process
might or not might be assisted on one another.
Technically, a thread is defined as an independent stream
of instructions that can be scheduled to run as such by the
So, in summary, in the UNIX environment a thread:
o Exists within a process and uses the process
o Has its own independent flow of control as long as
its parent process exists and the OS supports it
o Duplicates only the essential resources it needs to
be independently schedulable
o May share the process resources with other threads
that act equally independently (and dependently)
o Dies if the parent process dies - or something
o Is "lightweight" because most of the overhead has
already been accomplished through the creation of its
Whereas in case of process, every process has its own
memory management, two process cannot communicate without
using IPCS or Sockets, they do not share resources and
every process has its own process ID(pid).
Both threads and processes are methods of parallelizing
an application. However, processes are independent execution
units that contain their own state information, use their
own address spaces, and only interact with each other via
interprocess communication mechanisms (generally managed by
the operating system). Applications are typically divided
into processes during the design phase, and a master process
explicitly spawns sub-processes when it makes sense to
logically separate significant application functionality.
Processes, in other words, are an architectural construct.
By contrast, a thread is a coding construct that doesn't
affect the architecture of an application. A single process
might contains multiple threads; all threads within a
process share the same state and same memory space, and can
communicate with each other directly, because they share the
Threads typically are spawned for a short-term benefit
that is usually visualized as a serial task, but which
doesn't have to be performed in a linear manner (such as
performing a complex mathematical computation using
parallelism, or initializing a large matrix), and then are
absorbed when no longer required. The scope of a thread is
within a specific code module—which is why we can bolt-on
threading without affecting the broader application.
If A>B then
else B>C then
in this , for 75% times A>B and 25% times B>C then,is
10000 instructions are there ,then the ratio of F to G
[a] 7500:2500 [b] 7500:625 [c] 7500:625 if a=b=c else