6
Microprocessing and Microprograrnming 31 (1991) 3-8 3 North-Holland SCHEDULER ARCHITECTURE FOR KNOWLEDGE BASED MEASURING SYSTEMS Zolt~n PAPP Department of Measurement and Instrument Engineering, Technical University of Budapest, 1521 Budapest, Hungary* Extending the capabilities of computerized measuring systems from mere data processing toward intelligent behaviour claims intensive application of knowledge based and other artificial intelligence originated algorithms. The paper presents a scheduler architecture, which provides a framework for integrating knowledge based and traditional data processing algorithms under real-time operating conditions. For keeping the scheduling task computionally tractable the scheduler extensively uses heuristic approach. I. INTRODUCTION In the recent years several research projects ware and has been being carried out investigating the possibilities of extending the capabilities of computerized measuring systems from mere data processing toward intelligent behaviour [i]. In this respect the "intelligent behaviour" and "intelligence" mean capability of taking over certain part of the task and responsibility of - the design and ~mplementation of measurements, - the real-time execution of the measuring procedure designed and the interpretation of the results. One of the key issues of the design of in this sense - intelligent measuring systems is the formulation and efficient implementation of the expertise required for solving the measuring problem. It has been proved that knowledge based (KB) and other artificial intelligence (AI) based techniques can advantageously be used to increase the intelligence level of measuring systems in several aspects. Unfortunately embedding KB and other AI based components into real-time environment induces several theoretical and implementatlonal problems [2,3,4]. A set of these problems are generated by integration of programs or program segments using AI originated algorithms (e.g. symbolic data processing, heuristic search algorithms) with special run-time bshavlour (e.g. not explicit control, dynamic memory management with garbage collection, time variant concurrency) and the (traditionally static) real-tlme control structure, which requires determinism in computation time [5]. Partly for reliability reasons, partly for physical constraints, partly for increasing the computational power of a real-time system in the recent years the distributed implementation of complex real-time systems has growing importance, and in this case the problems mentioned are more serious [2,6,7]. The aim of the paper is to present a run-time scheduler architecture, which provides a basis for developing (distrlhuted) real-time measuring systems in which AI based methods and programming techniques can intensively be utilized. The scheduler does not realize high level automatism for system-wide scheduling, but puts the details in the system designer's hand. It gives a framework, which suggests a way to think about dynamic distributed real-time systems, and in which the application dependent details can be expressed and separated from the application independent operations. The concepts of the scheduling philosophy and the architecture of the scheduler presented partly gained from the experience of developing and using the REALEX real-time expert system shell [4]. In the next section the motivation of the research and the characteristics of the current approaches are presented, then real-time operation model of the measuring systems concerned are shown. The forth section contains a detailed description of the multi-level scheduler. The paper is closed with conclusions and showing some directions of further research. 2. MOTIVATIONS, CURRENT STATUS Measuring systems are for realizing in some sense optimal measuring procedures. Providing optimality requires formalizing, physically or * Currently: Delft University of Technology, Department of Applied Physics, P.O.Box 5046, 2600 GA Delft, The Netherlands

Scheduler architecture for knowledge based measuring systems

Embed Size (px)

Citation preview

Microprocessing and Microprograrnming 31 (1991) 3-8 3 North-Holland

SCHEDULER ARCHITECTURE FOR KNOWLEDGE BASED MEASURING SYSTEMS

Zolt~n PAPP

Department of Measurement and Instrument Engineering, Technical University of Budapest, 1521 Budapest, Hungary*

Extending the capabilities of computerized measuring systems from mere data processing toward intelligent behaviour claims intensive application of knowledge based and other artificial intelligence originated algorithms. The paper presents a scheduler architecture, which provides a framework for integrating knowledge based and traditional data processing algorithms under real-time operating conditions. For keeping the scheduling task computionally tractable the scheduler extensively uses heuristic approach.

I. INTRODUCTION

In the recent years several research projects ware and has been being carried out investigating the possibilities of extending the capabilities of computerized measuring systems from mere data processing toward intelligent behaviour [i]. In this respect the "intelligent behaviour" and "intelligence" mean capability of taking over certain part of the task and responsibility of

