SlideShare a Scribd company logo
1 of 8
Processes and Threads
A process is a heavyweight flow that can execute concurrently with other processes.
A thread is a lightweight flow that can execute concurrently with other threads within the same
process.
An active object is an object that owns a process or thread and can initiate control activity.
An active class is a class whose instances are active objects.
Graphically, an active class is rendered as a rectangle with thick lines. Processes and threads are
rendered as stereotyped active classes.
Figure 1:Active class
Flow of Control
There are two flow of controls that are Sequential and Concurrent.
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.
When a sequential program starts, control is rooted at the beginning of the program and
operations are dispatched one after another. Even if there are concurrent things happening
among the actors outside the system, a sequential program will process only one event at a
time, queuing or discarding any concurrent external events.
In a concurrent system, there is multiple simultaneous flow of control i.e, more than one thing
can take place at a time, each rooted at the head of an independent process or a thread. If you
take a snapshot of a concurrent systemwhile it's running, you'll logically see multiple loci of
execution. In the UML, you use an active class to represent a process or thread that is the root
of an independent flow of control and that is concurrent with all peer flows of control.
Classes and Events
Active classes are just classes which represents an independent flow of control. Active classes
share the same properties as all other classes.
When an active object is created, the associated flow of control is started; when the active
object is destroyed, the associated flow of control is terminated.
Active classes share the same properties as all other classes. Active classes may have
instances. Active classes may have attributes and operations. Active classes may participate in
dependency, generalization, and association (including aggregation) relationships. Active
classes may use any of the UML's extensibility mechanisms, including stereotypes, tagged
values, and constraints. Active classes may be the realization of interfaces. Active classes may
be realized by collaborations, and the behavior of an active class may be specified by using
state machines.
Standard Elements:
Two standard stereotypes that apply to active classes are,
<<process>> -- Specifies a heavyweight flow that can execute concurrently with other
processes. (heavyweight means, a thing known to the OS itself and runs in an independent
address space)
<<thread>> – Specifies a lightweight flow that can execute concurrently with other threads
within the same process (lightweight means, known to the OS itself.)
All the threads that live in the context of a process are peers of one another.
A process is heavyweight, which means that it is a thing known to the operating system itself
and runs in an independent address space. Under most operating systems, such as Windows
and Unix, each program runs as a process in its own address space. In general, all processes on
a node are peers of one another, contending for all the same resources accessible on the node.
Processes are never nested inside one another. If the node has multiple processors, then true
concurrency on that node is possible. If the node has only one processor, there is only the
illusion of true concurrency, carried out by the underlying operating system.
A thread is lightweight. It may be known to the operating systemitself. More often, it is hidden
inside a heavier-weight process and runs inside the address space of the enclosing process. In
Java, for example, a thread is a child of the class Thread. All the threads that live in the context
of a process are peers of one another, contending for the same resources accessible inside the
process. Threads are never nested inside one another. In general, there is only the illusion of
true concurrency among threads because it is processes, not threads, that are scheduled by a
node's operating system.
Communication
When objects collaborate with one another, they interact by passing messages fromone to the
other. In a systemwith both active and passive objects, there are four possible combinations of
interaction
First, a message may be passed from one passive object to another
Second, a message may be passed from one active object to another
In inter-process communication there are two possible styles of communication.
1)one active object might synchronously call an operation of another.
2)one active object might asynchronously send a signal or call an operation of another
object a synchronous message is rendered as a full arrow and an asynchronous message is
rendered as a half arrow.
Third, a message may be passed from an active object to a passive object
Fourth, a message may be passed from a passive object to an active one
Figure 2: Communication
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.
Three approaches are there to handle synchronization:
1. Sequential – Callers must coordinate outside the object so that only one flow is in the
object at a time
2. Guarded – multiple flow of control is sequentialized with the help of object’s guarded
operations. in effect it becomes sequential.
3. Concurrent – multiple flow of control is guaranteed by treating each operation as
atomic.
synchronization are rendered in the operations of active classes with the help of constraints.
Figure 3: Synchronization
Process Views
The process view of a system encompasses the threads and processes that form the system’s
concurrency and synchronization mechanisms.
This view primarily addresses the performance, scalability, and throughput of the system.
Modeling Multiple Flows of Control
To model multiple flows of control,
· Identify the opportunities for concurrent action and reify each flow as an active class.
Generalize common sets of active objects into an active class. Be careful not to overengineer
the process view of your systemby introducing too much concurrency.
· Consider a balanced distribution of responsibilities among these active classes, then examine
the other active and passive classes with which each collaborates statically. Ensure that each
active class is both tightly cohesive and loosely coupled relative to these neighboring classes
and that each has the right set of attributes, operations, and signals.
· Capture these static decisions in class diagrams, explicitly highlighting each active class.
· Consider how each group of classes collaborates with one another dynamically. Capture those
decisions in interaction diagrams. Explicitly show active objects as the root of such flows.
Identify each related sequence by identifying it with the name of the active object.
· Pay close attention to communication among active objects. Apply synchronous and
asynchronous messaging, as appropriate.
· Pay close attention to synchronization among these active objects and the passive objects
with which they collaborate. Apply sequential, guarded, or concurrent operation semantics, as
appropriate.
Figure 4 shows part of the process view of a trading system.
Figure 4: Modeling Flows of Control
Modeling Interprocess Communication
To model interprocess communication,
· Model the multiple flows of control.
· Consider which of these active objects represent processes and which represent threads.
Distinguish them using the appropriate stereotype.
· Model messaging using asynchronous communication; model remote procedure calls using
synchronous communication.
· Informally specify the underlying mechanism for communication by using notes, or more
formally by using collaborations.
Figure 5 shows a distributed reservation system with processes spread across four nodes.
Figure 5: Modeling Interprocess Communication

