Characteristics of a Thread

Some of the important properties of threads are:

Lightweight than process:

  • Thread is said to be lightweight than a process in terms of resource consumption.
  • Most of the resources of a thread are inherited from a process like complete memory space, signal table, page table.
  • Each thread only has its own stack section that means its own local variable, a program counter(next instruction to be executed), registers.
  • Thread is also called light weight process because of the above reason.

Creating a thread is faster than a process:

  • Threads are faster or cheaper to create in comparison to process because they only need a stack and registers, the rest are copied directly from the process.
  • Many tables need to initialize while process creation like Process Control Block(PCB), signal table, Page table whereas in the case of threads all these tables are directly inherited.
  • Most of the work of creating a thread is done at user space, not at kernel space.

Switching between threads is faster than process:

  • Context switching is faster in threads as they only need to save stack pointer, program counter and registers.
  • But in the case of process, process state, the program counter(PC), the values of the different registers, the CPU scheduling information for the process, memory management information regarding the process, possible accounting information for this process, and I/O status information of the process have to save.
  • Thus context switching is less overhead in the case of threads.

Data sharing within threads:

  • Data sharing between threads can easily be done as they are not independent, share the same address space.
  • All threads can read and modify a shared pool of memory easily.

They add more responsiveness to the system:

  • They increase the responsiveness of the system in terms of parallelism.
  • Each thread can be scheduled independently to perform different tasks simultaneously.

Relevant Posts:



Categories: Operating system (OS)

3 replies

Trackbacks

  1. POSIX Thread APIs - Tech Access
  2. Thread create attributes: - Tech Access
  3. Index of Operating System - Tech Access

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: