Process and Threads

Estudies4you
Process and Threads in UML State Machines-OOAD Lecture Notes
Process and Threads 
  • A heavyweight flow, which executes concurrently with other processes is known as 'Process' 
  • A lightweight flow which executes concurrently with other threads within the same process is known as 'Thread' 
  • An object which owns a process or thread and initiate control activity is known as 'Active Object' 
  • A class whose instances are active objects is known as 'Active Class' 
  • Graphically, active class is represented as a rectangle with thick lines and, processes and threads are represented as stereotyped active classes 
  • Flow of Control 
  • Classes and Events
  • Communication
  • Synchronization
Flow of Control 
  • In a sequential system, there is a single flow of control. i.e., one thing, and one thing only, can take place at a time 
  • In a concurrent system, there is multiple simultaneous flow of control i.e., more than one thing can take place at a time
Classes and Events 
  • Active classes are just classes which represents an independent flow of control 
  • Same properties are shared as like other classes 
  • Flow of control starts when an active object is created and it terminates when destroyed 
  • Stereotypes of active classes are 
«process» 
«thread» 
  • All the threads that live in the context of a process are peers of one another
Communication 
  • The four possible combinations of interaction with both active and passive objects are 
  1. A message may be passed from one passive object to another 
  2. A message may be passed from one active object to another 
  3. A message may be passed from an active object to a passive object 
  4. A message may be passed from a passive object to an active one
  • In inter-process communication there are two possible styles of communication 
One active object might synchronously call an operation of another 
One active object might asynchronously send a signal or call an operation of another object 
  • Full arrow represents synchronous message and half arrow represents asynchronous message
Synchronization 
  • Synchronization means arranging the flow of controls of objects so that mutual exclusion will be guaranteed 
  • In object-oriented systems these objects are treated as a critical region 
  • The three methods to handle synchronization are 
Sequential - Callers must coordinate outside the object so that only one flow is in the object at a time
Guarded - Multiple flow of control is sequentialized with the help of object's guarded operations. Therefore, it becomes sequential
Concurrent - Multiple flow of control is guaranteed by treating each operation as atomic
  • Synchronization is represented in the operations of active classes with the help of constraints


Time and Space 
  • Timing mark is a denotation for the time at which an event occurs 
  • Graphically represented as a small hash mark (horizontal line) on the border of a sequence diagram as shown in image 
  • A time expression evaluates to an absolute or relative value of time

Time 
  • Passing of messages represents the dynamic aspect of a system 
  • Messages in an interaction are represented with signal or a call 
  • The three functions of messages are 
  1. sendTime 
  2. receiveTime
  3. transmissionTime

Location 
  • In distributed systems, components are fixed at the time when loaded 
  • Components may migrate from node to node in other systems 
  • Artifacts are used to manifest components and classes

Tags
To Top