Sie sind auf Seite 1von 14

Processes and Threads

Terms and Concepts


1) Define an active object?( an active object is one that owns a process or a
thread and can initiate control activity)
A) An active object is one that owns either a process or a thread and can initiate a
control activity
2)How we can treat an active object?(it is a manifestation of a process or thread)
2) What is an active class?(an active class is one whose instances are active
obejcts)
A) A class is said to be an active class if its instances are called as active objects
2.1) Graphical representation of Active Classes?(rectangle with thick lines)
A) An active class can be graphically represented as a rectangle with thick lines.
2.2)Diagram for Active Class

3) Define a process w.r.t ooad? ( heavy weight flow , execute concurrently)


A) A process can be defined as a heavy weight flow that can execute concurrently
with other processes.
4) Define a Thread? (light weight flow, execute concurrently with other threads)

1
A)A Thread can be defined as a light weight flow that can execute concurrently
with other threads within the same process.

5) How processes and thread are represented?(as stereotyped active classes ,


sequences in interaction diagrams)
A) Processes and Threads are represented as stereotyped active classes and they
also appear as sequences in interaction diagrams
Flow of Control
1)What type of flow of control exists in pure sequential systems?(only one)
A) In pure sequential systems there exists only one flow of control
2) What is one flow of control?(only one thing can take place at a time)
A)One flow of control means only one thing can take place at a point of time
3) Where the control is rooted in a sequential program?( at the beginning of the
program and operations will be dispatched
one after another)
A) When a Sequential Program starts, control is rooted at the beginning of the
program and the operation will be dispatched one after another
4) What about flow of control in concurrent systems?(more than one flow of
control)
A) In concurrent system there is more than one flow of control, it means that
more than one thing can take place at a time.
Classes and Events
1)What is the difference between active classes and plain classes?(
Active classes
Independent flow of control,
initiate control activity
active

2
Plain classes
no such flows
cant independently initiate control activity
passive)
A) Active classes represents an independent flow of control, where as a plain class
embodies no such flow. In Contrast to active classes, plain classes are implicitly
called passive because they can’t independently initiate control activity.
2)what happens when an active object is created and destroyed?(an associated
flow of control is started , and terminated)
A)When an active object is created the associated flow of control will be started ,
when the active object is destroyed, the associated flow of control will be
terminated
3)What are the two standard stereotypes that can be applied to active
classes?(<<process>> and <<thread>>)
A)The two standard stereotypes that can be applied to active classes are
<<process>> and <<thread>>
4)What the stereotype <<process>> specifies?( heavy weight flow )
A)This stereotype specifies the heavy weight flow that can execute concurrently
with other processes
5)What is heavy weight?( a thing known to OS and runs in an independent
address space)
A)Heavy weight means, a thing that is known to Operating System itself and runs
in an independent address space
5)What the Stereo type<<thread>> specifies?(a light weight flow)

3
A)It specifies a light weight flow that can execute concurrently with other threads
with in the same process
6) What is light weight?(known to the OS itself , no separate address space)
A)A light weight means , it is known to Operating System, but no separate address
space is created for the thread , it runs in the same address space of the process
along with other threads
7)How we can use active classes?( to model common families of processes or
threads)
8)What the Active classes may have?(
1. same properties as all other classes,
2. May have attributes and operations,
3. may participate in GAD
relationships)
9)What the Active Classes may use? ( they may use UML’s
1)Extensibility mechanisms
2)StereoTypes,tagged values,constraints)
10) Relationship between interfaces,active classes and collaborations?
A)Interfaces are realized by the Active classes , Active classes are realized by the
Collaborations
11) How the behavior of an active class is specified?(by using state machines)
12)Modeling the collaboration of active and passive objects?(by using
interaction diagrams including sequence
and collaboration diagrams)
Communication
1) When the objects interact with each other and how?( when they collaborate ,
by passing messages from one
to the other)

4
A) Objects interact with each other when the collaborate and they interact by
passing messages from one to the other.
2) What a system may contain?(both active and passive objects)
A) A System may consists of active and passive objects
3)What are the various combinations of interaction?( four ways
1) A message can be passed from one passive object to
another
2) A message can be passed from one active object to another
3) A message can be passed from an active object to a passive
Object
4) A message can be passed from a passive object to an active
Object
4) Representing a synchronous message and asynchronous message?(full arrow
and half arrow)
A)In UML a synchronous message is denoted with a full arrow and an
asynchronous message with a half arrow.
5)Diagram

5
6
Synchronization
1)What is synchronization?( arranging the flow of control of objects , mutual exclusion is
guaranteed)
A)
synchronization means arranging the flow of controls of objects so that
mutual exclusion will be guaranteed.

2)How these objects are treated?(Critical Regions)


in object-oriented systems these objects are treated as a critical region

3)Diagram

4) What are the three types of Synchronization?(3 approaches)


A) Three approaches are there to handle synchronization:

5) What are the three ways of


Synchronization?(Sequential,Guarded,Concurrent)

6) What is a Sequential Synchronization?(only one flow is in the object


at a time)
A)
Sequential – Callers must coordinate outside the object so that only one
flow is in the object at a time

