Smalltalk80LanguageImplementation:Part 03

From 흡혈양파의 번역工房
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
PART THREE

Part Three is an example of modeling discrete, event-driven simulations in the Smalltalk-80 system. A simulation is a representation of a system of objects in a real or fantasy world. The purpose of creating a computer simulation is to provide a framework in which to understand the simulation situation. In order to create the Smalltalk-80 simulations, we first describe a hierarchy of classes that represent probability distributions. Various kinds of probability distributions are used to determine arrival times of objects, such as customers, into a simulation; they are also used to randomly select response or service times for workers in a simulation. The example class SimulationObject represents any kind of object that enters into a simulation in order to carry out one or more tasks; class Simulation represents the simulation itself and provides the control structures for admitting and assigning tasks to new SimulationObjects.


The objects that participate in event-driven simulations operate more or less independently of one another. So it is necessary to consider the problem of coordinating and synchronizing their activities. The Smalltalk-80 system classes, Process, Semaphore, and SharedQueue, provide synchronization facilities for otherwise independent simulation events. The framework of classes defined in this part support the creation of simulations that use consumable, nonconsumable, and/or renewable resources. They also provide a number of ways in which a programmer can gather statistics about a running simulation.


Notes