Time


Process intervals have TimeValues represented by either Cardinal or Real numbers.

If a TimeValueis Cardinal, time is measured by machine instruction cycles.

If a TimeValueis Real, time is measured in seconds.

If expr is any Expression, and t is a TimeValue, then...

Time[t][expr]

...evaluates expr for time t, or until it is finished.

A timed evaluation is initiated that ends after t cycles or seconds, or when expr's evaluation is complete.

This timed process begins by returning...

Return[n[Time]]

...where n is a unique Cardinal assigned to expr's pending evaluation formally named "n[Time]" and called process-n.

The Kernal indexes timed evaluations by assigning the lowest unassigned Cardinal value to each new process.

Time[]

...is assigned to the Set of Cardinals that index all existing processes (including halted processes).

So long as "Return[n[Time]]" has no assigned value, expr is incompletely evaluated.

Once assigned and invoked, "Return[n[Time]]" removes its elicitation after returning its assignment.

True[Return[n[Time]]] returns True if process-n is incomplete, and returns False if it is complete.

If n is a Cardinal,

Name[n[Time]]

...returns True, when process-n isexecuting,

returns False, if itis a halted process, and

returns unchanged if n is not a process Cardinal.

If process-n is a halted process, (Name[n[Time]] is False), then it can be restarted with...

Time[t, n]

"Return[n[Time]]" returns immediately, and process-n executes for TimeValue t, or until complete.



See English definition of "time".




TimeValue


Aninstruction cycle is the time increment used to synchronize machine instructions.

A simple machine instruction executes in a single instruction cycle, while a complex machine instruction, (such as integer divide), takes more then one instruction cycle.

A Cardinal TimeValue designates time ininstruction cycles and is sometimes called CardinalTime.


A RealTimeValue designates time measured in Seconds.

Time[...] elicitations use TimeValues specified as the number of instruction cycles or by an execution interval given as a Real number of Seconds.




Cardinal[Time][expr]


If expr is any unevaluated Expression, then...

(1)                    Cardinal[Time][expr]

...evaluates "expr" returning the form...

                        cardinalTimeValue[...evaluatedExpr...]

...where cardinalTimeValue is the cardinal number of instruction cycles required to evaluate expr to its result (...evaluatedExpr...).

CardinalTime provides a measure of the underlying computational time-cost of an algorithm. A correct implementation of (1) on a multi-threaded processor, only counts those machine cycles involved in the evaluation of expr. Machine cycles involved in setting up the cycle count, attending other intervening but unrelated processes, or formatting the output on the display device are not be included in the count since they do not measure the evaluation's underlying computational time-cost. (By contrast, RealTime measures the actual time in seconds used by Real[Time][process], with no regard for the extra cycles required to generate the timed process interval in seconds.)

