0% found this document useful (0 votes)
13 views

Difference Between Threads and Process

Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

Difference Between Threads and Process

Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

1.

Differentiate Threads and Process using Diagram

THREADS PROCESS
 Thread means a segment of a process.  Process means a program is in
execution.
 Threads are usually take less
 Takes more time to terminate.
time to terminate.
 They are not lightweight.
 They are lightweight.
 Takes more time for creation.
 It take less time for creation. THREADS
 Communication between processes
 Communication between threads needs more time compared to thread.
requires less time compared to process. VS.  It takes more time for context
 It takes less time for context switching. switching.

 Consume fewer resources.


PROCESS  Consume more resources.

 Different process is tread separately by


 All the level peer threads are OS.
treated as single task by OS.

 Threads share memory.


 The process is mostly isolated.

 Threads share data with each  It does not share data.


other.

2. Explain the function of threads in a processor. Provide examples.

 A thread is a basic unit of CPU utilization. It comprises a thread ID, a program counter, a
register set, and a stack. It shares with other threads belonging to the same process its
code section, data section, and other operating system resources, such as open files
and signals. In short, with many threads, your CPU can handle several tasks at the
same time making the tasks faster. For instance, because of threads only you are able
to browse the web as well as listen to music simultaneously. So if you want to run
multiple processes that are very intensive, you may need a CPU with plentyof threads.

3. Pros and Cons of multithreading.

 The advantages of multithreading is they maintain a responsive user interface. They


make efficient use of processor time while waiting for input and output operations to
complete. Moreover, multithreading is usually helpful in applications that processes a
huge amount of data. Unfortunately, on a single processes/core machine threading can
affect the performance negatively as there is overhead involved with context-switching.
Furthermore, multithreaded applications are difficult to write, debug, understand and
maintain since the user have to write more lines of codes to accomplish the same task.

You might also like