- the design and ~mplementation of measurements,

- the real-time execution of the measuring procedure designed and the interpretation of the results.

One of the key issues of the design of in this sense - intelligent measuring systems is the formulation and efficient implementation of the expertise required for solving the measuring problem. It has been proved that knowledge based (KB) and other artificial intelligence (AI) based techniques can advantageously be used to increase the intelligence level of measuring systems in several aspects.

Unfortunately embedding KB and other AI based components into real-time environment induces several theoretical and implementatlonal problems [2,3,4]. A set of these problems are generated by integration of programs or program segments using AI originated algorithms (e.g. symbolic data processing, heuristic search algorithms) with special run-time bshavlour (e.g. not explicit control, dynamic memory management with garbage collection, time variant concurrency) and the (traditionally static) real-tlme control structure, which requires determinism in computation time [5]. Partly for reliability reasons, partly for physical constraints, partly for increasing the

computational power of a real-time system in the recent years the distributed implementation of complex real-time systems has growing importance, and in this case the problems mentioned are more serious [2,6,7].

The aim of the paper is to present a run-time scheduler architecture, which provides a basis for developing (distrlhuted) real-time measuring systems in which AI based methods and programming techniques can intensively be utilized. The scheduler does not realize high level automatism for system-wide scheduling, but puts the details in the system designer's hand. It gives a framework, which suggests a way to think about dynamic distributed real-time systems, and in which the application dependent details can be expressed and separated from the application independent operations.

The concepts of the scheduling philosophy and the architecture of the scheduler presented partly gained from the experience of developing and using the REALEX real-time expert system shell [4].

In the next section the motivation of the research and the characteristics of the current approaches are presented, then real-time operation model of the measuring systems concerned are shown. The forth section contains a detailed description of the multi-level scheduler. The paper is closed with conclusions and showing some directions of further research.

2. MOTIVATIONS, CURRENT STATUS

Measuring systems are for realizing in some sense optimal measuring procedures. Providing optimality requires formalizing, physically or

* Currently: Delft University of Technology, Department of Applied Physics, P.O.Box 5046, 2600 GA Delft, The Netherlands

4 7 Papp

conceptually building in and using of the model of the object to be measured, the model of the observations and .... the model of the implementation of the measuring procedures [i]. In the previous sense intelligent measuring systems claim building in and using so called "shallow level" models (e.g. qualitative, heuristic) besides the (traditional) mathematical one. This fact implies that measuring systems of this type are based on intensively cooperating knowledge based components and numerical data processing subsystems [8]. Although this integration induces several problems to be solved, our contribution is restricted to the problematics of embedding program segments using AI based algorithms into real-time environment in the measuring systems' application field.

The previous facts show that the systems investigated can be considered as a certain type of the real-time KB systems. There are various programming environments and language proposals to facilitate development of real-time KB systems [9,10,11]. Common characteristics of them is that they include a kind of knowledge representation language (typically a variation of a rule language), which can effectively be coupled with some kind of procedural language, and a sophisticated run-time environment (in most cases a kind of inference engine) for high speed execution. Most of these languages do not support concurrency and scheduling, say nothing about distributed problem solving, so they solve only a part of the problems arisen from the real-time measuring systems' application domain. However, YES/L1 [9] has notation for concurrency control, but it passes the scheduling toward to the operating system level, therefore can not handle temporal specifications efficiently. There are higher level tools as well for developing real-time KB software systems, but they are specialized, rigid environments, not appropriate for wide-spread (domain independent) use [12,13].

As a result of the intensive research work on the distributed problem-solving area in the last few years a number of valuable proposals and experimental implementations of programming languages, run-time architectures dedicated to distributed problem solvers emerged [14,15]. Their rather complex structure, complicated scheduling mechanism and high level automatism make the reliable estimation cf the reaction time impossible.

Our approach significantly differs from others in that way, that we do not put the emphasis on merely speeding up the execution of the AI related program segments and/or limiting the run-time indeterminism of that, but provide a framework by which the scheduling of the dynamic, in some sense indeterministic real-time system can be kept manageable. We

