Page 319 - DCAP404 _Object Oriented Programming
P. 319

Object-oriented Programming




                    Notes          There are many alternative approaches for introducing concurrency and synchronisation in an
                                   object-oriented language. The synchronization can be handled in two different ways:
                                   code level: In this scheme, messages are always accepted for execution. Concurrency is controlled
                                   through conventional mechanisms such as semaphores and monitors, which appear as statements
                                   that are embedded within the implementations of method bodies.

                                   This category is referred to as passive objects and is exemplified by  Smalltalk-80. The internal
                                   state of objects is only protected against  inconsistencies when the methods that affect the state
                                   contain synchronisation statements.
                                   Object level: In this case we speak about active objects: upon reception, messages can be delayed
                                   until apt for execution. Thus, synchronisation occurs at the object boundary, thereby protecting
                                   the internal consistency of objects. Various types of synchronisation mechanisms can be applied
                                   at this level. Examples of languages that synchronise at the object level are POOL, Procol, etc.

                                   For concurrent object-oriented systems a systematic development framework is provided by
                                   Rumbaugh method explained below:
                                   Rumbaugh method (also known as Object Modeling Technique) of developing concurrent object-
                                   oriented systems is applicable in all the phases of development. It enumerates the steps that
                                   must be taken to accomplish the outcome(s) of that phase. It roughly consists of the following
                                   steps:
                                   1.  Identify objects, classes, hierarchy and relationships.
                                   2.  Identify the synchronization constraints.

                                   3.  Specify the object and system behavior, i.e. dynamic behaviour.
                                   4.  Specify the functional model using DFD or otherwise.
                                   5.  Iterate through the steps to refine the model to the acceptable levels.
                                   The performance and applicability of an object-oriented system  can be greatly enhanced  if
                                   several instances of objects are allowed to co-exist and co-execute in a single environment. Such
                                   systems facilitate execution of multiple objects in a single interactive environment.

                                   As a matter of fact concurrency can exists at different levels of abstractions. Concurrency of
                                   programs  (multiprogramming), for  example, has been implemented  as multiprocessing  or
                                   multitasking. Concurrency within an object can be achieved by multithreading.
                                   No matter which level concurrency is in question, a concurrent system must have the ability to
                                   control three aspects of execution:

                                   1.  Concurrent execution of methods
                                   2.  Inter-method synchronization and communication
                                   3.  Security





                                      Task  Traditionally, concurrency within objects has been implemented on the tunes of
                                     multi-tasking systems. As a process provides abstraction in the later case, threads abstract
                                     the later case. Explain.









          312                               LOVELY PROFESSIONAL UNIVERSITY
   314   315   316   317   318   319   320   321   322   323   324