If (1) is implemented on a parallel processing machine, then one machine cycle may involve many simultaneous instructions implemented on different processors. The Cardinal TimeValue is intended to measure the number of processor instruction cycles needed to complete an evaluation. If, for example, there are 8 processors each executing instructions towards the evaluation of the same Expression at the same time, then each machine cycle counts 8 towards the Cardinal TimeValue count. The coordinating context documenting techniques that realize Cardinal TimeValue counts on different hardware platforms is `Time`Processor`.

CardinalTime provides a measure of the underlying computational time-cost of an algorithm.

Cardinal[Expression][ expr] gives the itemized list of the machine instructions used in an algorithm. Thus...

                    Cardinal[Time][Cardinal[Expression][expr]]

...will return

                    cardinalTimeValue[result[machinInstr1, machinInstr2, ..., machinInstrN]]


...which is the detailed account of the machine's activity in the evalution of expr to get to the result.
In general, the cardinalTimeValue will not equal the sequence-length of machinInstr because a machinInstr may require more then one machine cycle.

A correct implementation of (1) on a multi-threaded processor, only counts those machine cycles involved in the evaluation of expr. Machine cycles involved in setting up the cycle count, attending other intervening but unrelated processes, or formatting the output on the display device are not included in the count since they do not measure the evaluation's underlying computational time-cost.



RealTime


If expr is any unevaluated Expression, then...

(2)                Real[Time][expr]

...evaluates "expr" returning the form...

                    realTimeValue[...evaluatedExpr...]

...where realTimeValue is the time in Seconds (real valued) required to evaluate expr to its result, "...evaluatedExpr...".

Unlike CardinalTime, the RealTime of an Expression-evaluation specifies the seconds in the time interval between Expression-input and result-output. This will depend on the processor’s hardware and software configuration. The object of RealTime is to provide a measure of the actual time required to implement an algorithm in the "real-world", where machines are burdened with competing chores and system overhead, or facilitated with coprocessors. Generally speaking, the results returned by an algorithm’s RealTime will vary on the same machine depending on the priority given to other processes competing for instruction cycles. By knowing the time increment of instruction cycles and the CardinalTime of an algorithm, it is possible to prioritize threads to guarantee that a deterministic algorithm will be executed within a specific RealTime.




Timed Expression Evaluation


If expr is any Expression, and t is a Real or Cardinal TimeValue, then...

(3)                Time[t][expr]

...immediately returns expr if it has no assignment. If expr is assigned, (True[expr] is False), a timed process is initiated to evaluate expr. This timed process begins immediately after the Kernal uniquely identifies and announces this process by returning the following...

(4)                Time[Return[n]]

In the above, n is a unique identifying Cardinal assigned to expr's pending evaluation. So long as (4) has no assignment, expr has not finished processing. On the other hand, if the evaluation of expr is complete, (4) will have an assigned value (E.G. "True[Time[Return[n]]]" is False). Subsequently eliciting (4) returns expr's finished evaluation, and removes the assignment to (4).

Time[...] manages timed processes with identifying Cardinals. These Cardinals are used to access process state information. If...

(5)                Name[n[Time]]

...is True, process-n is currently executing.

If (5) is False, process-nis a halted process.

If (5) is unassigned, then it has finished!

The following construction presumes the existence of process-n, and tests for its completion:

(6)                True[Name[n[Time]]]

The above test is False until process-n is complete.  Thereafter, (6) will be True.  This will be True until "Time[Return[n]]" is invoked to return the result of the completed process, (and purge Time[...]'s association with n).

If process-n is a halted process, it may be restarted as follows:

(7)                Time[t, n]

If successfully restarted, "Time[Return[n]]" is immediately returned, and process-n executes for TimeValue t, or until it is complete.

The context documenting techniques that realize Cardinal TimeValues on different hardware platforms is `Time`Processor`.

The Timed Expressionevaluation (3) initiates a virtual result which may or may not come to fruition. The result of (3) is virtual in the sense that when and if expr is completely evaluated, "Time[Return[n]]" returns this result and then removes that assignment to "Time[Return[n]]".

The side-effects, if any, of this timed process are not virtual; they are real. Consequently, well-designed software has clearly specified and accomodated side-effects or no side-effect.

In general, when a Timed Expressionevaluation is interrupted there is no reliable way to know the environmental state unless there are procedural provisions explicitly constructed towards this end. Thus, in principle, the Timed Expressionevaluation (3) is easily abused unless the programmer confines these virtual processes to interuptable environments designed to maintain functional and contextual integrity.

If expr is an object in the Timed Expressionevaluation ( Time[t][expr] ), then for the sake of reliablecode, an interuptable process requires either:

  1. The process environment in expr is insulated from other processes.
  2. The invoking routine, (of Timed Expression evaluations like ( Time[t][expr] )), is insulated from the environmental consequences of evaluating expr.

A procedure is "insulated" from other processes if either:

It is bad practice to interfere with a halted process environment. Such practice will generally compromise the halted process, and can easily defeat a program or produce an unrecoverable loop. Debugging applications may be the only advisable exception to rule (2) above.




The setof Time[]'d processes


(8)                Time[]

...is assigned to the Set of Cardinals that index all existing processes.

Existing processes include halted processes, which may be restarted using (7).

(9)                Sequence[][Time[]]


...returns the Sequence of Cardinals identifying existing processes.




English definition of "time"


time
n.

1. The period during which an action, process, condition, or the like, continues; the interval between leaving and returning, beginning and ending, etc.; measured or measurable duration; as, gone a long time; written in three hours time.


virtual
adj.

1. Of or relating to a real force or virtue (See VIRTUE, n.,2); having the power of invisible efficacy without the agency of the material element; potential; energizing. Archaic.

2. Being in essence or effect, but not in fact; as, the virtual presence of a man in his agent or substitute.

Suddenly...they (the Romans) became the actual or virtual rulers of the entire circuit of the Mediterranean. J.A. Froude.

3. Obs. a Virtuous. b Effective.




Grok32`

(c) 2006-2007 by

John Van Wie Bergamini.

All rights reserved.

Hosted by www.Geocities.ws

1