CA2097541C - Concurrency control through a class library in object oriented technology - Google Patents

Concurrency control through a class library in object oriented technology

Info

Publication number
CA2097541C
CA2097541C CA002097541A CA2097541A CA2097541C CA 2097541 C CA2097541 C CA 2097541C CA 002097541 A CA002097541 A CA 002097541A CA 2097541 A CA2097541 A CA 2097541A CA 2097541 C CA2097541 C CA 2097541C
Authority
CA
Canada
Prior art keywords
object
function table
class
virtual
protocol
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
CA002097541A
Other languages
French (fr)
Other versions
CA2097541A1 (en
Inventor
William G. O'farrell
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
IBM Canada Ltd
Original Assignee
IBM Canada Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by IBM Canada Ltd filed Critical IBM Canada Ltd
Priority to CA002097541A priority Critical patent/CA2097541C/en
Publication of CA2097541A1 publication Critical patent/CA2097541A1/en
Priority claimed from US08/674,266 external-priority patent/US5632034A/en
Application granted granted Critical
Publication of CA2097541C publication Critical patent/CA2097541C/en
Anticipated expiration legal-status Critical
Application status is Expired - Fee Related legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/448Execution paradigms, e.g. implementations of programming paradigms
    • G06F9/4488Object-oriented
    • G06F9/449Object-oriented method invocation or resolution

Abstract

A mechanism for controlling method invocation and avoiding problems such as premature method execution before object construction and premature object destruction before method completion, is provided through a protocol function table in a class library. For any virtual functions declared in a class library, the thread of control invoking the function is re-directed through the protocol function table where it is either selectively accepted or delayed for later acceptance pending completion of some related procedure. When used in conjunction with an automatic routine for locating the originating point in an operating program, the protocol function table is particularly useful for executing concurrency in object-oriented applications.

Description

~ ~ ~ 7 ~

CONCURRENCY CONTROL THROUGH A CLASS LIBRARY IN OBJECT
ORIENTED TECHNOLOGY

The present invention is directed to the creation and use of a secondary protocol function table in connection with object construction through a class library to control object invocation and destruction in object-oriented technology. The subject-matter of the present invention has been found to be particularly useful in correctly implementing concurrent processing actions in an object-oriented computing environment.

Object oriented technology is a relatively recent development, and there are a number of l~ng~l~ge approaches that utilize the object-oriented concepts described below, including totally new l~n~l~es developed to embrace the object-oriented approach such as Simulal and SmallTalk2, and extensions to pre-existing traditional l~n~l~ges7 such as C++3.

C++ can be processed as a directly compiled l~n~ ge or implemented as a preprocessor to C, a rapid processing l~n~l~ge that is currently very popular. Accordingly, C++ is very portable to any system with either a C++ or C compiler. As a result, C++ has become one of the most widely used object-oriented models today.

In object-oriented technology, computer sim~ ted "objects", modelled on real world objects, are defined and m~int~ined as self-contained units, independent of each other. The definition of an object includes its "methods" or member functions (what procedures or operations the object is capable of pe-rol~ning) and its "variables" (its attributes, the values of which can change over time). However, the ISimula was the first object-oriented language developed in the late 1960'8 at the Norwegian Computer Center.
2SmallTalk was developed in the early 1970'8 at the Xerox PARC (Palo Alto Research Center).
3C++ was developed in the early 1980'8 at AT&T's Bell Laboratorie6 as an object-oriented extension to the non-object-oriented C programming language.

CA9-93-007 2 0 9 7 ~ ~1 manner in which these internal values are implemented in an object is not visible outside the object. -The methods and attributes defined for a particular object are determined by a "class", a template that defines the methods and variables to be included in a particular tYpe of object. Moreover, the approach to object creation is hierarchical, and classes are defined in terms of higher classes in the hierarchy, that is, the characteristics ~;
(methods and/or variables) of a subordinate or subclass are "inherited" from a superior, more generalized base or '-superclass, and those inherited characteristics form the parameters for the object's methods or variables. ~-: '' ' In many computer systems, storage mechanisms known as "class libraries" serve as repositories for the class hierarchy and data, and when an object is called through a processor, the -appropriate data is channeled from the class library to hardware-recognized areas of dynamic memory storage known as the heap and the stack.
5 ~:
Because of the invisibility of an object's internal structure, it is not possible to determine, externally, the particular inheritance path of any of the object's methods or attributes, and when one object calls for method implementation of another object, it must do so through method invocation, that is, calling on the other object to ,~
perform its method.

In object-oriented technology, objects actually interact by sending and receiving messages. A message is a signal from one object to another that requests the receiving object to ~-carry out one of its methods. The message consists of the ~.
name of the receiving object and its arguments, that is, the - ~ ' method it is to carry out and any parameters the method may r " ~, require to fulfill its charqe.

object-oriented extension to the non-object-oriented C programming ;~
language. ~ S

,~, ,,.,"

-- ~, :-: - -CA9-93-007 3 ~ V ~ ~541 Method invocation is fundamental to object-oriented ~'~
technology, and i9 attractive from the point of view of ~.
optimizing compile time, since an operating program need -only contain a single invocation call, and this call will implement the mechanism to perform tlle method called outside .:
of the operating program.
'~
However, one limitation on the use of method invocation in t~
compiled languages such as C++ arises from the fact that C++
is an inherently sequential language without any provision -~
for accommodating non-sequential method invocation, such as the concurrent processing of independent applications or ~ ~~
threads of control in a single application.

Problems that can arise through non-sequential method invocation in C++ include premature method invocation before the object has been completely constructed, and premature object destruction before the object's method has been -~
completely executed. -- ~,x Approaches to providing concurrency in object-oriented -languages such as C++ have been through the addition of enhancements to C compilers, includillg compilers for C
language extensions. In U.S. Patent No. 5,179,702 - Spix et ~-al., an "optimizer" placed between the front and back ends of the compiler functions to analyze a program and optimize ~ ~
its processing through several means, including ~f'~P~, "multi-threading" (concurrently applying multiple processors ~' to a single program). The optimizer generates machine ~.
independent code to establish the environment, including the dynamic allocation of a set of global registers for use by ~,"'5, the shared processing group.