More Related Content

What's hot

Unit 3(advanced state modeling & interaction meodelling)
Unit  3(advanced state modeling & interaction meodelling)Unit  3(advanced state modeling & interaction meodelling)
Unit 3(advanced state modeling & interaction meodelling)Manoj Reddy
 
Object oriented modeling and design
Object oriented modeling and designObject oriented modeling and design
Object oriented modeling and designjayashri kolekar
 
Design Model & User Interface Design in Software Engineering
Design Model & User Interface Design in Software EngineeringDesign Model & User Interface Design in Software Engineering
Design Model & User Interface Design in Software EngineeringMeghaj Mallick
 
The Ultimate Sequence Diagram Tutorial
The Ultimate Sequence Diagram TutorialThe Ultimate Sequence Diagram Tutorial
The Ultimate Sequence Diagram TutorialCreately
 
Identifying classes and objects ooad
Identifying classes and objects ooadIdentifying classes and objects ooad
Identifying classes and objects ooadMelba Rosalind
 
Organized and disorganized complexity
Organized and disorganized complexityOrganized and disorganized complexity
Organized and disorganized complexityVostrikov Arkady
 
Overview of UML Diagrams
Overview of UML DiagramsOverview of UML Diagrams
Overview of UML DiagramsManish Kumar
 
Class and object_diagram
Class  and object_diagramClass  and object_diagram
Class and object_diagramSadhana28
 
Uml diagrams
Uml diagramsUml diagrams
Uml diagramsbarney92
 
The Object Model
The Object Model  The Object Model
The Object Model yndaravind
 
State Machine Diagram
State Machine DiagramState Machine Diagram
State Machine DiagramNiloy Rocker
 
Importance & Principles of Modeling from UML Designing
Importance & Principles of Modeling from UML DesigningImportance & Principles of Modeling from UML Designing
Importance & Principles of Modeling from UML DesigningABHISHEK KUMAR
 
Classes and Objects
Classes and Objects  Classes and Objects
Classes and Objects yndaravind
 
