15 Pages

ECI1976

Course: MJ 665, Fall 2009
School: East Los Angeles College
Rating:
 
 
 
 
 

Word Count: 7848

Document Preview

of Proceedings the 1st Conference of the European Cooperation in Informatics, Amsterdam August 9-12, 1976, pages 236-262; Lecture Notes in Computer Science 44, K Samelson ed, Springer, 1976. CONSTRUCTIVE METHODS OF PROGRAM DESIGN M. A. Jackson Michael Jackson Systems Limited 101 Hamilton Terrace, London NW8 Abstract Correct programs cannot be obtained by attempts to test or to prove incorrect programs: the...

Register Now

Unformatted Document Excerpt

Coursehero >> California >> East Los Angeles College >> MJ 665

Course Hero has millions of student submitted documents similar to the one
below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.

Course Hero has millions of student submitted documents similar to the one below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.
of Proceedings the 1st Conference of the European Cooperation in Informatics, Amsterdam August 9-12, 1976, pages 236-262; Lecture Notes in Computer Science 44, K Samelson ed, Springer, 1976. CONSTRUCTIVE METHODS OF PROGRAM DESIGN M. A. Jackson Michael Jackson Systems Limited 101 Hamilton Terrace, London NW8 Abstract Correct programs cannot be obtained by attempts to test or to prove incorrect programs: the correctness of a program should be assured by the design procedure used to build it. A suggestion for such a design procedure is presented and discussed. The procedure has been developed for use in data processing, and can be effectively taught to most practising programmers. It is based on correspondence between data and program structures, leading to a decomposition of the program into distinct processes. The model of a process is very simple, permitting use of simple techniques of communication, activation and suspension. Some wider implications and future possibilities are also mentioned. 1. Introduction In this paper I would like to present and discuss what I believe to be a more constructive method of program design. The phrase itself is important; I am sure that no-one here will object if I use a LIFO discipline in briefly elucidating its intended meaning. `Design' is primarily concerned with structure; the designer must say what parts there are to be and how they are to be arranged. The crucial importance of modular programming and structured programming (even in their narrowest and crudest manifestations) is that they provide some definition of what parts are permissible: a module is a separately compiled, parameterised subroutine; a structure component is a sequence, an iteration or a selection. With such definitions, inadequate though they may be, we can at least begin to think about design: what modules should make up that program, and how should they be arranged? should this program be an iteration of selections or a sequence of iterations? Without such definitions, design is meaningless. At the top level of a problem there are PN possible designs, where P is the number of distinct types of permissible part and N is the number of parts needed to make up the whole. So, to preserve our sanity, both P and N must be small: modular programming, using tree or hierarchical structures, offers small values of N; structured programming offers, additionally, small values of P. `Program' or, rather, `programming' I would use in a narrow sense. Modelling the problem is `analysis'; `programming' is putting the model on a computer. Thus, for example, if we are asked to find a prime number in the range 1050 to 1060, we need a number theorist for the analysis; if we are asked to program discounted cash flow, the analysis calls for a financial expert. One of the major ills in data processing stems from uncertainty about this distinction. In mathematical circles the distinction is often ignored altogether, to the detriment, I believe, of our understanding of programming. Programming is about computer programs, not about number theory, or financial planning, or production control. `Method' is defined in the Shorter OED as a `procedure for attaining an object'. The crucial word here is `procedure'. The ultimate method, and the ultimate is doubtless unattainable, is a procedure embodying a precise and correct algorithm. To follow the method we need only execute the algorithm faithfully, and we will be led infallibly to the desired result. To the extent that a putative method falls short of this ideal it is less of a method. To be `constructive', a method must itself be decomposed into distinct steps, and correct execution of each step must assure correct execution of the whole method and thus the correctness of its product. The key requirement here is that the correctness of the execution of -a step should be largely verifiable without reference to steps not yet executed by the designer. This is the central difficulty in stepwise refinement: we can judge the correctness of a refinement step only by reference to what is yet to come, and hence only by exercising a degree of foresight to which few people can lay claim. Finally, we must recognise that design methods today are intended for use by human beings: in spite of what was said above about constructive methods, we need, now and for some time to come, a substantial ingredient of intuition and subjectivity. so what is presented below does not claim to be fully constructive merely to be `more constructive'. The reader must supply the other half of the comparison for himself, measuring the claim against the yardstick of his own favoured methods. 2. Basis of the Method The basis of the method is described, in some detail, in (1). It is appropriate here only to illustrate it by a family of simple example problems. Example 1 A cardfile of punched cards is sorted into ascending sequence of values of a key which appears in each card. Within this sequence, the first card for each group of cards with a common key value is a header card, while the others are detail cards. Each detail card carries an integer amount. It is required to produce a report showing the totals of amount for all keys. Solution 1 The first step in applying the method is to describe the structure of the data. We use a graphic notation to represent the structures as trees:- The above representations are equivalent to the following (in BNF with iteration instead of recursion): <cardfile> ::= <group>* <group> ::= <header><groupbody> <groupbody> ::= <detail>* <report> ::= <title><reportbody> <reportbody> ::= <totalline>* The second step is to compose these data structures into a program structure:- This structure has the following properties: It is related quite formally to each of the data structures. We may recover any one data structure from the program structure by first marking the leaves corresponding to leaves of the data structure, and then marking all nodes lying in a path from a marked node to the root. The correspondences (cardfile report) and (group totalline) are determined by the problem statement. One report is derivable from one cardfile; one totalline is derivable from one group, and the totallines are in the same order as the groups. The structure is vacuous, in the sense that it contains no executable statements: it is a program which does nothing; it is a tree without real leaves. The third step in applying the method is to list the executable operations required and to allocate each to its right place in the program structure. The operations are elementary executable statements of the programming language, possibly after enhancement of the language by a bout of bottom-up design; they are enumerated, essentially, by working back from output to input along the obvious data-flow paths. Assuming a reasonably conventional machine and a line printer (rather than a character printer), we may obtain the list: 1. 2. 3. 4. 5. 6. 7. 8. write title write totalline (groupkey, total) total := total + detail.amount total := 0 groupkey := header.key open cardfile read cardfile close cardfile Note that every operation, or almost every operation, must have operands which are data objects. Allocation to a program structure is therefore a trivial task if the program structure is correctly based on the data structures. This triviality is a vital criterion of the success of the first two steps. The resulting program, in an obvious notation, is: CARDFILE-REPORT sequence open cardfile; read cardfile; write title; REPORT-BODY iteration until cardfile.eof total := 0; groupkey := header.key; read cardfile; GROUP-BODY iteration until cardfile.eof or detail.key /= groupkey total := total + detail.amount; read cardfile; GROUP-BODY end write totalline (groupkey, total); REPORT-BODY end close cardfile; CARDFILE-REPORT end Clearly, this program may be transcribed without difficulty into any procedural programming language. Comment The solution has proceeded in three steps: first, we defined the data structures; second, we formed them into a program structure; third, we listed and allocated the executable operations. At each step we have criteria for the correctness of the step itself and an implicit check on the correctness of the steps already taken. For example, if at the first step we had wrongly described the structure of cardfile as:- (that is: <cardfile> ::= <card>* <card> ::= <header>|<detail> ) we should have been able to see at the first step that we had failed to represent everything we knew about the cardfile. If nonetheless we had persisted in error, we would have discovered it at the second step, when we would have been unable to form a program structure in the absence of a cardfile component corresponding to totalline in report. The design has throughout concentrated on what we may think of as a static rather than a dynamic view of the problem: on maps, not on itineraries, on structures, not on logic flow. The logic flow of the finished program is a by-product of the data structures and the correct allocation of the `read' operation. There is an obvious connection between what we have done and the design of a very simple syntax analysis phase in a compiler: the grammar of the input file determines the structure of the program which parses it. We may observe that the `true' grammar of the cardfile is not context-free: within one group, the header and detail cards must all carry the same key value. It is because the explicit grammar cannot show this that we are forced to introduce the variable groupkey to deal with this stipulation. Note that there is no error-checking. If we wish to check for errors in the input we must elaborate the structure of the input file to accommodate those errors explicitly. By defining a structure for an input file we define the domain of the program: if we wish to extend the domain, we must extend the input file structure accordingly. In a practical data processing system, we would always define the structure of primary input (such as decks of cards, keyboard messages, etc) to encompass all physically possible files: it would be absurd to construct a program whose operation is unspecified (and therefore, in principle, unpredictable) in the event of a card deck being dropped or a wrong key depressed. Example 2 The cardfile of example 1 is modified so that each card contains a cardtype indicator with possible values `header', `detail' and other. The program should take account of possible errors in the composition of a group: there may be no header card and/or there may be cards other than detail cards in the group body. Groups containing errors should be listed on an errorlist, but not totalled. Solution 2 The structure of the report remains unchanged. The structure of the errorlist and of the new version of the cardfile are:- The structure of cardfile demands attention. Firstly, it is ambiguous: anything which is a goodgroup is also an errorgroup. We are forced into this ambiguity because it would be intolerably difficult and quite unnecessary to spell out all of the ways in which a group may be in error. The ambiguity is simply resolved by the conventions we use: the parts of a selection are considered to be ordered, and the first applicable part encountered in a left-to-right scan is chosen. So a group can be parsed as an errorgroup only if it has already been rejected as a goodgroup. Secondly, a goodgroup cannot be recognised by a left-to-right parse of the input file with any predetermined degree of lookahead. If we choose to read ahead R records, we may yet encounter a group containing an error only in the R+1'th card. Recognition problems of this kind occur in many guises. Their essence is that we are forced to a choice during program execution at a time when we lack the evidence on which the choice must be based. Note that the difficulty is not structural but is confined to achieving a workable flow of control. We will call such problems 'backtracking' problems, and tackle them in three stages: (a) Ignore the recognition difficulty, imagining that a friendly demon will tell us infallibly which choice to make. In the present problem, he will tell us whether a group is a goodgroup or an errorgroup. Complete the design procedure in this blissful state of confidence, producing the full program text. (b) Replace our belief in the demon's infallibility by a sceptical determination to verify each `landmark' in the data which might prove him wrong. Whenever he is proved wrong we will execute a `quit' statement which branches to the second part of the selection. These `quit' statements are introduced into the program text created in stage (a). (c) Modify the program text resulting from stage (b) to ensure that side-effects are repealed where necessary. The result of stage (a), in accordance with the design procedure used for example 1, is: CFILE-REPT-ERR sequence open cardfile; read cardfile; write title; REPORT-BODY iteration until cardfile.eof groupkey := card.key; GROUP-OUTG select goodgroup total := O; read cardfile; GOOD-GROUP iteration until cardfile.eof or detail.key groupkey total := total + detail.amount; read cardfile; GOOD-GROUP end write totalline (qroupkey, total); GROUP-OUTG or errorgroup ERROR-GROUP iteration until cardfile.eof or card.key groupkey write errorline (card); read cardfile; ERROR-GROUP end GROUP-OUTG end REPORT-BODY end close cardfile; CFILE-REPT-ERR end Note that we cannot completely transcribe this program into any programming language, because we cannot code an evaluable expression for the predicate goodgroup. However, we can readily verify the correctness of the program (assuming the infallibility of the demon). Indeed, if we are prepared to exert ourselves to punch an identifying character into the header card of each goodgroup thus acting as our own demon we can code and run the program as an informal demonstration of its acceptability. We are now ready to proceed to stage (b,) in which we insert `quit' statements into the first part of the selection GROUP-OUTG. Also, since quit statements are not present in a normal selection, we will replace the words `select' and `or' by `posit' and `admit' respectively, thus indicating the tentative nature of the initial choice. Clearly, the landmarks to be checked are the card-type indicators in the header and detail cards. We thus obtain the following program: CFILE-REPT-ERR sequence open cardfile; read cardfile; write title; REPORT-BODY iteration until cardfile.eof groupkey := card.key; GROUP-OUTG posit goodgroup total := 0; quit GROUP-OUTG if card.type header; read cardfile; GOOD-GROUP iteration until cardfile.eof or card.key groupkey quit GROUP-OUTG if card.type detail; total := total + detail.amount; read cardfile; GOOD-GROUP end write totalline (groupkey, total); GROUP-OUTG admit errorgroup ERROR-GROUP iteration until cardfile.eof or card.key groupkey; write errorline (card); read cardfile; ERROR-GROUP end GROUP-OUTG end REPORT-BODY end close cardfile; CFILE-KEPT-ERR end The third stage, stage (c), deals with the side-effects of partial execution of the first part of the selection. In this trivial example, the only significant side-effect is the reading of cardfile. In general, it will be found that the only troublesome side-effects are the reading and writing of serial files; the best and easiest way to handle them is to equip ourselves with input and output procedures capable of `noting' and `restoring' the state of the file and its associated buffers. Given the availability of such procedures, stage (c) can be completed by inserting a `note' statement immediately following the `posit' statement and a `restore' statement immediately following the `admit'. Sometimes side-effects will demand a more ad hoc treatment: when `note' and `restore' are unavailable there is no alternative to such cumbersome expedients as explicitly storing each record on disk or in main storage. Comment By breaking our treatment of the backtracking difficulty into three distinct stages, we are able to isolate distinct aspects of the problem. In stage (a) we ignore the backtracking difficulty entirely, and concentrate our efforts on obtaining a correct solution to the reduced problem. This solution is carried through the three main design steps, producing a completely specific program text: we are able to satisfy ourselves of the correctness of that text before going on to modify it in the second and third stages. In the second stage we deal only with the recognition difficulty: the difficulty is one of logic flow, and we handle it, appropriately, by modifying the logic flow of the program with quit statements. Each quit statement says, in effect, `It is supposed (posited) that this is a goodgroup; but if, in fact, this card is not what it ought to be then this is not, after all, a goodgroup'. The required quit statements can be easily seen from the data structure definition, and their place is readily found in the program text because the program structure perfectly matches the data structure. The side-effects arise to be dealt with in stage (c) because of the quit statements inserted in stage (b): the quit statements are truly `go to' statements, producing discontinuities in the context of the computation and hence side-effects. The side-effects are readily identified from the program text resulting from stage (b). Note that it would be quite wrong to distort the data structures and the program structure in an attempt to avoid the dreaded four-letter word `goto'. The data structures shown, and hence the program structure, are self-evidently the correct structures for the problem as stated: they must not be abandoned because of difficulties with the logic flow. 3. Simple Programs and Complex Programs The design method, as described above, is severely constrained: it applies to a narrow class of serial fileprocessing programs. We may go further, and say that it defines such a class the class of `simple programs'. A `simple program' has the following attributes: The program has a fixed initial state; nothing is remembered from one execution to the next. Program inputs and outputs are serial files, which we may conveniently suppose to be held on magnetic tapes. There may be more than one input and more than one output file. Associated with the program is an explicit definition of the structure of each input and output file. These structures are tree structures, defined in the grammar used above. This grammar permits recursion in addition to the features shown above; it is not very different from a grammar of regular expressions. The input data structures define the domain of the program, the output data structures its range. Nothing is introduced into the program text which is not associated with the defined data structures. The data structures are compatible, in the sense that they can be combined into a program structure in the manner shown above. The program structure thus derived from the data structures is sufficient for a workable program. Elementary operations of the program language (possibly supplemented by more powerful or suitable operations resulting from bottom-up design) are allocated to components of the program structure without introducing any further `program logic'. A simple program may be designed and constructed with the minimum of difficulty, provided that we adhere rigorously to the design principles adumbrated here and eschew any temptation to pursue efficiency at the cost of distorting the structure. In fact, we should usually discount the benefits of efficiency, reminding ourselves of the mass of error-ridden programs which attest to its dangers. Evidently, not all programs are simple programs. Sometimes we are presented with the task of constructing a program which operates on direct-access rather than on serial files, or which processes a single record at each execution, starting from a varying internal state. As we shall see later, a simple program may be clothed in various disguises which give it a misleading appearance without affecting its underlying nature. More significantly, we may find that the design procedure suggested cannot be applied to the problem given because the data structures are not compatible: that is, we are unable at the second step of the design procedure to form the program structure from the data structures. Example 3 The input cardfile of example 1 is presented to the program in the form of a blocked file. Each block of this file contains a card count and a number of card images. Solution 3 The structure of blockedfile is: This structure does not, of course, show the arrangement of the cards in groups. It is impossible to show, in a single structure, both the arrangement in groups and the arrangement in blocks. But the structure of the report is still: We cannot fit together the structures of report and blockedfile to form a program structure; nor would we be in better case if we were to ignore the arrangement in blocks. The essence of our difficulty is this: the program must contain operations to be executed once per block, and these must be allocated to a `process block' component; it must also contain operations to be executed once per group, and these must be allocated to a `process group' component; but it is impossible to form a single program structure containing both a `process block' and a `process group' component. We will call this difficulty a `structure clash'. The solution to the structure clash in the present example is obvious: more so because of the order in which the examples have been taken and because everyone knows about blocking and deblocking. But the solution can be derived more formally from the data structures. The clash is of a type we will call `boundary clash': the boundaries of the blocks are not synchronised with the boundaries of the groups. The standard solution for a structure clash is to abandon the attempt to form a single program structure and instead decompose the problem into two or more simple programs. For a boundary clash the required decomposition is always of the form: The intermediate file, file X, must be composed of records each is a cardimage, because cardimage is the highest common structures blockedfile and cardfile. The program PB is the program produced as a solution to example 1; the program PA is: PA sequence open blockedfile; open fileX; read blockedfile; PABODY iteration until blockedfile.eof cardpointer := 1; PBLOCK iteration until cardpointer > block.cardcount write cardimage (cardpointer); cardpointer := cardpointer + 1; PBLOCK end read blockedfile; PABODY end close fileX; close blockedfile; PA end The program PB sees file X as having the structure of cardfile in example 1, while program PA sees its structure as: The decomposition into two simple programs achieves a perfect solution. Only the program PA is cognisant of the arrangement of cardimages in blocks; only the program PB of their arrangement in groups. The tape containing file X acts as a cordon sanitaire between the two, ensuring that no undesired interactions can occur: we need not concern ourselves at all with such questions as `what if the header record of a group is the first cardimage in a block with only one cardimage?', or `what if a group has no detail records and its header is the last cardimage in a block?'; in this respect our design is known to be correct. There is an obvious inefficiency in our solution. By introducing the intermediate magnetic tape file we have, to a first approximation, doubled the elapsed time for program execution and increased the program's demand for backing store devices. Example 4 The input cardfile of example 1 is incompletely sorted. The cards are partially ordered so that the header card of each group precedes any detail cards of that group, but no other ordering is imposed. The report has no title, and the totals may be produced in any order. Solution 4 The best we can do for the structure of cardfile is: which is clearly incompatible with the structure of the report, since there is no component of cardfile corresponding to totalline in the report. Once again we have a structure clash, but this time of a different The type. cardfile consists of a number of groupfiles, each one of which has the form: The cardfile is an arbitrary interleaving of these groupfiles. To resolve the clash (an `interleaving clash') we must resolve cardfile into its constituent groupfiles: Allowing, for purposes of exposition, that a single report may be produced by the n programs PG1, ... PGn (each contributing one totalline), we have decomposed the problem into n+1 simple programs; of these, n are identical programs processing the n distinct groupfiles groupfilel, ... groupfilen; while the other, PC, resolves cardfile into its constituents. Two possible versions of PC are: PC1 sequence open cardfile; read cardfile; open all possible groupfiles; PC1BODY iteration until cardfile.eof write record to groupfile (record.key); read cardfile; PC1BODY end close all possible groupfiles; close cardfile; PC1 end and PC2 sequence open cardfile; read cardfile; PC2BODY iteration until cardfile.eof REC-INIT select new groupfile open groupfile (record.key); REC-INIT end write record to groupfile (record.key); read cardfile; PC2BODY end close all opened groupfiles; close cardfile; PC2 end Both PCI and PC2 present difficulties. In PCI we must provide a groupfile for every possible key value, whether or not cardfile contains records for that key. Also, the programs PG1, ... PGn must be elaborated to handle the null groupfile: In PC2 we must provide a means of determining whether a groupfile already exists for a given key value. Note that it would be quite wrong to base the determination on the fact that a header must be the first record for a group: such a solution takes impermissible advantage of the structure of groupfile which, in principle, is unknown in the program PC; we would then have to make a drastic change to PC if, for example, the header card were made optional: Further, in PC2 we must be able to run through all the actual key values in order to close all the groupfiles actually opened. This would still be necessary even if each group had a recognisable trailer record, for reasons similar to those given above concerning the header records. Comment The inefficiency of our solution to example 4 far outstrips the inefficiency of our solution to example 3. Indeed, our solution to example 4 is entirely impractical. Practical implementation of the designs will be considered below in the next section. For the moment, we may observe that the use of magnetic tapes for communication between simple programs enforces a very healthy discipline. We are led to use a very simple protocol: every serial file must be opened and closed. The physical medium encourages a complete decoupling of the programs: it is easy to imagine one program being run today, the tapes held overnight in a library, and a subsequent program being run tomorrow; the whole of the communication is visible in the defined structure of the files. Finally, we are strengthened in our resolve to think in terms of static structures, avoiding the notoriously error-prone activity of thinking about dynamic flow and execution-time events. Taking a more global view of the design procedure, we may say that the simple program is a satisfactory high level component. It is a larger object than a sequence, iteration or selection; it has a more precise definition than a module; it is subject to restrictions which reveal to us clearly when we are trying to make a single program out of what should be two or more. 4. Programs, Procedures and Processes Although from the design point of view we regard magnetic tapes as the canonical medium of communication between simple programs, they will not usually provide a practical implementation. An obvious possibility for implementation in some environments is to replace each magnetic tape by a limited number of buffers in main storage, with a suitable regime for ensuring that the consumer program does not run ahead of the producer. Each simple program can then be treated as a distinct task or process, using whatever facilities are provided for the management of multiple concurrent tasks. However, something more like coroutines seems more attractive (2). The standard procedure call mechanism offers a simple implementation of great flexibility and power. Consider the program PA, in our solution to example 3, which writes the intermediate file X. We can readily convert this program into a procedure PAX which has the characteristics of an input procedure for file X. That is, invocations of the procedure PAX will satisfactorily implement the operations `open file X for reading', `read file X' and `close file X after reading'. We will call this conversion of PA into PAX `inversion of PA with respect to file X'. (Note that the situation in solution 3 is symmetrical: we could equally well decide to invert PB with respect to file X, obtaining an output procedure for file X.) The mechanics of inversion are a mere matter of generating the appropriate object coding from the text of the simple program: there is no need for any modification to that text. PA and PAX are the same program, not two different programs. Most practising programmers seem to be unaware of this identity of PA and PAX, and even those who are familiar with coroutines often program as if they supposed that PA and PAX were distinct things. This is partly due to the baleful influence of the stack as a storage allocation device: we cannot jump out of an inner block of PAX, return to the invoking procedure, and subsequently resume where we left off when we are next invoked. So we must either modify our compiler or modify our coding style, adopting the use of labels and go to statements as a standard in place of the now conventional compound statement of structured programming. It is common to find PAX, or an analogous program, designed as a selection or case statement: the mistake is on all fours with that of the kindergarten child who has been led to believe that the question `what is 5 multiplied by 3?' is quite different from the question `what is 3 multiplied by 5?'. At a stroke the poor child has doubled the difficulty of learning the multiplication tables. The procedure PAX is, of course, a variable state procedure. The value of its state is held in a `state vector' (or activation record), of which a vital part is the text pointer; the values of special significance are those associated with the suspension of PAX for operations on file X open, write and close. The state vector is an `own variable' par excellence, and should be clearly seen as such. The minimum interface needed between PB and PAX is two parameters: a record of file X, and an additional bit to indicate whether the record is or is not the eof marker. This minimum interface suffices for example 3: there is no need for PB to pass an operation code to PAX (open read or close). It is important to understand that this minimum interface will not suffice for the general case. It is sufficient for example 3 only because the operation code is implicit in the ordering of operations. From the Point of view of PAX, the first invocation must be `open', and subsequent invocations must be `read' until PAX has returned the eof marker to PB, after which the final invocation must be `close'. This felicitous harmony is destroyed if, for example, PB is permitted to stop reading and close file X before reaching the eof marker. In such a case the interface must be elaborated with an operation code. Worse, the sequence of values of this operation code now constitutes a file in its own right; the solution becomes: The design of PA is, potentially, considerably more complicated. The benefit we will obtain from treating this complication conscientiously is well worth the price: by making explicit the structure of the opcode file we define the problem exactly and simplify its solution. Failure to recognise the existence of the opcode file, or, just as culpable, failure to make its structure explicit, lies at the root of the errors and obscurities for which manufacturers' input-output software is deservedly infamous. In solution 4 we created an intolerable multiplicity of files groupfilel, ... groupfilen. We can rid ourselves of these by inverting the programs PG1, ... PGn with respect to their respective groupfiles: that is, we convert each of the programs PGi to an output procedure PGFi, which can be invoked by PC to execute operations on groupfilei. But we still have an intolerable multiplicity of output procedures, so a further step is required. The procedures are identical except for their names and the current values of their state vectors. So we separate out the pure procedure part PGF of which we need keep only one copy, and the named state vectors SVPGFI, ... SVPGFn. We must now provide a mechanism for storing and retrieving these state vectors and for associating the appropriate state vector with each invocation of PGF; many mechanisms are possible, from a fully-fledged direct-access file with serial read facilities to a simple arrangement of the state vectors in an array in main storage. 5. Design and Implementation The model of a simple program and the decomposition of a problem into simple programs provides some unity of viewpoint. In particular, we may be able to see what is common to programs with widely different implementations. Some illustrations follow. (d) A conversational program is a simple program of the form: The user provides a serial input file of messages, ordered in time; the conversation program produces a serial file of responses. Inversion of the program with respect to the user input file gives an output procedure `dispose of one message in a conversation'. The state vector of the inverted program must be preserved for the duration of the conversation: IBM's IMS provides the SPA (Scratchpad Area) for precisely this purpose. The conversation program must, of course, be designed and written as a single program: implementation restrictions may dictate segmentation of the object code. (e) A `sort-exit' allows the user of a generalised sorting program to introduce his own procedure at the point where each record is about to be written to the final output file. An interface is provided which permits `insertion' and `deletion' of records as well as `updating'. We should view the sort-exit procedure as a simple program: To fit it in with the sorting program we must invert it with respect to both the sorted file and the final output. The interface must provide an implementation of the basic operations: open sortedfile for reading; read sortedfile (distinguishing the eof marker); close sortedfile after reading; open finaloutput for writing; write finaloutput record; close finaloutput file after writing (including writing the eof marker). Such concepts as `insertion' and `deletion' of records are pointless: at best, they serve the cause of efficiency, traducing clarity; at worst, they create difficulty and confusion where none need exist. (f) Our solution to example 1 can be seen as an optimisation of the solution to the more general example 4. By sorting the cardfile we ensure that the groups do not overlap in time: the state vectors of the inverted programs PGF1, ... PGFn can therefore share a single area in main storage. The state vector consists only of the variable total; the variable groupkey is the name of the currently active group and hence of the current state vector. Because the records of a group are contiguous, the end of a group is recognisable at cardfile.eof or at the start of another group. The individual groupfile may therefore be closed, and the totalline written, at the earliest possible moment. We may, perhaps, generalise so far as to say that an identifier is stored by a program only in order to give a unique name to the state vector of some process. (g) A data processing system may be viewed as consisting of many simple programs, one for each independent entity in the real world model. By arranging the entities in sets we arrange the corresponding simple programs in equivalence classes. The `master record' corresponding to an entity is the state vector of the simple program modelling that entity. The serial files of the system are files of transactions ordered in time: some are primary transactions, communicating with the real world, some are secondary, passing between simple programs of the system. In general, the real world must be modelled as a network of entities or of entity sets; the data processing system is therefore a network of simple programs and transaction files. Implementation of the system demands decisions in two major areas. First a scheduling algorithm must be decided; second, the representation and handling of state vectors. The extreme cases of the first are `real-time' and `serial batch'. In a pure `real-time' system every primary transaction is dealt with as soon as it arrives, followed immediately by all of the secondary and consequent transactions, until the system as a whole becomes quiet. In a pure `serial batch' system, each class (identifier set) of primary transactions is accumulated for a period (usually a day, week or month). Each simple program of that class is then activated (if there is a transaction present for it), giving rise to secondary transactions of various classes. These are then treated similarly, and so on until no more transactions remain to be processed. Choosing a good implementation for a data processing system is difficult, because the network is usually large and many possible choices present themselves. This difficulty is compounded by the long-term nature of the simple programs: a typical entity, and hence a typical program, has a lifetime measured in years or even decades. During such a lifetime the system will inevitably undergo change: in effect, the programs are being rewritten while they are in course of execution. (h) An interrupt handler is a program which processes a serial file of interrupts, ordered in time: Inversion of the interrupt handler with respect to the interrupt file gives the required procedure `dispose of one interrupt'. In general, the interrupt file will be composed of interleaved files for individual processes, devices, etc. Implementation is further complicated by the special nature of the invocation mechanism, by the fact that the records of the interrupt file are distributed in main storage, special registers and other places, and by the essentially recursive structure of the main interrupt file (unless the interrupt handler is permitted to mask off secondary interrupts). (i) An input-output ...

Find millions of documents on Course Hero - Study Guides, Lecture Notes, Reference Materials, Practice Exams and more. Course Hero has millions of course specific materials providing students with the best way to expand their education.

Below is a small sample set of documents:

N.C. State - MEA - 100
MEA 100Introduction to Earth Systems: This is a stealth course in Environmental Science. We will emphasize a quantitative approach based on knowledge of both abiotic and biotic systems.courses.ncsu.edu/mea100/lec/001/Introduction to Earth System
Contra Costa College - COEN - 244
COEN244 Winter 2008 Section U by Dr. Aishy Amer 5 % (A 3, 4, &amp;5) 15 % (5/6) submitted and compiled: -1 25 % submitted and did not compile: -2 53 % did not write (DNW) or did not submit: 0 2 % Note: if you did better in the final, your mark of the mid
University of Iowa - CS - 185
CS 185: Type Preservation, Constraint Solving. Types. type := base | type typeType assignment rules. (x) = T t-var x:T t1 : T 2 T 1 t2 : T 2 t-app t1 t2 : T 1 , x : T1 t : T2 t-lam x.t : T1 T2 t : T.Type Preservation Theorem. If t : T a
University of Iowa - CS - 185
CS 185, Homework 1Denotational Semantics of IMP [100 points].Your solution to this assignment is due Sept. 16th, at the start ofclass. The start of class is defined as within the first 10 minutes,so please do not be late.Recall the course col
University of Iowa - CS - 185
&gt; I. Non-determinism and Concurrency [40 points]&gt; For each of the following commands, first state whether it is using&gt; guarded commands (Ch. 7), shared-variable concurrency (Ch. 8), or&gt; communication via channels (Ch. 9). Then show all possible t
University of Iowa - CS - 185
Programming in Lambda CalculusLambda calculus syntax is nice and compact, and has severaleasy-to-define operational semantics.But can you program in it?Yes, by encoding all data as lambda-abstractions.A piece of data is encoded as a function
University of Iowa - CS - 185
CS 185: Combinators and Substitution10/16/08Last time: Scott-encoded data, in particular, unary natural numbers.0 = \ s . \ z. z1 = \ s . \ z. (s 0)2 = \ s . \ z. (s 1).Scott-encoded booleans:tt = _ff = _and = \ b1 . \ b2. _No
University of Iowa - CS - 185
CS 185, Confluence of Lambda Calculus ContinuedAs we saw last time, our goal is to prove the diamondproperty for the weak multi-step reduction relation -w-&gt; defined inductively as follows:- refle -w-&gt; ee -w-&gt; e'- lambdalambda x. e -w-&gt; la
University of Iowa - CS - 185
CS 185, Homework 3Concurrency and Lambda Calculus [100 points].Your solution to this assignment is due Friday, Oct. 31st, at 3pm.Turn in your solution to my mailbox, in the CS mail room. --I. Non-determinism and Concurrency [40 points]For eac
University of Iowa - CS - 185
CS 185: Lecture Notes on Simple Types. Syntax. The syntax of simple types is given by type := base | type typewhere base is any non-empty set of base types (for example, int or char). We use T as a meta-variable for types. The intuition is that T1
University of Iowa - CS - 185
CS 185, Homework 4Lambda Calculus and Functional Programming [100 points, 30 extra credit].Your solution to this assignment is due Wednesday, Nov. 21, at 3pm.Turn in your solution to my mailbox, in the CS mail room. --I. Confluence [30 points]
Concordia Canada - LYRA - 11247
N.C. State - CS - 312
Farm Plan homework Due: Lab on Monday Nov 21 Yesterday (Nov 15) we reviewed the basics for developing a whole farm forage plan and we walked the old Beef Teaching Unit to evaluate pastures and observe the landscape. On Nov 21 we will use a computer p
University of Iowa - IBS - 593
Directed evolution of ampicillin-resistant activity from a functionally unrelated DNA fragment: A laboratory model of molecular evolutionTakato Yano and Hiroyuki Kagamiyama*Department of Biochemistry, Osaka Medical College, Takatsuki, Osaka 569-868
University of Iowa - ME - 159
THE UNIVERSITY OF IOWA Department of Mechanical &amp; Industrial Engineering Fracture Mechanics 58:159 Homework #1 Total Points: 20 Assigned: January 28, 2009 Due: February 09, 2009Problem 1: Consider a plate containing a circular hole of radius a, as
University of Texas - ASE - 366
N.C. State - OR - 706
Motivation, Intuition, Speculation, Theorizationy[]()()xboundary / interior points closed / open sets bounded / compact sets convex sets . . . continuous functions differentiable functions convex / concave functions Taylor Series . . .1
University of Iowa - TA - 016
1. Enter.2. Leave. 3. QuitInput your option: 1*Welcome to the parking lot!1. Enter.2. Leave. 3. QuitInput your option: 2*Good bye!1. Enter.2. Leave. 3. QuitInput your option: 1*Welcome to the parking lot!1. Enter.2. Leave. 3.
East Los Angeles College - COMS - 12200
Hardware/Software Interface : Part 3So far, we have ignored the topic of function calls. A function call can be split into two partsThe caller part is what makes the function call. The callee part is the actual function itself.To implement funct
Wilfrid Laurier - MATH - 249
Math 249 Lecture 08: Inverse Functions, One-to-one Functions. Objective: To learn the meaning of one-to-one functions and inverse functions, how to determine whether a function is one-to-one, and how to find inverse functions of one-to-one functions
Wilfrid Laurier - MATH - 249
Math 249 L05/L06 (Fall 2007) Worksheet 7 1. p.205 #27. 2. p.205 #29. 3. p.205 #32. 4. p.218 #44. 5. p.218 #32. 6. p.218 #34. 7. p.228 #38. 8. p.228 #50. 9. p.228 #52.November 5-9, 20071
Wilfrid Laurier - MATH - 249
Math 249 Lecture 27: Logarithmic Dierentiation Objective: To learn the method of logarithmic dierentiation. Concepts: To nd the derivative of y = f (x)g(x) . f (x)g(x) = eln(f (x) Logarithmic Dierentiation Examples. 1. Find the derivative of the fo
Middlebury - ECON - 0340
November 8, 2005Bush, Meeting Panama's Leader, Endorses Widening of the CanalBy ELISABETH BUMILLERPANAMA, Nov. 7 - President Bush on Monday endorsed widening the Panama Canal and cited progress in reaching a free-trade agreement with Panama's pr
Wilfrid Laurier - PMAT - 445
PMAT 445 (Winter 2007) Midterm 2 1. Dene the following. (a) (10 marks) Interior pointMarch 14, 2007(b) (10 marks) Connected sets (If you use the term separated sets dene it too) (c) (10 marks) Directional derivative2. (30 marks) Prove this theo
Wilfrid Laurier - MATH - 403
MATH 403 (Winter 2007) Assignment 3Due: March 7, 20071. Use the - characterization of continuity to verify that the following functions are continuous at the given points. (a) (3 marks) f (x) = 3x - 7y, at point p = (4, 2) . (b) (5 marks) g (x)
University of Iowa - PSYCHOLOGY - 31174
University of Iowa - PSYCHOLOGY - 31174
LSA 33:144/Psych 31:174 Mind and Behavior: Natural Science and Cognition after Darwin Brief Essay 2 DUE: March 11 (Please provide two copies of this essay when you turn it in.)Write a 2 - 4 page essay addressing the following question:B.F. Skinne
University of Iowa - PSYCHOLOGY - 31241
AuditoryProcessingPhysical Dimension Amplitude Frequency ComplexityPerceptual Dimension Loudness Pitch TimbreW. W. NortonW. W. NortonW. W. NortonW. W. NortonMapping the Auditory System in Rhesus MonkeysTheUniversityofIowa Departmentof
Allan Hancock College - ELEC - 2041
Overview ELEC2041 Microprocessors and Interfacing Lectures 24: Compiler, Assembler, Linker and Loader I http:/webct.edtec.unsw.edu.au/ Compiler Assembler Linker Loader ExampleMay 2006 Saeid Nooshabadi saeid@unsw.edu.auELEC2041 lec24-linker-I
Allan Hancock College - ELEC - 2041
Overview ELEC2041 Microprocessors and Interfacing Lectures 25: Compiler, Assembler, Linker and Loader II http:/webct.edtec.unsw.edu.au/ Assembler Linker Loader ExampleMay 2006 Saeid NooshabadiELEC2041 lec25-linker.II.1saeid@unsw.edu.auSae
N.C. State - CS - 746
Crossing-Over and Recombination Updated 2/20/06 Required Readings: Fu, H. et al., 2002. Recombination rates between adjacent genic and retrotransposon regions in maize vary by 2 orders of magnitude. PNAS 99:1082-1087. Yao, H. et al. 2002. Molecular c
N.C. State - MA - 242
MA 242Fall, 1999Final Exam - SOLUTIONSL. K. Norris1. (15 pts) The position vector of a moving particle is given by r(t) = (t2 - 1)i + (t3 - t + 1) + t2 k (a) Find the velocity and acceleration vectors of the particle for t 0. 5 points SOLUTI
N.C. State - MA - 242
MA 242 Section 009Fall, 1999Test #1L. K. Norris(You must show your work to receive partial credit)1. (10 pts) Sketch the surfaces given by the following equations: (a) z + 9 = x2 + y 2 , (b) y 2 + 4z 2 = x2 + 9SOLUTION: The rst is an elli
N.C. State - MA - 401
A Summary of Various SL Problems L.K. Norris No. 1 2 3 4 SL Type Regular Regular Periodic Regular ODE y + y = 0 y + y = 0 y + y = 0 y + y = 0 Boundary Conditions y(0) = y() = 0 y (0) = y () = 0 y() = y() y () = y () y(0) = 0 y() + y () = 0 Eigenvalue
N.C. State - MA - 242
N.C. State - MA - 242
Middlebury - MATH - 0410
MATH 410 HOMEWORK #3 (due Wednesday, February 25)Spring 2009I. Look at our handout for the gambler's ruin probabilities. For p &lt; q, consider the chance of winning when you are 25, 10 or 5 units away from the goal N. Observe that these probabiliti
N.C. State - AEE - 526
The Joy of Using ExcelNCSU Agricultural &amp; Extension Education AEE 526Excel is a _ Program A. layout B. record keeping C. data base D. spreadsheet CORRECT ANSWER: spreadsheetNCSU Agricultural &amp; Extension Education AEE 526What is Excel
University of Iowa - M - 170
What Every Computer Scientist Should Know About Floating Point ArithmeticENote This document is an edited reprint of the paper What Every Computer Scientist Should Know About Floating-Point Arithmetic, by David Goldberg, published in the March,
University of Texas - PSY - 355
Attention What is attention? Low level attention Serial and parallel searchWhat is attention? How is the word used? Examples Something fluttering caught my attention I didnt see you, I was paying attention to the game. I struggled to pay at
University of Iowa - HEPSUN - 29140
Exam 2 Practice Material Physics 29:140 1. Do Problems 4.2 -4.4, 5.2-5.6, 10.7-10.8 in Squires 2. For fun look at Problem 10.6 in Squires. Here you will see that the spherical harmonics, Ylm 's are precisely the simultaneous eigenstates of L2 and Lz
University of Iowa - HEPSUN - 29105
1 Hobbie, Intermediate Physics for Medicine and Biology, 3rd. ed.ErrataLast modified: Apr. 19, 1999 Most of these corrections were found by students in my classes during the 1997-1998 academic year. I am particularly grateful to In-young Choi, who
University of Iowa - HEPSUN - 29140
HW 3, 29:140 Due Wednesday, 17 September, 2008 (10 points each problem.) 1. (Give yourself ample time for this one.) Consider again a classical point particle in a central potential given by: V (r) = krl , where k is a constant and l is an integer, r
University of Iowa - ECN - 56244
PROCEEDINGS of the HUMAN FACTORS AND ERGONOMICS SOCIETY 43rd ANNUAL MEETING - 199951THE USE OF PREDICTIVE DISPLAYS FOR AIDING CONTROLLER SITUATION AWARENESS Mica Endsley SA Technologies Randy Sollenberger &amp; Earl Stein Federal Aviation Administrat
University of Iowa - ECN - 56244
PROCEEDINGS of the HUMAN FACTORS AND ERGONOMICS SOCIETY 43rd ANNUAL MEETING - 19991FREE FLIGHT AND THE AIR TRAFFIC CONTROLLER: ACTIVE CONTROL VERSUS PASSIVE MONITORING Ulla Metzger and Raja Parasuraman Cognitive Science Laboratory The Catholic Un
University of Iowa - ECN - 56244
RotorcraftAirframe ComponentsSource: AC-8083Flight Controls Collective Throttle Correlator Governor Cyclic Anti torque pedalsSource: AC-8083 Piston Turbine Transmission MR, TRPowerplant Drive LineSource: AC-8083Rotor System
University of Iowa - ECN - 56244
56:244 Airborne Design of ExperimentsFall, 2007Flight Testing Flight testing Validate predictive models Very data driven Typically a component of aeronautical engineering A specialized and potentially dangerous technical activity Requires s
University of Iowa - ECN - 56244
Decision Making, Recipe for Disaster Big Decision catastrophes Space Shuttle Challenger Decision to launch in spite of suggestions that booster O-Rings not designed for cold temperatures USS Vincennes Engaged in a skirmish with enemy vessels, t
University of Iowa - ECN - 56244
Vision in Driving Complex topic Visual acuity Contrast sensitivity and threshold contrast Color perception Importance Information acquisition in driving almost exclusively visual Safety for the driver and for others Detecting changes in the
University of Iowa - ECN - 56244
Automated Highway SystemsFigure from Volpe AHS PageSome level of automation Hands/feet off Dual mode, normal and automated Improved safety Increased efficiency Predictable trip times Less pollution Less stress (?) Degree of automation Adapti
University of Iowa - ECN - 56244
Human Factors in the Air Transport System56:244 - Human Factors in Transportation Tom Schnell, 200056:244 Human Factors in Transportation1National Airspace System Aircraft and Crew Air Traffic Control Infrastructure Tom Schnell, 20005
University of Iowa - ECN - 56244
EVALUATIONOFTRAFFICFLOWANALYSIS TOOLSAPPLIEDTOWORKZONESBASEDON FLOWDATACOLLECTEDINTHEFIELD Jeff Mohror Jen Blackhurst 56:244 Human Factors in Transportation November 28,2000Literature ReviewFatalities in Work Zones High of 868 in 1999Fa tal iti
University of Iowa - PHIL - 56244
DRIVER VISIBILITY OF PAVEMENT MARKINGS AT NIGHTPhil Ohme Operator Performance Laboratory, Human Factors Department of Industrial Engineering University of IowaNighttime Visibility of Pavement Markings Light to observerReference axis Light from h
University of Iowa - ECN - 56244
AlternateVisionEnhancing SystemNightVisionSystemusedby Cadillac,Jaguar,DaimlerChryslerNightVisionfromCadillacsssCadillachavedevelopedanightvision systemconsistingofapassiveinfrared sensor,aheadupdisplay,anddisplay controls. Infraredtechnolo
University of Iowa - ECN - 56244
56:244 Human Factors in Transportation Midterm IPrepared by Jeffrey S. MohrorPrepared for Thomas Schnell, Ph.D. The University of Iowa Department of Industrial Engineering10/6/2000Mohror, Jeffrey S. Number of Subjects2The age old questio
University of Iowa - ECN - 56244
BASIC HUMAN FACTORS IN AVIATION RESEARCH PROPOSALPrepared For:Dr Tom SchnellbySohel Merchant BE, Center for Computer Aided Design The University of Iowa Iowa City, Iowa 52242-1527 And Julien Morizet Exchange Student The University of Iowa Iowa
University of Iowa - ECN - 56244
Mental Workload MeasuresHomework Paper for 56:244 Human Factors in TransportationStudent: Haixia Zhang Department of Industrial Engineering The University of Iowa September, 2003ii ABSTRACTThis is a review paper on mental workload assessment.
University of Iowa - ECN - 56244
Project Report Number: 1PROJECT REPORTControl Activation Speed and Accuracy Study Using Eye Tracking in a Flight SimulatorAuthors: Sohel Merchant, Julien MorizetNumber of Words: 6952 Number of Figures: 2 Number of Tables: 4 Total Words: 7305
University of Iowa - ECN - 56244
The Velvet CoatGroup C Entrepreneurial New Business FormationProject Membersl Fabiola Rodriguez l Brian Kennedy l Ryan Howell l Tuhin DiptimanBackgroundl The Velvet Coat is a one a kind store in Iowa City for womens apparel l It will sell clot
University of Iowa - ECN - 56244
THE DEVELOPMENT OF A NIGHTTIME DRIVER VISIBILITY MODEL FOR ULTRAVIOLET ACTIVATED PAVEMENT MARKINGSFuat Aktan OPL, 4221 SC Iowa City, IA, 522421Introduction Primary Purposes of Pavement MarkingsL n itu in l P v m n M rk g o g d a a e e t a in s