A second approach to addressing this problem has been to ;
extend the C++ language to introduce the ability to create concurrent structures in memory in order to accommodate synchronous thread processing. For example, the ~C++

v~

;y,,:~

CA9-93-007 4 2 ~ 9 7~

language extension4 consists of a set of programming language constructs needed to express concurrency.

Another approach to providing concurrency believed to have better portability than either language extensions or enhanced compilers is througll the incorporation of a mechanism permitting the control of method invocation in a --class library associated with the C++ programming language. -~
C++ permits the inclusion of abstract or virtual classes, ~-~
which are classes with no instances created only for the ~~-purpose of organizing a class hierarchy or defining methods and variables that will apply to ]ower level classes.
. ....
The abstract or virtual class created (often called a "task class") creates the constructors for concurrent processing.

There are several examples of this in the prior art, one of which is P~EST0 . PREST0 is in fact an entire class library for the creation and management of threads, with separate classes for each concurrency.

Rather than providing a complete class library for object concurrency, it has also been proposed to add a discrete "tasking package" to an existing class library (Doeppner, et al.)6. In the Doeppner model, the tasking package consists of four C++ classes to be used by the programmer as base classes to build their own classes for parallel computations. The first of these i9 the task class, and the constructors of any class derived from this task class run as a separate thread control in the program. The package also includes a second class, called monitor, which defines a set of routines to make a derived thread act as a monitor for the controlled sharing of the data between different ,.
4P.A. Buhr, et al., "~C++: Concurrency in the Object-Oriented Language C++", Software Practice and Experience, 22(2), February 1992.
B.N. Bershad, et al., "P~ESTO: A System for Object-Oriented Parallel Programming", Software Practice and Experience, 18(8), August 1988.
6T.W. Doeppner Jr. and A.J. Gable, "C++ on a Parallel Machine", , :~

- - ~

CA9-93-007 5 2 0 9 7 5 ~

tasks. Two additional classes, QHEAD and QTAIL, define a one way queue for communication between tasks. ~-Other proposals for specific abstract "task like" classes are found for directed purposes, as in U.S. Patent No.
5,142,674 - Barker et al, relating to the use of an abstract ---class in an object-oriented document or local library for constructing application dependent indices to an -~-object-oriented document database for random object retrieval.