7)What is a Guarded Synchronization?(multiple flow of control is


sequentialized)

7
A)Guarded – multiple flow of control is sequentialized with the help of
object’s guarded operations. in effect it becomes sequential.

8) What is Concurrent Synchronization?( operations are treated as


atomic)

A)
Concurrent – multiple flow of control is guaranteed by treating each
operation as atomic

9)How Synchronization is represented?( operations of active classes)

synchronization are rendered in the operations of active classes with the


help of constraints

Common Modeling Techniques


1) How many modeling techniques are there?(two, modeling multiple flows of
control , modeling IPC)
Modeling InterProcess Communication
1) Where the objects may live?(separate flows)
2) How to incorporate multiple flows of control in a system?(by considering
mechanisms by which objects that
live in separate flows communicate
with one another)
3) Where the threads live?(in the same address space of a process to which they
belong to)
4)How the objects communicate across threads?(via signals or call events)
5)What type of semantics may be followed ?(synchronous or asynchronous
semantics)
6)Where the processes live? (in separate address space)
7)What type of semantics is followed in processes?(different mechanisms)

8
8)What we have to consider in IPC?(distributed systems where processes may
live in)
8)Where the processes live in a distributed system?(separate nodes of machines
or computers)
9)What techniques are used to establish IPC?(message passing and remote
procedure calls)
10)How the IPC mechanisms(RPC,message passing)are modelled in UML?(by
using synchronous or asynchronous
events respectively)
11)How this can be done?(adorn your designs with further information)
12)Steps involved in modeling a IPC?

Step1: Model the multiple flows of control


Step2: Identify the active object which represents processes and Threads
Step3: Model messaging using asynchronous communication and model remote
procedure calls using synchronous communication
Step4: Specify the underlying mechanism for communication by using notes,
collaborations

9
13) Diagram

10
14)What the above diagram shows?( a distributed reservation system with
processes spread across four nodes)
15)How each object is marked?(by using the stereotype <<process>>)
16)What each object is having?(a location attribute , which specifies its physical
location)
17)communication among Reservation Agent,TicketingManager and
HotelAgent?(asynchronous communication)
18) Communication between a Trip Planner and Reservation
System?(synchronous)
19)How the semantics of their interaction found?(in collaboration named CORBA
ORB)
20)Client here? (The TripPlanner acts as a client)
21)Server here?(ReservationAgent acts as a server)
22)How we can find the details of collaboration?(by zooming into the
collaboration, you will find the details
of how this server and client collaborate)
Modeling The Flow of Control

11
1) What the above diagram shows?(part of the process
view of a trading system)

2) What is the role of the objects StockTicker, Index


Watcher and CNNNewsFeed?(push information into the
system concurrently)
3) How these objects are named?(s,i,c respectively)

4) Communication of the objects s and i?( they communicate


With their own analyst instances a1 and a2)
5)How the Analyst is designed?( with an assumption that only
one flow of control will be active in
its instances at a time)
6)communication of analyst instances?(they communicate
Simultaneously with an Alert Manager
named as m)
7)How the instances of AlertManager should be
designed?(to preserve its semantics in the presence of multiple
flows)
8)How m and c communicate?(they communicate
simulataneously with t which is
instance of a tradingManager)

9) What each flow is given?(a sequence number that is


distinguished by the flow of control
that owns it)

12
Steps involved in Modeling
1) Representing (each flow as an active class)
2) Generalizing (common set of active objects into active classes)
3) Concurrency (Don’t introduce too much concurrency)
4) Balanced Distribution (establish balanced distribution of
responsibilities among active classes)
5) Tight cohesive and loosely coupled(ensure that each active
class is both tightly cohesive and lossely coupled)
6)Right set of attributes(Ensure that each class has a right of
attributes,operattions and signals)
7)Capturing?(static decisions in class diagrams and high light
each active class)
8)Identifying(Identify group of classes collaborates with one
another dynamically)
9)Capturing(Capturing dynamic decisions in interaction
diagrams)
10)Representing(Representing active objects as root of flows)
11)Attention(Attention on communication among active objects)
12)Attention on synchronization?( among active objects and
passive objects)
13)Apply?(apply synchronous and asynchronous messaging)
14)Apply(Sequential ,Guarded ,concurrent operation semantics)

AAAABCCCRRRITG

A-Attention on communication among active objects

13
A- Attention on synchronization among active objects and
passive objects
A - Apply synchronous and asynchronous messaging
A- Apply Sequential ,Guarded ,concurrent operation semantics

B- Balanced Distribution(establish balanced distribution of


responsibilities among active classes)

C- Capturing Static decisions in class diagrams and high light


each active class)
C- Capturing dynamic decisions in interaction diagrams
C- Concurrency (Don’t introduce too much concurrency)
R - Representing(Representing active objects as root of flows)
R- Representing (each flow as an active class)
R- Right set of attributes(Ensure that each class has a right of
attributes,operattions and signals)
I- Identify group of classes collaborates with one another
dynamically)
T -Tight cohesive and loosely coupled(ensure that each active
class is both tightly cohesive and lossely coupled)
G- Generalizing (common set of active objects into active classes)

14

Das könnte Ihnen auch gefallen