accept that most of the AI algorithms are inherently indeterminostie and under real world constraints (s.g. response time specification, memory limits) they can rarely produce optimal solution, but situation dependent, suboptimal one. Our aim was to create scheduling support, which gives significant help for putting algorithms of the mentioned characteristics into hard real-time execution environment.

3. THE MODEL

In real-time scheduling point of view solving a complex measuring problem means temporally specified execution of the cooperative elements of a run-time defined task set. This execution process can be characterized as follows:

Having completed the in~tialization phase, the real-time system consists of a given number of predefined tasks (parallel activities, processes), whose parameters (see later) are known. These tasks typically are periodic ones or sporadic ones modelled as periodic tasks with infinite lifetime. In the operation phase new tasks (periodic or sporadic) are created with partially defined timing characteristicsj resource requirements and precedence constraints. Their lifetime can be either finite or infinite.

As hardware background loosely coupled network of uniprocessors is assumed. (The processing elements of the network are referred as nodes.)

3.1. Parameters of the tasks and the execution requirements

Tasks generate their results as time goes by. Traditionally a task is characterized by its computation time, by which it can deliver the complete and precise results even in worst case situation. Unfortunately the estimation of the worst-case computation time of tasks realizing AI originated algorithms (e.g. graph search, pattern matching) are very pessimistic and far from the average. These are the worst-case numbers - and the measuring system has to cope with them -, however, the practical usefulness of the estimation is questionable. On the other hand, a certain set of AI based processing algorithms can deliver useful partial results before their total completion (e.g. a diagnostic process gives findings of increasing precision continuously during its operation). For formalizing these features, the so called output function is introduced. The output function (OUT(.)) gives the approximate degree of completness as a function of the used computation time of the task I . The output function satisfies the following properties:

I A similar description was introduced in [16], but their approach to the scheduling problem was completely different.

Scheduler architecture for knowledge based measuring systems 5

0 if t < 0 OUT(t) ffi E (0,I) if t 6 (0,C)

I if t ~ C

OUT(t) monotone increasing if t E (0,C)

where C is the computation time required for the total completion of the task.

