GemStone Frequently Asked Questions

Copyright © 1994 Vikas Malik

All Rights Reserved

This FAQ may be posted to any USENET newsgroup, on-line service, or BBS as long as it is posted in its entirety and includes this copyright statement.

This FAQ may not be distributed for financial gain.

This FAQ may not be included in commercial collections or compilations without express permission from the author.


Vikas Malik -

Knowledge Systems Corporation



Q. What is GemStone?
Ans. GemStone is an Object- Oriented database.

Q. How do I spell GemStone?
Ans. GemStone is always spelled with upper case S. Some smart recruiters will look for upper case S in your resume.

Q. What is the Stone?
Ans. The stone process handles locking and concurrent access to objects in the repository. Each repository is monitored by a single stone.

Q. What is a Gem?
Ans. Gem is the object server for user application. The Gem reads the repository as the application accesses objects, and it updates the repository when an application commits a transaction. A repository can have more than one Gem process.

Q. What is a Repository?
Ans. Repository stores GemStone classes and persistent objects.

Q. What is the difference between a linked and RPC application?
Ans. In a linked application, Gem is integarted with the application into a single process whereas in a RPC application, Gem runs as a separate process and responds to RPCs from the application.

Q. What is GemBuilder?
Ans. GemBuilder is a set of classes and primitives installed in client smalltalk image to facilitate working with the two object spaces (Smalltalk-Client & GemStone-Server).

Q. What is GBSM?
Ans. GBSM is global that refers to the sole instance of GbsSessionManager class. GBSM manages all known GemStone sessions and keeps track of the current session.

Q. How do I log into GemStone programmatically?

Ans.GBSM loginWithParameters: aGbsSessionParameters.
    aGbsSessionParameters login.
Q. What are the two different types of transaction modes in GemStone?
Ans. 1. Automatic transaction mode: A new transaction begins automatically when one commits or aborts a transaction.
2. Manual transaction mode: Transactions begin as a result of explicit request.

Q. What is a connector?
Ans. A connector connects a GemStone object and a client smalltalk object when a session logs in to the database.

Q. What are the different kinds of connectors?
Ans. 1. Name connector connects a smalltalk object with a GemStone object based on their names (which can be different).
2. Fast connector keeps a direct reference to a smalltalk object and a GemStone object id. This makes the connection fast because no resolution is necessary.

Q. What is the difference between a global connector and a session connector?
Ans. A global connector connects two objects whenever any session is logged in whereas a session connector connects two objects only when a specific session is logged in.

Q. Do I need to define a connector for every object in my application?
Ans No, because a connector connects not only the immediate object but also all those objects that can be reached from it. Define connectors for only the root objects of the persistent subsystems.

Q.What is a root object?
Ans. Root objects of an application are the persistent objects from which all
other persistent objects can be reached. The most common kinds of root objects are
(i) Global variables
(ii) Class variables
(iii) Class instance variables

Q What is a symbol list?
Ans. A symbol list is an array of symbol dictionaries. Symbol list is used in compilation of GemStone code, in order to resolve references to objects by name. Each GemStone user has a symbol list. Only objects named in symbol dictionaries in a userís symbol list are visible to that user.

Q. What are the names of default symbol dictionaries of a GemStone user?
Ans. Globals, UserGlobals, Published and UserClasses.

Q. How do I invoke a debugger in GemStone?
Ans. Insert self pause. in a GemStone method.

Q. What is the difference between the terms faulting and flushing?
Ans. The term faulting refers to moving modified GemStone objects into the client Smalltalk , either creating a client Smalltalk replicate or updating an existing replicate. The term flushing refers to moving modified client Smalltalk objects into GemStone.

Q. How do I remotely excute code in GemStone from Smalltalk side?

Ans.	aGSSession  excute: aString
	aString contains GemStone smalltalk code.

	aGSObject  remotePerform: aSelector.