In class libraries, such as Doeppner, which implement an ,~
"active object" abstraction, it is the job of the task constructor to spin off an independent thread of control for ~
instances of any class for which the task class is a base l--class. ~r~
~ "
Every time such an object is created, a series of constructors are invoked, one of them being the constructor for the task class. In normal executions of constructor invocation in C++, once space for a newly allocated object .-is reserved on the heap, its con.structor is called. This .~~
will be the constructor defined (if one is defined) for the .~-deepest level of inheritance. Because C++ specifies that these class constructors be executed before derived class constructors are executed, this deepest level of inheritance ~ ~~
will immediately call the constructor for its base class (at the second deepest level of inheritallce) before execution.
The called base class will in turn immediately call its own base constructor, and so on. Finally, the constructor for, "~
the task class will be called (assuming that the task class ~ ~ ~
has been used as the base class). Once the task constructor ~ A'~' finishes and returns, the constructor that called it will perform its construction duties (which may involve calling ~
constructors from member objects), and will then return to '' the constructor that called it. This continues until the --~
;

~b CS-87-26, Brown University Department of Computer Science, November ~ ~
, ~

., . ~ ,~

CA9_93_007 2 0 9 7 5 first constructor is allowed to do its construction. This ~ process is referred to as the invocation chain.

When the constructor for the task class is called, it generates a new thread of control, then directs the original thread to jump to the point in the program (called the originating call point) which immediately follows the invocation of the constructors, while the other thread continues executing the constructors. Typically in such libraries, the program makes the constructor for the derived class an infinite or semi-infinite loop, thus allowing the constructor thread to become an independent "activity" for the object.

In none of these prior applications for affecting concurrent processing is any provision made for message passing in the guise of C++ method invocation. Generally, communication happens solely with the use of shared variables and explicit message queues.

The reason for this is that C++ provides no native mechanism for selectively controlling which methods (or member functions) of an object are invokable.

It is therefore an object of the present invention to provide a mechanism in an unextended object-oriented language such as C++, permitting selective acceptance of messages passed between objects and delaying acceptance of other messages for later acceptance, for use in connection with a standard non-extended compiler.
:'~
It is also an object of the present invention to provide a method for implementing concurrent processing control r~, through method invocation.
- '' ~
It is a further object of this invention to avoid premature method invocation or object destruction in the processing of concurrent classes or multiple tasks in an object-oriented computing environment. ~ -~ ~ .
~.~

. ' , '~ J.'s, CA9-93-007 7 ;~
20975~
Accordingly, in one aspect, the present invention is --directed to providing a mechanism for implementing non-sequential virtual function invocation in a object-oriented computing environment having a non-extended compiler, dynamic memory storage for constructing object ~
classes, a class library storage containing function - ' execution data, a virtual function table located in the class library storage having pointers to function implementation data for implementing virtual functions in a program, and first linkage means for indexing an object having virtual functions constructed in the dynamic storage with the virtual function table. The mechanism comprises an ~-interface adapted to selectively delay indexing of virtual ~ -c~-functions from the object constructed in the dynamic storage with the virtual function table, and second linkage means for indexing the object having virtual functions with the ~ ~-virtual function table through the interface.
, ,,,,,~, Preferably, the interface is a protocol function table ~~
having pointers to function execution data in the class j library for selecting virtual functions to delay access to the virtual function table, and the second linkage means replaces the first linkage means with an indexing link to the protocol function table. -~
,,,. .
In another aspect, the present invention is directed to a ~ ' ~-class library adapted for use in an object-oriented ~ -computing environment. The library includes virtual function execution data for executing virtual functions declared in class objects from the library. The library also includes a virtual function table pointing to the ~-~
virtual function data for access from class objects from the ~ c library, and an interfacej preferably a protocol function table, adapted to be linked between the virtual function ~ i table and class objects from the library. The interface has ~-' -means for delaying access from class objects to the virtual function execution data in the library. -, .. ..
In a further aspect, the present invention provides, in a '.-~
compiled object-oriented language operating system having an ~'~
operating program, a dynamic memory stack for allocation of ~'~
v ,~

,, ~, . .
,,~, ~: ", ~ - ~,~

~ CA9-93-007 ~ 7 ~ 41 ~.

activation records and at least one actlvati~n record for said operating program allocated on the stack, a stack pointer located on the stack pointing to an originating call point in said at least one activation record, dynamic memory storage for constructing object classes from a class hierarchy, a class library storage containing function execution data, a virtual function table located in said class library storage having pointers to function execution data for executing virtual functions in a program, and first linkage means for indexing a data object in the class hierarchy having virtual functions constructed in said dynamic memory storage with said virtual function table, a mechanism for creating concurrent processing threads. The mechanism comprises a first base class in the class hierarchy adapted for constructing a concurrent thread of control in the operating program as a virtual function and adapted for indexing through the first linkage means to the virtual function table when constructed in the dynamic memory storage, means for storing an index to said at least one activation record in the data object on allocation of the data object in the dynamic memory storage, means for accessing the index on construction of the first base class in the dynamic memory storage, an interface adapted to delay complete construction of the concurrent thread of control in the operating program from the first base class constructed in the dynamic memory storage, and second linkage means for indexing the first base class with the virtual function table through the interface.
.: .
. . ~.
The present invention also provides a method for controlling :
method invocation sequence in a object-oriented computing environment in which there is a non-extended compiler, dynamic memory storage, a class library storage containing I-y'~
function execution data for class objects, a virtual ~~"
function table pointing to said function execution data and 'r~
linkage means for indexing an object having virtual functions constructed in said dynamic storage with the -virtual function table. the method comprises the computer ~, , ~ .
implemented steps of constructing a class object having -j.
virtual functions from the library in the dynamic memory ... .

CA9-93~007 9 ~

storage, creating a first register in the class object ~.
indexing the virtual functions in the class object to the ~ :
virtual function table, creating an interface protocol table for selectively delaying execution of virtual functions . .:
invoked through the class object, replacing the first register with a second register in the class object indexing the virtual functions in the class object to the protocol ~:
function table, and and indexing the protocol function table to the virtual function table.

:, Embodiments of the invention will IIOW be described in detail :
in association with the accompanying drawings, in which: ~
~ ~
Figure 1 is a schematic representation of the index linkage ~' between the heap allocation of an object in C++ having .~Y
virtual functions and a corresponding virtual function table for the class hierarchy;

Figure 2 is a schematic representation of index linkage, ~ ' similar to that depicted in Figure 1, following substitution ~~'~
of a protocol function table interface between the object .
and the virtual function table, according to the invention; ~

Figure 3 is a schematic representation of a portion of -'n dynamic stack memory on allocation of additional activation .
records at the start of construction of a hierarchical ~y.-class, according to a furtller aspect of the invention; -~

Figure 4 is a schematic representation similar to Figure 3 of allocation of activation records following construction ~:
of a base constructor in the class hierarchy; and Figures 5 and 6 are a flow diagram illustrating the computer implemented steps in executing concurrency, according to one : .
aspect of the invention. -~

According to the present invention, in the case of ,~ -sequential object-oriented languages such as C++, correct . -~
execution of methods invoked non-sequentially can be '~
accomplished through transforming otherwise sequential ~. -:',',~

~','' ~ ~

tj~ C - .v,, 'Y,' "~

~ CA9-93-007 10 2 0 9 75 ~1 r i~
~ s classes in the class hierarchy to concurrent or non-sequential classes.

To create non-sequential classes, the present invention ~-~
provides an interface with a known mechanism, the virtual '~
function table.
~, Although run-time method linking simplifies object-oriented programming and optimizes compile time, the requirement to search through multiple classes in a hierarchy to determine all of the parameters of the lnvoked method adds to run-time, and is not desirable in efficient object-oriented languages such as C++.

To rapidly traverse the class hierarchy during method invocation at run-time in C++, a virtual function table 2 as shown in Figure 1 is accessible from the object 1 constructed on the heap. The virtual function table 2 lists all virtual (inherited) functions in the order defined in the class hierarchy, and is accessed or linked through storage of a "vtab" pointer 3 in a register in the object''s heap allocation 1. Reference to the virtual function table through the vtab pointer establishes the exact ranking of the invoked method in all classes in the hierarchy and the virtual function (vfl through vfn) points directly to the correct location in each class of the hierarchy, in order to reduce run-time in locating all o~ the parameters defining the method for the object called.
, As shown in Figure 2, implementation of the current invention involves the establishment of a subsidiary or "protocol" virtual function table 4 containing a table of generic protocol functions that are universal for all executions.