Object Oriented Analysis and Design
Object Oriented Analysis and DesignObject Oriented Analysis and Design
Object Oriented Analysis and DesignHaitham El-Ghareeb
 

What's hot (20)

Unit 3(advanced state modeling & interaction meodelling)
Unit  3(advanced state modeling & interaction meodelling)Unit  3(advanced state modeling & interaction meodelling)
Unit 3(advanced state modeling & interaction meodelling)
 
Object oriented modeling and design
Object oriented modeling and designObject oriented modeling and design
Object oriented modeling and design
 
Design Model & User Interface Design in Software Engineering
Design Model & User Interface Design in Software EngineeringDesign Model & User Interface Design in Software Engineering
Design Model & User Interface Design in Software Engineering
 
The Ultimate Sequence Diagram Tutorial
The Ultimate Sequence Diagram TutorialThe Ultimate Sequence Diagram Tutorial
The Ultimate Sequence Diagram Tutorial
 
Identifying classes and objects ooad
Identifying classes and objects ooadIdentifying classes and objects ooad
Identifying classes and objects ooad
 
Uml - An Overview
Uml - An OverviewUml - An Overview
Uml - An Overview
 
Organized and disorganized complexity
Organized and disorganized complexityOrganized and disorganized complexity
Organized and disorganized complexity
 
Ooad unit – 1 introduction
Ooad unit – 1 introductionOoad unit – 1 introduction
Ooad unit – 1 introduction
 
Overview of UML Diagrams
Overview of UML DiagramsOverview of UML Diagrams
Overview of UML Diagrams
 
Class and object_diagram
Class  and object_diagramClass  and object_diagram
Class and object_diagram
 
Ooad
OoadOoad
Ooad
 
Uml diagrams
Uml diagramsUml diagrams
Uml diagrams
 
Class diagrams
Class diagramsClass diagrams
Class diagrams
 
Uml Common Mechanism
Uml Common MechanismUml Common Mechanism
Uml Common Mechanism
 
The Object Model
The Object Model  The Object Model
The Object Model
 
State Machine Diagram
State Machine DiagramState Machine Diagram
State Machine Diagram
 
Importance & Principles of Modeling from UML Designing
Importance & Principles of Modeling from UML DesigningImportance & Principles of Modeling from UML Designing
Importance & Principles of Modeling from UML Designing
 
Classes and Objects
Classes and Objects  Classes and Objects
Classes and Objects
 
Uml class Diagram
Uml class DiagramUml class Diagram
Uml class Diagram
 
Object Oriented Analysis and Design
Object Oriented Analysis and DesignObject Oriented Analysis and Design
Object Oriented Analysis and Design
 

Viewers also liked (20)

Two pass Assembler
Two pass AssemblerTwo pass Assembler
Two pass Assembler
 
Space and time
Space and timeSpace and time
Space and time
 
sCode optimization
sCode optimizationsCode optimization
sCode optimization
 
States machine
States machineStates machine
States machine
 
Keyword Presentation
Keyword PresentationKeyword Presentation
Keyword Presentation
 
Types and roles
Types and rolesTypes and roles
Types and roles
 
Compilers
CompilersCompilers
Compilers
 
What is symbol table?
What is symbol table?What is symbol table?
What is symbol table?
 
Single Pass Assembler
Single Pass AssemblerSingle Pass Assembler
Single Pass Assembler
 
Ooad
OoadOoad
Ooad
 
Linux programming - Getting self started
Linux programming - Getting self started Linux programming - Getting self started
Linux programming - Getting self started
 
Linux Internals - Interview essentials 4.0
Linux Internals - Interview essentials 4.0Linux Internals - Interview essentials 4.0
Linux Internals - Interview essentials 4.0
 
Cardinality and participation constraints
Cardinality and participation constraintsCardinality and participation constraints
Cardinality and participation constraints
 
11 ooad uml-14
11 ooad uml-1411 ooad uml-14
11 ooad uml-14
 
System protection in Operating System
System protection in Operating SystemSystem protection in Operating System
System protection in Operating System
 
