| OCR Text |
Show main process creates several subprocesses that attach the problem with different algorithms. After the main process receives the solution from the most successful subprocess, the computations in all other subprocesses are cancelled. Introspection can greatly help in controlling and managing the processes. Without introspection, the main process must passively wait for a response from subprocesses. With introspection, the main process can act as a director that actively participates with subprocesses by monitoring their progress. Based on the progress, resources may be reallocated from less successful subprocesses to more successful. This provides for a dynamic allocation of resources. Without introspection, most of the allocation must be done statically, since mechanisms for a dynamic allocation are limited. 3.3.7 Dynamic Program Optimization The director in the competition of algorithms uses only a part of tools that are provided by introspection. Its role is limited to the managing of resources by changing scheduling priorities and similar activities. A generalization of this approach leads to directors that dynamically change the code of running processes. This generalization is closely related to partial evaluation. Given input values of a program, partial evaluation specializes the program to these input values. Usually, the specialized program executes faster than the original program, since it can use the knowledge about input values. With partial evaluation, there is always a tradeoff between the time that is spent during specialization of the program and the time that is saved during the execution. If savings in execution time in a particular case are smaller than deposit in specialization time, then partial evaluation obviously does not pay off. Using introspection, the solution is to start the execution of the original program and to perform partial evaluation dynamically during the execution. If partial 60 |