In addition, the vtab pointer 3 (from Figure 2) for the virtual function table 2 is stored as a variable 3' (in Figure 3) in a private area of the object on the heap 1, and is not directly accessible on method invocation. It is replaced by a new vtab pointer 5 that points to the the protocol virtual function table 4, and the virtual function :~-, , i~ ~
.. , - ~ ., '.: . :, ' . i.~

7 5 4 1 ~

pointers (vfl through vfn) are indexed to the protocol virtual function table 4.
In a preferred embodiment of the present invention, the protocol virtual function table is implemented through a base class (task class) in a class library. Whenever an object of a subclass derived from the task class has a method declared as virtual, particularly a method invokable from another object, the protocol mech~ni~m from the library will replace the vtab pointer 3 for that object with the new protocol vtab pointer 5 pointing to the protocol virtual function table 4.

Each protocol function (pfl through pfn) in the protocol virtual function table 4 is defined so that it will, on completion of its protocol fimction, invoke the correct virtual function. Thus, pf I will invoke vfl, pf2 will invoke vf2, and so on. The protocol function pointers can either be indexed directly to their corresponding virtual function pointers, or indirectly through the vtab pointer 3 stored in the object.

Protocol functions can be used for selectively delaying acceptance for execution through the virtual function pointers of certain messages, until a specified event has occurred. Examples of this would include:

1. delaying premature method invocation during object construction;

2. executing a waiting protocol function to ensure completion of the thread's operation to avoid premature object destruction;

3. re-directing a thread of control to a remote processor for executing a remote procedure call (this is described in detail in concurrently filed Canadian patent application number 2,097,540, titled "Accessing Remote Data Objects in a Distributed Memory Environment"); and ,, 4. in creating concurrency, ~r ~ ~ 7 5 ~ ~ ;
"
a) delaying starting a new thread of control pending implementation of certain tasks such as locating the original calling point in the operating program to return --the original thread of control following implementation of -~
the concurrent object, and ~' b) conversely, delaying directing the thread of the r~
parent object to the originating call point on the stack ~' until the new object has been fully constructed, to avoid ~' method invocation in the new object until its construction ~:-is complete.

In connection with creating object concurrency, the task class defines the invokable method for creating a new thread of control. which, according to the preferred embodiment, is --~
declared as a virtual function. The invocation of the ~;
concurrency method activates the protocol function mechanism by copying the vtab pointer 3 into an instance variable of ~'~
the task class and replacing the original vtab pointer 3 ~"
with a new protocol vtab pointer ~ stored in a register in :~-the object's heap allocation 1 pointing to the table of protocol functions located in tlle cla.ss library for the task -class.
~.
However, spinning off a new thread of control is delayed pending completion of the new object's construction. Once ;~
the task class constructor returlls, construction by other ~- -constructors in the class hierarchy continues until control ~"k'~' is given to the constructor for the object originally called ~ .
from the operating program. Upon completion of object construction, the first protocol function invoked spins off the thread for the newly created object, and the original ' thread is permitted to return to the original calling point in the operating program. -~
!
A mechanism for locating the originating call point on the ~-i.'A.,~_ stack for a calling program from a base class constructed on '' the heap from a class hierarchy is described in detail in my i~-concurrently filed application titled "Linkage for Accessing ~ ~

;i '~'' ,-,.~

,. ~

.' ' '~ "
~ '",~ -:

4 ~
~.

Data Objects in the Stack", Canadian Patent Application No. 27097,542, and is illustrated in Figures 3 and 4 herein. This technique can be combined with the present invention in a single linkage mech~nism to provide a simple and direct method for replacing the vtabs, according to the present invention, as described hereafter.

The combined linkage mechanism provides an elegant and automatic means for effecting concurrency that is portable to a wide variety of processing systems. In some operating systems, the task constructor could simply store a pointer to a global automatic start routine for accessing the protocol function mechanism alone or the combined linkage mechanism.

In effecting concurrency, a problem arises when the task constructor executes in an invocation chain where the number of levels of inheritance and which levels define constructors is unknown. As discussed in my concurrently filed application number 2,097,542, the task (base) constructor does not know where to look for the address of the orip:in~ting point in the program.

