the concept of threada thread is a sequential


The Concept of Thread

A thread is a sequential flow of control within a process. A process is able to have one or more threads. Threads have their own register-values and program-counter but they share memory space and other resources of the process. Every process begins with a single thread. Through the execution, other threads can be created as and when required. Similar to processes, every thread has an execution state (terminated, ready, blocked or running). A thread has right to use the memory address space and resources of its process. Threads have similar life cycles as processes do. A single processor system may support concurrency by switching execution among two or more threads. A multi processor system may support parallel concurrency by executing a separate thread on every processor. There are three fundamental techniques in concurrent programming languages for terminating and creating threads: 

  • Unsynchronised creation and termination - In this mode threads are created and terminated by means of library functions for example START_PROCESS, CREATE_PROCESS, START_THREAD, CREATE_THREAD and. Thus because of these function calls a new thread or process is created and starts executing independent of its parents.
  • Synchronized termination and unsynchronised creation: This manner uses two instructions: JOIN and FORK. The FORK instruction creates a new thread or process. When the parent needs the child's (thread or process) result, it calls JOIN instruction. At this junction two processes (threads) are synchronised.
  • Synchronised termination and creation: The most often system construct to implement synchronization is COBEGIN...COEND. The threads among the COBEGIN...COEND construct are implemented in parallel. The termination of parent-child is suspended till all child threads are terminated.

We can think of a thread as essentially a lightweight process. Though, threads propose a number of advantages over processes. The advantages are as follows:

a)  It does not take so much time to create and terminate a new thread than to create and terminate a process. The reason is that a newly created thread uses the current process address space.  

b)  It does not take so much time to switch between two threads within a common process, partly since the newly created thread uses current process address space. 

c)  Less communication overheads -- communicating between the threads of one process is simple since the threads share amongst other entities the address space. So, data generated by one thread is right away available to all other threads.

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: the concept of threada thread is a sequential
Reference No:- TGS0312724

Expected delivery within 24 Hours