Types of UML diagrams
Types of UML diagramsTypes of UML diagrams
Types of UML diagrams
 
Uml Activity Diagram
Uml Activity DiagramUml Activity Diagram
Uml Activity Diagram
 
Operating Systems: Processor Management
Operating Systems: Processor ManagementOperating Systems: Processor Management
Operating Systems: Processor Management
 
Activity diagram tutorial
Activity diagram tutorialActivity diagram tutorial
Activity diagram tutorial
 
Activity diagram
Activity diagramActivity diagram
Activity diagram
 

Similar to Processes and threads

UML-Advanced Software Engineering
UML-Advanced Software EngineeringUML-Advanced Software Engineering
UML-Advanced Software EngineeringAmit Singh
 
Architectural patterns part 4
Architectural patterns part 4Architectural patterns part 4
Architectural patterns part 4assinha
 
Uml difference faqs- 1
Uml difference  faqs- 1Uml difference  faqs- 1
Uml difference faqs- 1Umar Ali
 
UML, ER and Dimensional Modelling
UML, ER and Dimensional ModellingUML, ER and Dimensional Modelling
UML, ER and Dimensional ModellingStefano Dalla Palma
 
Lecture#03, uml diagrams
Lecture#03, uml diagramsLecture#03, uml diagrams
Lecture#03, uml diagramsbabak danyal
 
Ooad 2marks
Ooad 2marksOoad 2marks
Ooad 2marksAsh Wini
 
SE_Lec 09_ UML Behaviour Diagrams
SE_Lec 09_ UML Behaviour DiagramsSE_Lec 09_ UML Behaviour Diagrams
SE_Lec 09_ UML Behaviour DiagramsAmr E. Mohamed
 
Object Modeling Techniques
Object Modeling TechniquesObject Modeling Techniques
Object Modeling TechniquesShilpa Wadhwani
 
Object modeling techniques by savyasachi
Object modeling techniques by savyasachiObject modeling techniques by savyasachi
Object modeling techniques by savyasachiSavyasachi14
 
SE18_Lec 10_ UML Behaviour and Interaction Diagrams
SE18_Lec 10_ UML Behaviour and Interaction DiagramsSE18_Lec 10_ UML Behaviour and Interaction Diagrams
SE18_Lec 10_ UML Behaviour and Interaction DiagramsAmr E. Mohamed
 
Dynamic analysis of agent network in self organisation using service level ag...
Dynamic analysis of agent network in self organisation using service level ag...Dynamic analysis of agent network in self organisation using service level ag...
Dynamic analysis of agent network in self organisation using service level ag...inventionjournals
 

Similar to Processes and threads (20)

Process and threads
Process and threadsProcess and threads
Process and threads
 
What is concurrency
What is concurrencyWhat is concurrency
What is concurrency
 
UML-Advanced Software Engineering
UML-Advanced Software EngineeringUML-Advanced Software Engineering
UML-Advanced Software Engineering
 
Process coordination
Process coordinationProcess coordination
Process coordination
 
Architectural patterns part 4
Architectural patterns part 4Architectural patterns part 4
Architectural patterns part 4
 
Uml difference faqs- 1
Uml difference  faqs- 1Uml difference  faqs- 1
Uml difference faqs- 1
 
UML, ER and Dimensional Modelling
UML, ER and Dimensional ModellingUML, ER and Dimensional Modelling
UML, ER and Dimensional Modelling
 
Lecture#03, uml diagrams
Lecture#03, uml diagramsLecture#03, uml diagrams
Lecture#03, uml diagrams
 
Uml examples
Uml examplesUml examples
Uml examples
 
Sequence Diagram
Sequence Diagram Sequence Diagram
Sequence Diagram
 
Sequence Diagram
Sequence Diagram Sequence Diagram
Sequence Diagram
 
Mvc grasp
Mvc graspMvc grasp
Mvc grasp
 
Ooad 2marks
Ooad 2marksOoad 2marks
Ooad 2marks
 
