1.

What are the advantages and the disadvantages of using threads in context to OS?

Answer»

Within a process, a thread is a path of execution. Multiple threads can exist in a process. It's an independent control flow within a process. It is made up of a context and a set of instructions to be carried out. Shared memory space is used by threads in the same process. Threads aren't really independent of one another, hence they share their code section, data section, and OS resources with other threads (like open files and signals).

The following are the KEY benefits of EMPLOYING threads:

  • There is no NEED for a specific communication system.
  • Threads improve readability and software structure simplicity.
  • The context switching time (time to switch from one thread to another) is LESS in threads as compared to processes.
  • With fewer system resources required, the system becomes more efficient.

The following are the main drawbacks of employing threads:

  • Threads can't be REUSED because they're part of a single process.
  • They tamper with their process's address space.
  • For concurrent read-write access to memory, they require synchronization.


Discussion

No Comment Found