Thread in Distributed Systems

15 Mar 2011 by

Thread in Distributed Systems

Thread in Distributed Systems

One challenge in distributed systems is concurrency. Without supporting multithread, distributed systems is almost meaningless as it needs to support multiple users. It is typical in distributed systems to have tasks that are partly CPU intensive and partly I/O bound. Generating database query, rendering an image, etc are examples of CPU intensive. Sending files or requests over the network are I/O intensive related to Socket, RMI, etc.

Now we will lookup 3 main architectures that thread impact the performance of distributed systems.

  • Single thread
  • Thread per request or connection
  • Thread pool

Continue Reading »

No responses yet

Process vs. Thread

24 Feb 2011 by

Process and Thread are two unit of executions that are not the same in the sense of executing environment. These two terms often are used confusingly. This article will clear all the doubts.


Process is a compiled program requires CPU to execute its instructions and also requires its own memory space for storing its executing environment. If we peep into the memory of computer, Process can be divided at least into 3 segments:

  • Text segment: storing program code
  • Heap: storing global data
  • Stack: storing local data
Process segmentation in computer memory

Process Segmentation

The purpose of segmentation in memory is to distinguish between instruction and data. Let’s say 0xA2 in hexadecimal. If it is stored in Text Segment, it is MOV instruction. On the hand, if it is stored in Heap or Stack, it equals 162 in decimal.

Some main feature of Process:

  • Has its own memory space
  • Has its own unique process ID
  • Creating and destroying Process is cost heavily
  • Communication between processes is done based on Inter-Process Communication (IPC) or pipe (UNIX-like system)


Thread sometimes is called light weight process. However, it has some unique features making it differences from Process.

Some main feature of Thread:

  • Thread exists within a process
  • Every process has at least one thread called main thread
  • The main thread has an ability to create additional threads
  • Thread share process’s resources, including memory, open files, socket. This makes efficient in communication among each other but giving some sorts of potential problematic. This problem will be discussed in Mutual Exclusion.
Threads exist in a Process and share Process's resources

Process and Thread

2 responses so far