Uml
UmlUml
Uml
 
01. design pattern
01. design pattern01. design pattern
01. design pattern
 
SE_Lec 09_ UML Behaviour Diagrams
SE_Lec 09_ UML Behaviour DiagramsSE_Lec 09_ UML Behaviour Diagrams
SE_Lec 09_ UML Behaviour Diagrams
 
Object Modeling Techniques
Object Modeling TechniquesObject Modeling Techniques
Object Modeling Techniques
 
Object modeling techniques by savyasachi
Object modeling techniques by savyasachiObject modeling techniques by savyasachi
Object modeling techniques by savyasachi
 
SE18_Lec 10_ UML Behaviour and Interaction Diagrams
SE18_Lec 10_ UML Behaviour and Interaction DiagramsSE18_Lec 10_ UML Behaviour and Interaction Diagrams
SE18_Lec 10_ UML Behaviour and Interaction Diagrams
 
Dynamic analysis of agent network in self organisation using service level ag...
Dynamic analysis of agent network in self organisation using service level ag...Dynamic analysis of agent network in self organisation using service level ag...
Dynamic analysis of agent network in self organisation using service level ag...
 

More from Satyamevjayte Haxor (8)

Patterns
PatternsPatterns
Patterns
 
Lexical
LexicalLexical
Lexical
 
Linker
LinkerLinker
Linker
 
Nested micro
Nested microNested micro
Nested micro
 
Multiplier control unit
Multiplier control unitMultiplier control unit
Multiplier control unit
 
Control unit design
Control unit designControl unit design
Control unit design
 
Direct linking loaders
Direct linking loadersDirect linking loaders
Direct linking loaders
 
Linking in MS-Dos System
Linking in MS-Dos SystemLinking in MS-Dos System
Linking in MS-Dos System
 

Recently uploaded

HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxEsquimalt MFRC
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the ClassroomPooky Knightsmith
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxVishalSingh1417
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...ZurliaSoop
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Association for Project Management
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxJisc
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxmarlenawright1
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentationcamerronhm
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17Celine George
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...Nguyen Thanh Tu Collection
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfPoh-Sun Goh
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxDr. Sarita Anand
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Jisc
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...pradhanghanshyam7136
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 

Recently uploaded (20)

HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 