Q. What is a forwarder?
Ans. A forwarder is a client smalltalk object whose state and behavior are actually in GemStone. The forwarder knows which GemStone object it represents, and responds to all messages by passing them to appropriate GemStone object. Forwarders are implemented by class GSForwarder. Its gsObj instance variable points to the proxy representing the GemStone object.

GSForwarder implements #doesNotUnderstand: as following.
#doesNotUnderstand: aMessage
		remotePerform: aMessage selector
		withArgs: aMessage arguments
Q. How do I create a forwarder?
Ans. 1. aGSConnector postConnectAction: #forwader
2. aGSSession fwat: anObject
3. by implementing class method #instancesAreForwarders to specify all instances
of a class are forwarders.
4. by sending #asForwarder message to an instance of GSObject class.

Q. What is the difference in results of sending the following messages to a forwarder?
aGSForwarder name and aGSForwarder fwname.

	 aGSForwarder name   returns a replicate.
       aGSForwarder fwname   returns a forwarder.
Q. What is a replicate?
Ans. A replicate is a Smalltalk copy of a GemStone object. Messages sent to replicates require no communication with GemStone for processing.

Q. What is a stub?
Ans. A stub is an empty placeholder that knows nothing except which object it represents in GemStone. It is implemented by GSObjectStub class.

Q. How do I control the number of levels to replicate when updating an object from GemStone to Smalltalk?
Ans. By implementing #defaultGStoSTLevel method of GSSession class. A level of 0 means no limit, replicate the entire object. A level of 2 means retrieve root object and each object it references . Objects at level 3 are converted into stubs.

Q. How do I unstub a stub?
Ans. By sending #fault message to a stub.

Q. Can I pass a stub as an argument to a primitive method?
Ans. No.

Q. How do I ensure that an object is never replicated to contain a stub down to a certain level?
Ans. Implement class method #noStubLevel. Its return value should be an integer specifying the number of levels to replicate.

Q. How do I convert a replicate into a stub?
Ans. By sending #stubYourself message to replicate.

Q. What is the result of sending a message to a stub?
Ans. It replicates the GemStone object it represents as a Smalltalk object, then become that object and forwards the message. GSObjectStub implements #doesNotUnderstand: as following.

#doesNotUnderstand: aMessage
	^self fault 
		perform: aMessage selector
		withArguments: aMessage arguments.
Q. What is the difference between lazy and immediate fault policy?
Ans. In lazy faultPolicy a change initiated in GemStone causes Smalltalk replicate to be turned into a stub whereas in immediate faultPolicy a chage initiated in GemStone replicates the client Smalltalk immediately.

Q. What do I mean by class history of a GemStone class?
Ans. GemStone supports multiple versions of a class. It keeps track of these versions in a class history object. Sending #classHistory message to a class returns its class history.

Q. How do I remove a version of GemStone class?

Ans. aClassHistory  removeVersion: aClass
Q. How do I find the latest version of a GemStone class?
Ans aClass classHistory last.

Q. How do I migrate all the instances of a class to its latest version?
Ans. aClass migrateInstancesTo: aClass classHistory last.

Q. How do I remove all the old versions of a class?

Ans. 1 to: ( aClass classHistory size - 1)
			do: [ :each | 
				aClass classHistory removeVersion: ( aClass classHistory at: each)].
Q. What is the difference between the results of sending #asLocalObject and #asLocalObjectCopy messages to aGSObject?
Ans. #asLocalObject returns a replicate. #asLocalObjectCopy returns a local deep copy of the GemStone object repesented by the receiver. This resultant object doesnít maintain the transparency between Smalltalk and GemStone.

Q. How do I mark a Smalltalk object as dirty?
Ans anObject markDirty. It is generally included in the setter methods for the object.

Q. How do I mark objects dirty automatically without sending #markDirty in setter methods?
Ans aClass markDirtyOnInstVarAssign marks the objects of aClass dirty on assignment of instance variables.
aClass markDirtyOnAtPut marks the objects of aClass dirty if they receive #at:put: messages.