This can be solved by saving an index or variable, such as the stack pointer or the return address for the original program in the data object at the time of its heap allocation, that is, at the time the calling/operating program's activation record on the stack calls the object's constructor and the first activation record for the object is allocated on the stack (Figure 3).
Then, by the time the constructor for the base constructor is called and numerous activation records for each of the intervening classes in the hierarchy have been constructed on the stack (as shown under brackets 14, 16, 18 and 20 in Figure 4), the task constructor will be able to directly locate the original stack pointer location through the indexed variable stored in the object's heap allocation and return the original thread of control there after creation of the concurrent thread.

CA9-93-007 14 2 0 9 7 ~ 41 In the present implementation, in addition to storage of the original stack pointer value into an instance variable in the task class activation record on the stack, invocation of .
the task constructor also copies the address of the object . .
under construction into the link record pointed to by the s original stack pointer value. This record establishes when the new object's constructor has been called and the new object has been fully constructed. -~
,.,.,~
Thus, the protocol function table in the present invention ensures optimal timing in delaying the spinning off of the new thread of control and returning the parent (original) thread to the originating call point on the stack until both the new object has been created and the originating call point located.

Figures 5 and 6 provide an outline of the foregoing steps in a flow diagram.
'~
In Figure 5, the start of an operating program (block 40) results in the allocation on the stack of an activation record for that program 42. Norma]ly, the program's call to a data object from a class hierarchy would result in allocation for constructing the data object on the heap, but pursuant to a preferred embodiment of the invention illustrated in these Figures, the object's heap allocation i8 designated as an "active" object through accessing an overloaded "new" operation in the task base class 44, before allocation of the data object on the heap 46. The "new"
operation causes the stack pointer from the original activation record to be stored in the data object heap allocation 48. On return to the original program from "new"
50, the invocation chain is activated 52, and activation records are allocated on the stack for the "active" object of class construction on the heap 54. When the selected base constructor is called 56, if it contains no operation (such as concurrency) requiring return to the original activation record, object construction on the heap is simply completed (blocks 58 and 60). However, if a concurrency task is to be executed, then the stored stack pointer is ~"
~ ;, , ~: ' ' , ~, ~ ~.
,~ ~ ~ "

CA9-93-007 15 2 0 9 7 ~

accessed as a means of locating the original activation record (blocks 58, 62 and 6~).

Figure 6 is a continuation of the Figure 5 flow diagram. As shown in Figure 6, the return to the original activation record permits access to the return address for the original activation record which is stored in the data object heap allocation 68. In the present implementation, the return address in the original activation record is replaced with the address of an "auto start" operation 70, then the object pointer is stored in a pre-determined place in the stack 72 and object construction on the heap is completed 74.

The "auto start" executes several actions 76, including accessing the stored object pointer from the stack 78, saving the vtab pointer 80 and replacing it with a pointer to the protocol function table 82.
, Where the task is concurrency, in this embodiment, a separate thread is spun off as a protocol function 86 and the stored original return address accessed 88 to return to the original program 90. Where tlle task is not concurrency, the calling program can be accessed directly through the stored original return address (blocks 88 and 90).
Another use for the delay function of protocol functions is as a method to delay future invocations of itself or other -j-methods in its object, in order to prevent concurrency within an object in a concurrent processing environment.
One example of this type of application would be with i~' buffers that operate on "put" (to put data items in the buffer) and "get" (to take data items from the buffer). =i~-Where the buffer is full, the protocol interface of the ~
present invention would delay passing further method ' invocations into the buffer, and where the buffer is empty, the interface would delay the "get" method. The "put"
method would then cancel the delay on the "get".

A second example of the use of protocol functions to prevent ;~ -r,i-.
concurrency within an object would be to replace the monitor class from the Doeppner example described above, providing -in lieu, a method invocation delay operation when when an -~'"'' ' .
.,. ~.
.

object's method has been invoked and is executing under a dirre--el1~ call or thread.

Protocol functions can be used to solve other problems as well. They can ensure that the thread of an active object has been started before permitting invocation of its methods, and when the protocol function finds that the thread is not running, it can start it. In this type of implementation, it would actually be unnecessary or optional to include a separate routine for starting concurrent threads, and it would also not be necessary to implement the stack storage process described in my concurrently filed application entitled "Linkage for Accessing Data Objects in the Stack", application number 2,097,542, since the protocol function spinning off the new thread of control would have direct access to the object on the stack invoking the new object's method(s).