In practice the task output . generation2 . i is) modelled by step or linear functlons (Fig. . .

The execution requirements for the tasks are

OUT(I:)

C

Fig. i.

determined by the activation parameters (task type: periodic or sporadic, and in the former case the period time (P)), and the deadline specification. Considering the deadline specification two types of tasks are distinguished. In case of hard real-time task, it has strict deadline and if a hard real-time task is accepted for execution (guaranteed), the scheduler assures keeping its deadline in any circumstances (except fatal (hardware) failure situations). A soft real-time task also has deadline specification, but if the task can

Acc(t) . . . . . . . .

D D'

Fig. 2.

not meet this specification, the system performance degradation is graceful. This degradation is described by the acceptability function, which gives a quantitative measure of degradation as a function of the task's completion time. Properties of the acceptability functions:

[ 1 if t s D ACC(t)

I E [0,i] if t > D

ACC(t) monotone decreasing if t > D

where D is the hard deadline

eases and there is no efficient heuristics, which could help solving it efficiently [17,18]. So, for practical reasons, we should restrict ourselves to special cases, which are general enough to cover our requirements drawn from the application field considered, but which are special (simplified) enough to keep the scheduling problem manageable.

The information processing scheme of a measuring system is usually merged with either the data-driven or the demand-driven (request-driven) control paradlEm. The data-driven and the demand-driven control can easily mapped into out-tree and in-tree precedence constraints respectively among the

Some typical instances of acceptability functions are shown in Fig. 2.

In our model periodic tasks are assumed as hard real-time tasks, and their deadlines are equal to the corresponding period times.

3.2. Precedence constraints

Usually the tasks generated in the operating phase of the measuring system are not independent of one another. The order of the execution of the tasks is constrained (i.e. partially determined) by precedence requirement derived from the current way of realization of the measuring procedures.

The existence of general precedence among tasks causes the scheduling problem turning into computionally intractable even in uniprocessor

2 For efficiency reasons integer valued OUT functions 0 ~ OUT(.) ~ i00

3 For efficiency reasons integer valued ACC functions 0 ~ ACC(.) ~ i00

tasks involved in the information processing. From now on tree-like precedence relations are assumed.

It should be mentioned that the pure application of these control paradigms - beyond the scope of trivial problems - usually causes combinatorie explosion. To avoid this, - besides the high level automatism - explicit ways, which can be considered as a description of higher level scheduling activity, have to be provided to express the problem specific control structure by restricting the spreading of activities to expectedly irrelevant directions.

3 . 3 . R e s o u r c e handl i~

In the current model resource contentions are not considered. This approximation is true if the tasks do not use common resources or the

have been implemented,

have been implemented,

6 Z Papp

time, during which tasks exclude each other, is short (i.e. negligible) relative to the tasks' computation time. In this case, even if using the pessimistically worst-ease delay on first-came-first-served basis (each of the tasks is excluded by all others for one resource access), the cost of the approximation is acceptable. If the resource contention is serious, introducing explicit resource handler tasks and explicitly handling these as any other tasks in the system can be a way to cope with this problem.

4. THE SCHEDIV~ER

4. I. Requirements

The goal of the scheduler is to realize the execution of the tasks satisfying the precedence constraints and providing balanced service for the tasks (measured by the OUT(.) and ACC(.) functions) in system-wide sense with high CPU utilization. As a consequence of the real-time operation model the scheduler must be on-line and able to operate under hard real-time conditions, thus the running time of the scheduler m~st have acceptable worst-case upper bound.

Considering the requirements for the previously defined scheduling task, optimal scheduler can not be designed , so we must confine ourselves to suboptimal solutions, which can be delivered by computionally tractable heuristic algorithms. For the sake of wide range and reliable applicability, the heuristic scheduler must be parametrically tuneable and robust. (This latter means that the scheduler must operate considerably well even if the current conditions of operation strongly differ from which the scheduler has been tuned for.- It means also a kind of "graceful degradation" now on the scheduler level.)

4 . 2 . An o v e r v i e w

The complete scheduling mechanism is composed of three well separated, cooperating subsohedulers, each of them operates on a certain concept level and is responsible for the system-wide success to a well defined extent. The structure of the scheduler is shown in Fig. 3.

On the lowest level (Level I) it contains a uniprocessor optimal scheduler [17] (in the current implementation a least-laxity-first (LLF) scheduler is used) and interface procedures (called by the subsequent level) for handling the Guaranteed Tasks Table (GTT), which contains all the task descriptors and their current scheduling parameters accepted for execution by this node. This level handles independent tasks with full specification (computation time, deadline or period time in periodic case). The algorithms used are .effective and free of any computionally

MEASURING SYSTEM SOFTWARE

-t, _ I REQUEST i

/ - ~ x I SPECIFICATION I

>~ %~ ~ ~"11AppIIOAT~ON I/

_ _ _ _ ; . . . . . . . . . . . .

TAsK PARAMETER

DN og

I ~ 'NTERFACEI I oo =E ,, ROUTINE

DIS

Fig. 3.

expensive structure, because its effectiveness is of primary importance in the single processor throughput point of view. The behaviour of this level is deterministic in the sense that if a task is guaranteed with a given set of timing parameters the scheduler keeps its deadline in any circumstances: this is the key for hard real-time applications.

Using the data-base access procedures of Level I, Level 2 realizes a higher level and typically suboptimal, but cost effective scheduling algorithm based on application independent heuristics. The description of the tasks to be scheduled is stored in the Request Descriptor. Tasks are characterized by the extended descriptors shown in the previous section. Using heuristic functions and algorithms governing the task selection and task specification translation, the heuristic scheduler - according to the current parameters of the heuristic algorithms attempts to maximize the system throughput by setting the proper deadlines and computional time for the individual tasks and/or sending and evaluating bids. This level is invoked by Level 3 on creatin$/aborting tasks or changing their real-time specification.

The uppermost level (Level 3) realizes the application dependent heuristics, i.e. controls

Scheduler architecture for knowledge based measuring systems 7

the task activation according to the general goals and constraints of the measuring problem to be solved and according to its implementation. This level is responsible for providing (sub)optimal throughput on measuring system level. Level 3 can (and usually does) contain KB subsystem for controlling long-term actions of the measuring systems.

4 . 3 . Algorithms

On Level I LLF scheduler is realized extending with "housekeeping" procedure, which can compute the surplus CPU power in any time interval. This can be done by O(N) algorithm (N is the number of tasks scheduled) [19] and this information is used by the guarantee routine (Fig. 4.). It should be mentioned that the running time of the guarantee routine is sensitive to the relative length of the period times of tasks.

algorithm guarantee(task); if task.type - SPORADIC

then ( s :- surplus(current time,task.deadline); if s a task.comput time

then return(OK) else return(REJECT)

} else ( /* i.e. PERIODIC */

w :- max(w, lcm(periods of tasks)); for all task.period interval in w do {

s :- surplus(begln_interval, end_interval);

if s < task.comput_time then return(REJECT)

); r e tu rn (OK)

Fig. 4.

It can be shown, that the tree-like precedence constraints can easily be "compiled" to timing specification using the extended task description formalism. This compilation is done by the Task Specification routine, which interfaces Level 2 and 3. The task and execution specifications are stored in the Request Descriptor and serve as input for the heuristic scheduler. The outline of the heuristic scheduling algorithm applied on Level 2 is shown in Fig. 5. The function calls in italic letters indicate the application of heuristics, if there is any. The function candidate_from_RQ_descriptor chooses the best candidate from the request descriptor. In the easiest cases the function can realize simple first-come-first-served type servicing, but can be combined with priority schemes, measures of resource utilization, ere [20]. The new_alternative function determines which way is to be chosen to cope with guaranteeing the task if the task can not be accepted in a direct way (i.e. the CPU surplus is not enough). The options are:

algorithm heuristic_scheduling on Level2; { new task :- candidate from RQ descriptor; if guarantee(new_task) = OK then return(OK STR) /* straight way */ else { /* heuristic scheduling */ ini ~al ternatives ; while (next_step :~ new_al~ernative)

NOMORE do ( switch next step case PROLONG: { if CACC ~ min_ACO then { CACC :- dec(CACC) ; for all scheduled tasks do { if task.type - SOFT then {

D' :- AGC~,~(CACC); modify(task, DEADLINE, D' ) );

); new_task, deadline :~ ACC "In,W_~a ('CACC),K ;

if guarantee(new task) then return(OK_DLMOD) else continue ; )

else continue ; ) /* PROLONG */ case ABORT:{ if COUT ~ min OUT then { COUT :- dec(~0UT) ; new_task, comput _time : - OUT -In,. _ ~, !COUT ) ;

for all scheduled tasks do { if task.deadline ~ new_task_deadline A

t a sk . CPUtime_uaed ~ ACG~I k(CAGC)

then remove(task) ; if guarantee(new_task) then re turn ( OK COMPMOD ) }

else continue ) /* ABORT */ case BID RQ: { send bid request(newtask); return(BID_RQ)

}; /* BID */ ); /* end while */ return(REJECT) ) /* end else */

) /* end algorithm */

Fig. 5.

- prolonging the soft deadlines (by decreasing the current acceptability level),

- aborting partially finished tasks (above a certain output level, GOUT), or

- sending bid requests to other nodes.

It can be proved, that satisfying straightforward constraints among the task execution specifications none of these options modifies the existing precedence relations among the tasks.

The Current State table is updated according to the result of the heuristic scheduler. The

8 Z Papp

operation condition of Level 2 is determined by the parameters of the heuristic algorithms stored in the Scheduling Parameters table. (This table contains the period time for invoking the scheduler, the weighting coefficients for combined heuristics, current limits of CACC and COUT, etc.). These parameter values are set by the uppermost level, the application dependent scheduler. In this way the heuristic scheduler on Level 2 can be kept near the optimal working condition in system-wide sense.

The Level 3 scheduler is completely application dependent, thus out of the scope of the paper.

5. CONCLUSIONS, FURTHER KESEARCH

Extending the capabilities of computerized measuring systems from mere data processing toward intelligent behaviour claims intensive application of knowledge based and other AI originated algorithms. The special run-tlme characteristics of these algorithms induce several theoretical and implementational problems when embedding them into real-tlme environment.

The paper presents a scheduler architecture, which provides a framework for integrating AI originated and traditional data processing algorithms under real-time operating conditions. For keeping the scheduling task computionally tractable, the scheduler extensively uses heuristic approach in task selection and in finding the way for satisfying the execution specifications. The characteristics of the scheduler proposed are:

- the scheduler gives a unified background for description and execution of hard and ~oft real-time tasks,

- the scheduler provides easy way for modifying and tuning the heuristics applied,

- in the three-level architecture, each level has its own well defined function and responsibility, and provides a declarative programming interface for the level above,

- the uppermost level can easily include even KB system components (e.g. expert system, planner) for sophisticated system-wide scheduling.

Currently the behaviour of scheduling algorithms as a function of the applied heuristics is being studied by means of computer simulation and in testbed set-up. The distributed handling of tree-like precedence constraints and extending the real-time operation model by the costs of intertask communications are investigated.

REFERENCES

[I] J. Sztip&novits, J. Bourne: Design of

Intelligent Instr. Proc. of the let IEEE Conf. on AI Appl., 198A, Denver, USA

[2] K. Ramamritham, J.Stankovic: Dynamic Task Scheduling in Hard Real-Time Distributed Systems. IEEE Software, July 1984.

[3] R. G. Smith: The Contract Net Protocol: High-Level Communication and Control in a Distributed Problem Solver. IEEE Tr. C-29 No 12. (1980)

[4] Z. Papp et al: Expert System Architecture for Real-Time Process Supervisor Applications. In G.Rzevski (ed.): AI in Manufacturing. Springer Verlag 1989.

[5] N. Wirth: Toward a Discipline of Real-Time Programming. Comm.ACM, Vol 20,No 8, (1977)

[6] J. Stankovic: Decentralized Decision Making for Task Reallocation in a Hard R-T System. IEEE Tr. C-38, No 3, (1989)

[7] B. Liskov: Distributed Programming in ARGUS. Comm. ACM, Vol 31, No 3, (1988)

[8] Z. Papp: Programming Tool for Integrating Numerical and KB Signal Processing Techniques. Int'l IMEKO Symp. on KB Measurement,1990, Karlsruhe,FRO (in print)

[9] M. Ghallab, H. Philippe: A Compiler for R-T KB Systems. Proc. of the IEEE Int'l Workshop on AI for Industrial Appl, Hitachi City, Japan, 1988.

[i0] S. Tano et al: Eureka II: A Programming Tool for KB R-T Control Systems. Proc. of the IEEE Int'l Workshop on AI for Industrial Appl, Hitachi City, Japan, 1988.

[ii] A.Cruise et al: YES/L1: Integrating Rule- Based, Procedural and R-T Programming for Industrial Applications. Proc. of the 4th IEEE Conf. on AI Appl. 1987.

[12] P. A. Sachs et al: Escort - An expert System for Complex Operations in Real- Time. Expert Systems, Vol 3, No i, (1986)

[13] M.L. Wright et al: An Expert System for Real-Time control. IEEE Software, March 1986.

[14] J. D. Yang et al: An Architecture for Control and Communications in Distributed Artificial Intelligence Systems. IEEE Tr. SMC-15, No 3, (1985)

[15] B. G. Silverman et al: Blackboard System Generator (BSG): An Alternative Distributed Problem-Solving Paradigm. IEEE SMC-19, No 2, (1989)

[16] R. Cobelli et al: Real Time Scheduling Algorithms and Their Performances. Microproc. and Microprog., Vol 28, 1989.

[17] M.J. Dertouzos, A.K. Mok: Multiprocessor On-Line Scheduling of Hard-Real-Time Tasks. IEEE Tr. SE-15, No 12, (1989)

[18] J. Xu, D.L. Parnas: Scheduling Processes with Release Times, Deadlines, Precedence, and Exclusion Relations. IEEE Tr. SE-16, No 3, (1990)

[19] H. Chetto, M. Chetto: Some Results of the Earliest Deadline Scheduling Algorithm. IEEE Tr. Vol St-15, No i0, (1989)

[20] W. Zhao et al: Scheduling Tasks with Resource Requirements in Hard Real-Time Systems. IEEE Tr. SE-13, No 5, (1987)