Processes and threads

  • 1. Processes and Threads A process is a heavyweight flow that can execute concurrently with other processes. A thread is a lightweight flow that can execute concurrently with other threads within the same process. An active object is an object that owns a process or thread and can initiate control activity. An active class is a class whose instances are active objects. Graphically, an active class is rendered as a rectangle with thick lines. Processes and threads are rendered as stereotyped active classes. Figure 1:Active class
  • 2. Flow of Control There are two flow of controls that are Sequential and Concurrent. 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. When a sequential program starts, control is rooted at the beginning of the program and operations are dispatched one after another. Even if there are concurrent things happening among the actors outside the system, a sequential program will process only one event at a time, queuing or discarding any concurrent external events. In a concurrent system, there is multiple simultaneous flow of control i.e, more than one thing can take place at a time, each rooted at the head of an independent process or a thread. If you take a snapshot of a concurrent systemwhile it's running, you'll logically see multiple loci of execution. In the UML, you use an active class to represent a process or thread that is the root of an independent flow of control and that is concurrent with all peer flows of control. Classes and Events Active classes are just classes which represents an independent flow of control. Active classes share the same properties as all other classes. When an active object is created, the associated flow of control is started; when the active object is destroyed, the associated flow of control is terminated. Active classes share the same properties as all other classes. Active classes may have instances. Active classes may have attributes and operations. Active classes may participate in dependency, generalization, and association (including aggregation) relationships. Active classes may use any of the UML's extensibility mechanisms, including stereotypes, tagged values, and constraints. Active classes may be the realization of interfaces. Active classes may
  • 3. be realized by collaborations, and the behavior of an active class may be specified by using state machines. Standard Elements: Two standard stereotypes that apply to active classes are, <<process>> -- Specifies a heavyweight flow that can execute concurrently with other processes. (heavyweight means, a thing known to the OS itself and runs in an independent address space) <<thread>> – Specifies a lightweight flow that can execute concurrently with other threads within the same process (lightweight means, known to the OS itself.) All the threads that live in the context of a process are peers of one another. A process is heavyweight, which means that it is a thing known to the operating system itself and runs in an independent address space. Under most operating systems, such as Windows and Unix, each program runs as a process in its own address space. In general, all processes on a node are peers of one another, contending for all the same resources accessible on the node. Processes are never nested inside one another. If the node has multiple processors, then true concurrency on that node is possible. If the node has only one processor, there is only the illusion of true concurrency, carried out by the underlying operating system. A thread is lightweight. It may be known to the operating systemitself. More often, it is hidden inside a heavier-weight process and runs inside the address space of the enclosing process. In Java, for example, a thread is a child of the class Thread. All the threads that live in the context of a process are peers of one another, contending for the same resources accessible inside the process. Threads are never nested inside one another. In general, there is only the illusion of true concurrency among threads because it is processes, not threads, that are scheduled by a node's operating system.
  • 4. Communication When objects collaborate with one another, they interact by passing messages fromone to the other. In a systemwith both active and passive objects, there are four possible combinations of interaction First, a message may be passed from one passive object to another Second, a message may be passed from one active object to another In inter-process communication there are two possible styles of communication. 1)one active object might synchronously call an operation of another. 2)one active object might asynchronously send a signal or call an operation of another object a synchronous message is rendered as a full arrow and an asynchronous message is rendered as a half arrow. Third, a message may be passed from an active object to a passive object Fourth, a message may be passed from a passive object to an active one Figure 2: Communication
  • 5. 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. Three approaches are there to handle synchronization: 1. Sequential – Callers must coordinate outside the object so that only one flow is in the object at a time 2. Guarded – multiple flow of control is sequentialized with the help of object’s guarded operations. in effect it becomes sequential. 3. Concurrent – multiple flow of control is guaranteed by treating each operation as atomic. synchronization are rendered in the operations of active classes with the help of constraints. Figure 3: Synchronization
  • 6. Process Views The process view of a system encompasses the threads and processes that form the system’s concurrency and synchronization mechanisms. This view primarily addresses the performance, scalability, and throughput of the system. Modeling Multiple Flows of Control To model multiple flows of control, · Identify the opportunities for concurrent action and reify each flow as an active class. Generalize common sets of active objects into an active class. Be careful not to overengineer the process view of your systemby introducing too much concurrency. · Consider a balanced distribution of responsibilities among these active classes, then examine the other active and passive classes with which each collaborates statically. Ensure that each active class is both tightly cohesive and loosely coupled relative to these neighboring classes and that each has the right set of attributes, operations, and signals. · Capture these static decisions in class diagrams, explicitly highlighting each active class. · Consider how each group of classes collaborates with one another dynamically. Capture those decisions in interaction diagrams. Explicitly show active objects as the root of such flows. Identify each related sequence by identifying it with the name of the active object. · Pay close attention to communication among active objects. Apply synchronous and asynchronous messaging, as appropriate. · Pay close attention to synchronization among these active objects and the passive objects with which they collaborate. Apply sequential, guarded, or concurrent operation semantics, as appropriate. Figure 4 shows part of the process view of a trading system.
  • 7. Figure 4: Modeling Flows of Control Modeling Interprocess Communication To model interprocess communication, · Model the multiple flows of control. · Consider which of these active objects represent processes and which represent threads. Distinguish them using the appropriate stereotype. · Model messaging using asynchronous communication; model remote procedure calls using synchronous communication. · Informally specify the underlying mechanism for communication by using notes, or more formally by using collaborations. Figure 5 shows a distributed reservation system with processes spread across four nodes.
  • 8. Figure 5: Modeling Interprocess Communication