Embodiments of the invention have been described in detail herein, but modifications to the invention obvious to those skilled in the art are intended to be covered by the appended claims.

Claims (13)

1. In an object-oriented computing environment having a non-extended compiler, dynamic memory storage for constructing object classes, a class library storage containing function execution data, a virtual function table located in said class library storage having pointers to function execution data for executing virtual functions in a program, and first linkage means for indexing an object having virtual functions constructed in said dynamic storage with said virtual function table, a mechanism for executing non-sequential virtual function invocation, comprising:

an interface adapted to selectively delay indexing of virtual functions from said object constructed in the dynamic storage with said virtual function table; and second linkage means for indexing the object having virtual functions with the virtual function table through said interface.
2. A mechanism, according to claim 1, wherein the interface comprises a protocolfunction table having pointers to function execution data in the class library for selecting protocol functions to delay access to the virtual function table.
3. A mechanism, according to Claim 2, wherein the second linkage means comprises:

means for replacing the first linkage means in the object with an indexing link to the protocol function table; and means for generating an index between the protocol function table and the virtual function table.
4. A mechanism, according to Claim 3, wherein the means for generating an index between said protocol function table and said virtual function table comprises means for establishing pointers in the protocol function table pointing to the pointers in the virtual function table.
5. A mechanism, according to Claim 3, wherein the means for replacing the first linkage means in the object with an indexing link to the protocol function table includes means for separately storing the first linkage means, and the means for generating an index between the protocol function table and the virtual function table comprises means for indexing the protocol function table to the separately stored first linkage means.
6. A class library adapted for use in an object-oriented computing environment, comprising:

virtual function execution data for executing virtual functions declared in class objects from the library;

a virtual function table pointing to said virtual function execution data and adapted to be accessed from class objects from the library; and an interface adapted to be linked between the virtual function table and class objects from the library, and having means for delaying access from class objects to the virtual function execution in the library.
7. A class library, according to Claim 6, further comprising generic function execution data for executing delay functions, and wherein the interface comprises:
a protocol function table pointing to said generic function execution data; and means for indexing the protocol function table to the virtual function table.
8. A method for controlling method invocation sequence in an object-oriented computing environment having a non-extended compiler, dynamic memory storage, a class library storage containing function execution data for class objects, a virtual function table pointing to said function execution data and linkage means for indexing an object having virtual functions constructed in said dynamic storage with the virtual function table, comprising the computer implemented steps of:

constructing a class object having virtual functions from the library in the dynamic memory storage;

generating a first register in the class object indexing the virtual functions in the class object to the virtual function table;

generating an interface protocol table for selectively delaying execution of virtual functions invoked through the class object;

replacing the first register with a second register in the class object indexing the virtual functions in the class object to the protocol function table; and indexing the protocol function table to the virtual function table.
9. A method, according to Claim 8, further comprising the step of storing said first register as a variable in the class object.
10. A method, according to Claim 9, wherein the step of indexing the protocol function table to the virtual function table comprises the step of indexing the protocol function table to the first register stored as a variable in the class object.
11. In a compiled object-oriented language operating system having an operating program, a dynamic memory stack for allocation of activation records and at least one activation record for said operating program allocated on the stack, a stack pointer located on the stack pointing to an originating call point in said at least one activation record, dynamic memory storage for constructing object classes from a class hierarchy, a class library storage containing function execution data, a virtual function table located in said class library storage having pointers to function execution data for executing virtual functions in a program, and first linkage means for indexing a data object in the class hierarchy having virtual functions constructed in said dynamic memory storage with said virtual function table, a mechanism for providing concurrent processing of threads, comprising:

a first base class in the class hierarchy adapted for constructing a concurrent thread of control in the operating program as a virtual function and adapted for indexing through the first linkage means to the virtual function table when constructed in the dynamic memory storage;

means for storing an index to said at least one activation record in the data object on allocation of the data object in the dynamic memory storage;

means for accessing the index on construction of the first base class in the dynamic memory storage;

an interface adapted to delay complete construction of the concurrent thread of control in the operating program from the first base class constructed in the dynamic memory storage;
and second linkage means for indexing the first base class with the virtual function table through said interface.
12. A mechanism, according to Claim 11, wherein the means for storing an index to said at least one activation record comprises means for storing the stack pointer pointing to an originating call point as a variable in the data object allocated in the dynamic memory storage.
13. A mechanism, according to Claim 12, wherein the interface comprises a protocol function table having pointers to function execution data in the class library for selecting protocol functions to delay access to the virtual function table and the second linkage means comprises:

means for replacing the first linkage means in the object with an indexing link to the protocol function table; and means for generating an index between the protocol function table and the virtual function table.
CA002097541A 1993-06-01 1993-06-01 Concurrency control through a class library in object oriented technology Expired - Fee Related CA2097541C (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CA002097541A CA2097541C (en) 1993-06-01 1993-06-01 Concurrency control through a class library in object oriented technology

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CA002097541A CA2097541C (en) 1993-06-01 1993-06-01 Concurrency control through a class library in object oriented technology
US08/674,266 US5632034A (en) 1993-06-01 1996-07-02 Controlling method invocation sequence through virtual functions in an object-oriented class library

Publications (2)

Publication Number Publication Date
CA2097541A1 CA2097541A1 (en) 1994-12-02
CA2097541C true CA2097541C (en) 1998-12-01

Family

ID=4151733

Family Applications (1)

Application Number Title Priority Date Filing Date
CA002097541A Expired - Fee Related CA2097541C (en) 1993-06-01 1993-06-01 Concurrency control through a class library in object oriented technology

Country Status (1)

Country Link
CA (1) CA2097541C (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5794041A (en) * 1996-12-06 1998-08-11 International Business Machines Corporation C++ ojbect model alternatives
US6052778A (en) * 1997-01-13 2000-04-18 International Business Machines Corporation Embedded system having dynamically linked dynamic loader and method for linking dynamic loader shared libraries and application programs
US6363436B1 (en) 1997-01-27 2002-03-26 International Business Machines Corporation Method and system for loading libraries into embedded systems
US6401137B1 (en) 1998-06-30 2002-06-04 Sun Microsystems, Inc. Method, apparatus, and article of manufacture for processing a virtual call in a multi-threaded program

Also Published As

Publication number Publication date
CA2097541A1 (en) 1994-12-02

Similar Documents

Publication Publication Date Title
Halstead Jr Multilisp: A language for concurrent symbolic computation
Pascoe Elements of object-oriented programming.
EP1474753B1 (en) Component model for real time system control
US7721286B2 (en) Preemptive multi-tasking with cooperative groups of tasks
JP4783471B2 (en) How a computer system to perform to run by calling a method that class has
EP0664903B1 (en) Loader system
US6029207A (en) Apparatus and method for dynamic linking of computer software components
US5659747A (en) Multiple level undo/redo mechanism
US6353923B1 (en) Active debugging environment for debugging mixed-language scripting code
US6542885B1 (en) Methods, systems and computer program products for controlling variables associates with transactions in a multiple transaction environment
US6052739A (en) Method and apparatus for object-oriented interrupt system
Karmani et al. Actor frameworks for the JVM platform: a comparative analysis
US5237654A (en) Hierarchical inter-panel process flow control
US6167424A (en) Method and apparatus for concurrent thread synchronization
US7076773B2 (en) Object oriented apparatus and method for allocating objects on an invocation stack in a dynamic compilation environment
US8171491B2 (en) Object synchronization in shared object space
Galilée et al. Athapascan-1: On-line building data flow graph in a parallel language
AU734115B2 (en) Hardware accelerator for an object-oriented programming language
Nikhil Executing a program on the MIT tagged-token dataflow architecture
US5732263A (en) Systems, methods and computer program products for generating and validating user defined object classes in an object oriented programming environment after build time
US6275979B1 (en) Implementation for an object oriented run-time extensible item
US5237691A (en) Method and apparatus for automatically generating parallel programs from user-specified block diagrams
Weiser et al. The portable common runtime approach to interoperability
US5611043A (en) Debugger system and method for controlling child processes
US6163880A (en) Object model for Java™

Legal Events

Date Code Title Description
EEER Examination request
MKLA Lapsed