335 AN EXPERIMENTAL TIME-SHARING SYSTEM

Fernando J. Corbato, Marjorie Merwin-Daggett, Robert C. Daley Center, Massachusetts Institute of Technology Cambridge, Massachusetts

summary

It is the purpose of this paper to discuss The motivation for time-shared computer briefly the need for time-sharing, some of the usage arises out of the slow man-computer inter- implementation problems, an experimental time- action rate presently possible with the bigger, sharing system which has been developed for the more advanced . This rate has changed contemporary IBM 7090, and finally a scheduling little (and has become worse in some cases) in algorithm of one of us (FJC) that illustrates the last decade of widespread computer use. lO some of the techniques which may be employed to enhance and be analyzed for the performance In part, this effect has been due to the limits of such a time-sharing system. fact that as elementary problems become mast- ered on the computer, more complex problems immediately become of interest. As a result, Introduction larger and more complicated programs are written to take advantage of larger and faster computers. The last dozen years of computer usage have This process inevitably leads to more programm- seen great strides. In the early 1950's, the ing errors and a longer period of time required problems solved were largely in the construction for debugging. Using current batch monitor and maintenance of hardware; in the mid-1950's, techniques, as is done on most large computers, the usage languages were greatly improved with each program bug usually requires several hours the advent of compilers; now in the early 1960's, to eliminate, if not a complete day. The only we are in the midst of a third major modifi- alternative presently available is for the cation to computer usage: the improvement of programmer to attempt to debug directly at the man-machine interaction by a process called computer, a process which is grossly wasteful time-sharing. of computer time and hampered seriously by the poor console communication usually available. Much of the time-sharing philosophy, Even if a typewriter is the console, there are expressed in this paper, has been developed in usually lacking the sophisticated query and conjunction wi th the work of an MIT preliminary response programs which are vitally necessary study committee, chaired by H. Teager, which to allow effective interaction. Thus, what is examined the long range computational needs of desired is to drastically increase the rate of the Institute, and a subsequent MIT computer interaction between the programmer and the working committee, chaired by J. McCarthy. computer without large economic loss and also However, the views and conclusions expressed to make each interaction more meaningful by in this paper should be taken as solely those extensive and complex system programming to of the present authors. assist in the man-computer communication.

Before proceeding further, it is best to To solve these interaction problems we give a more precise interpretation to time- would like to have a computer made simultaneously sharing. One can mean using different parts of available to many users in a manner somewhat the hardware at the same time for different like a telephone exchange. Each user would be tasks, or one can mean several persons making able to use a console at his own pace and with- use of the computer at the same time. The first out concern for the activity of others using the ___ Tn,,' +; n('l' ; c:: Q'l:Tc+om meAning, VoL,",,"","'''' "'-...... '"" .... _- .... -l""' .. -b .. - .. • ... ·_ ..... b' -- -,J - -_ ...... This console could as a be oriented towards hardware efficiency in the merely a typewriter but more ideally would sense of attempting to §omplete utili- contain an incrementally modifiable self- zation of all components ' , J • The second sustaining display. In any case, data trans- meaning of time-sharing, which is meant here, mission requirements should be such that it would is primarily concerned with the efficiency of be no major obstacle to have remote installation persons trying to use a computerl ,2,3,4. from the computer proper. Computer efficiency should still be considered but only in the perspective of the total system utili ty. 336 AND CODING

The basic technique for a time-sharing system Implementation Problems is to have many persons simultaneously using the computer through typewriter consoles with a As indicated, a straightforward plan for time-sharing supervisor program sequentially time-sharing is to execute user programs for running each user program in a short burst or small quantums of computation without priority quantum of computation. This sequence, which in in a simple round-robin; the strategy of time- the most straightforward case is a simple round- sharing can be more complex as will be shown robin, should occur often enough so that each later, but the above simple scheme is an user program which is kept in the high-speed adequate solution. There are still many memory is run for a quantum at least once during problems, however, some best solved by hard- each approximate human reaction time ware, others affecting the programming conven- seconds). In this way, each user sees a computer tions and practices. A few of the more fully responsive to even single key strokes each obvious problems are summarized: of which may require only trivial computation; in the non-trivial cases, the user sees a Hardware Problems: gradual reduction of the response time which is proportional to the complexity of the response 1. Different user programs if simultan- calculation, the slowness of the computer, and eously in core memory may interfere with each the total number of active users. It should be other or the supervisor program so some form of clear, however, that if there are n users memory protection mode should be available when actively requesting service at one time: each operating user programs. user will only see on the average lin of the effective computer speed. During the period of 2. The time-sharing supervisor may need high interaction rates while debugging programs, at different times to run a particular program this should not be a hindrance since ordinarily from several locations. (Loading relocation the required amount of computation needed for bits are no help since the supervisor does not each debugging computer response is small know how to relocate the accumulator, etc.) compared to the ultimate production need. Dynamic relocation of all memory accesses that pick up instructions or-data words is one Not only would such a time-sharing system effective solution. improve the ability to program in the conventional manner by one or two orders of magnitude, but 3. Input-output equipment may be initiated there would be opened up several new forms of by a user and read words in on another user computer usage. There would be a gradual program. A way to avoid this is to trap all reformulation of many scientific and engineering input-output instructions issued by a user's applications so that programs containing decision program when operated in the memory protection trees which currently must be specified in mode. advance would be eliminated and instead the particular decision branches would be specified 4. A large random-access back-up storage only as needed. Another important area is that is desirable for general program storage files of teaching machines which, although frequently for all users. Present large capacity disc trivial computationally, could naturally units appear to be adequate. exploit the consoles of a time-sharing system with the additional bonus that more elaborate 5. The time-sharing supervisor must be and adaptive teaching programs could be used. able to interrupt a user's program after a Finally; as attested hy the many small business quantum of computation. A program-initiated one- computers, there are numerous applications in shot multivibrator which generates an interrupt busine$ and in industry where it would be a fixed time later is adequate. advantageous to have powerful computing facilities available at isolated locations with only the 6. Large core memories (e.g. a million incremental capital investment of each console. words) would ease the system programming compli- But it is important to realize that even \rithout cations immensely since the different active the above and other new applications, the major user programs as well as the frequently used advance in programming intimacy available from system programs such as compilers, query programs, time-sharing would be of immediate value to etc. could remain in core memory at all times. computer installations in universities, research laboratories, and engineering firms where programming Problems: program debugging is a major problem. 1. The supervisor program must do auto- matic user usage charge accounting. In general, AN EXPERIMENTAL TIME-SHARING SYSTEM 337

the user should be charged on the basis of a The 7090 of the MIT Computation Center has, system usage formula or algorithm which should in addition to three channels with 19 tape units, include such factors as computation time, amount a fourth channel with the standard Direct Data of high-speed memory required, rent of secondary Connection. Attached to the Direct Data Connec- memory storage, etc. tion is a real-time equipment buffer and control rack designed and built* under the direction of 2. The supervisor program should coordinate H. Teager and his group. This rack has a variety all user input-output since it is not desirable of devices attached but the only ones required to require a user program to remain constantly by the present systems are three flexowriter in memory during limited operations. typewriters. Also installed on the 7090 are two In addition, the supervisor must coordinate all special modifications (i.e. RPQ's): a standard usage of the central, shared high-speed input- 60 cycle accounting and interrupt clock. and a output units serving all users as well as the special mode which allows memory protection, clocks, disc units, etc. dynamic relocation and trapping of all user attempts to initiate input-output instructions. 3. The system programs available must be potent enough so that the user can think about In the present system the time-sharing his problem and not be hampered by coding occurs between four users, three of whom are on- details at'typographical mistakes. Thus, line each at a typewriter in a foreground compilers, query programs, post-mortem programs, system, and a fourth passive user of the back- loaders, and good editing programs are ground Fap-Mad-Madtran-BSS Monitor System similar essential. to the -Fap-BSS Monitor System (FMS) used by most of the Center programmers and by many 4. As much as possible, the users should other 7090 installations. be allowed the maximum programming flexibility both in choices of language and in the absence Significant design features of the fore- of restrictions. ground system are:

Usage Problems 1. It allows the user to develop programs in languages compatible with the background 1. Too large a computation or excessive system, typewriter output may be inadvertently requested so that a special termination signal should be 2. Develop a private file of programs, available to the user. 3. Start debugging sessions at the state 2. Since real-time is not computer usage- of the previous session, and time, the supervisor must keep each user informed so that he can use his judgment regarding loops, 4. Set his own pace with little waste of etc. computer time. Core storage is allocated such that all users 3. Computer processor, memory and tape operate in the upper 27,000 words with the time- malfunctions must be expected. Basic operational sharing supervisor (TSS) permanently in the questions such as "Which program is running?" lower 5,000 words. To avoid memory allocation must be answerable and recoveIYprocedures fully clashes, protect users from one another, and anticipated. simplify the initial 709 system organization, only one user was kept in core memory at a time. However, with the special memory protec- An Experimental Time-Sharing System for the IBM tion and relocation feature of the 7090, more 7090 sophisticated storage allocation procedures are being implemented. In any case, user swaps are Having briefly stated a desirable time- minimized by using 2-channel overlapped magnetic sharing performance, it is pertinent to ask tape reading and writing of the pertinent what level of performance can be achieved with locations in the two user programs. existant equipment. To begin to answer this question &nd to explore all the programming and The foreground system is organized around operational aspects, an experimental time- commands that each user can give on his type- sharing system has been developed. This system writer and the user's private program files was originally written for the IBM 709 but has which presently (for want of a disc unit) are since been converted for use with the 7090 kept on a separate magnetic tape for each user. computer. * This group is presently using another approach9 in developing a time-sharing system for the MIT 7090. 338 PROGRAMMING AND CODING

For convenience the format of the private tape Whenever the waiting command queue is files is such that they are card images. have empty, the supervisor proceeds to execute a title cards with name and class designators and simple round-robin of those foreground user can be written or punched using the off-line programs in the working status queue. Finally, equipment. (The latter feature also offers a if both these queues are empty, the background crude form of large-scale input-output.) The user program is brought in and run a quantum at magnetic tape requirements of the system are the a time until further foreground system actively seven tapes required for the normal functions of develops. the background system. a system tape for the time-sharing supervisor that contains most of Foreground user programs leave the working the command programs. and a private file tape status queue by two means. If the program and dump tape for each of the three foreground proceeds to completion, it can reenter the users. supervisor in a way which eliminates itself and places the user in dead status; alternatively, The commands are typed by the user to the by a different entry the program can be placed time-sharing supervisor (not to his own program) in a dormant status (or be manually placed by and thus can be initiated at any time regardless the user executing a quit sequence). The of the particular user program in memory. For status differs from the dead status in that the similar coordination reasons. the supervisor user may still restart or examine his program. handles all input-output of the foreground system t)vewriters. are composed of User input-output is each type- segments separated by vertical strokes; the writer, and even though the supervisor has a first segment is the command name and the few lines of buffer space available, it is remaining segments are parameters pertinent to possible to become input-output limited. the command. Each segment consists of the last Consequently, there is an additional input- 6 characters typed (starting vdth an implicit output wait status, similar to the dormant, 6 blanks) so that spacing is an easy way to which the user is automatically placed in by correct a typing mistake. A carriage return is the supervisor program whenever input-output the signal which initiates action on the command. delays develop. When buffers become near Whenever a command is received by the supervisor, empty on output or near full on input, the user "WAIT". is typed back followed by .. READY." when program is automatically returned to the working the command is completed. (The computer responses status; thus waste of computer time is avoided. are always in the opposite color from the user's typing.) While typing. an incomplete command line may be ignored by the "quit" sequence of a Commands code delete signal followed by a carriage return. Similarly after a command is initiated. it may To clarify the scope of the foreground be abandoned if a "quit" sequence is given. In system and to indicate the basic tools avail- addition, during unwanted command typeouts, the able to the user. a list of the important command and output may be terminated by pushing commands follows along with brief summaries of a special "stop output" button. their operations:

The use of the foreground system is initiated 1. I a whenever a typewriter user completes a command line and is placed in a waiting command queue. a = arbitrary text treated as a comment.

UPOil conlplet1on. of each quantlliu. J the time..:sharing supervisor gives top priority to initiating any 2. login I a I waiting commands. The system programs corres- ponding to most of the commands are kept on the a user problem number special supervisor command system tape so that to user programmer number avoid waste of computer time, the supervisor Should be given at beginning of each continues to operate the last user program until user's session. Rewinds user's private file tape; the desired command program on tape is positioned clears time accounting records. for reading. At this point, the last user is read out on his dump tape, the command program 3. logout read in, placed in a working status and initiated as a new user program. However, before starting Should be given at end of each user's the new user for a quantum of computation, the session. Hewinds user's private file tape; supervisor again checks for any waiting command punches on-line time accounting cards. of another user and if necessary begins the look- ahead positioning of the command system tape 4. input while operating the new user. Sets user in input mode and initiates generation of line numbers. The user AN EXPERIMENTAL TIME-SHARING SYSTEM 3.39

types a card image per line according to a 8. mad I a format appropriate for the programming language. causes file a,mad to be translated by (The supervisor collects these card images at the MADtranslator (compiler). File a,bss is the end of the user's pri va te file tape.) When created. in the automatic input mode, the manual mode may be entered by giving an initial carriage return 9. madtrn I a and typing the appropriate line number followed by I and line for as many lines as desired. To causes file a,madtrn (i.e. a pseudo- reenter the automatic mode, an initial carriage Fortran language file) to be edited into an return is gi ven • equivalent file a,mad (added to the user's file) and translation occurs as if the command madla The manual mode allows the user to over- had been given. write previous lines and to insert lines. (cf. 10. load I a I a 1 ••• la File Command.) l 2 n causes the consecutive loading of files 5. edit I a I O1,bss (i=1,2, ••• ,n). An exception occurs if 01= a title of file (libe), in which case file a. ,bss is searched p class of file as a library file for all subprograms still missing. (There can be further library files.) The user is set in the automatic input mode with the designated file treated as initial 11. use I a I a 1···1 an input lines. The same conventions apply as to l 2 the input command. This command is used whenever a load or previous use command notifies the user of an 6. file I a I p incomplete set of subprograms. Same a. conven- tions as for load. a = ti tie to be given to file p = class of language used during input 12. start I a I p The created file will consist of the Starts the program setup by the load numbered input lines (i.e. those at the end of and use commands (or a dormant program) after the user's private file tape) in sequence; in first positioning the user private file tape in the of duplicate line numbers, the last front of the title card for file a,p. (If p is version will be used. The line numbers will be not given, a class of data is assumed; if both written as sequence numbers in the corresponding a and p are not given, no tape movement occurs card images of the file. and the program is started.)

For convenience the following editing 13. pm I a conventions apply to input lines: a = "lights", "stomap", or the usual format of the standard Center post-mortem (F2PM) a. an underline signifies the deletion of request: subprogram name I loc I loc I mode I . . 1 2 the previous characters of the line. d where mode and direction are optional. b. a backspace signifies the deletion of Produces post-mortem of user's dormant the previous character in the field. program according to request specified by a. (E.g. matrix I 5 I 209 I flo I rev will cause to The following formats apply: be printed on the user's typewriter the contents a. FAP: symbol, tab, operation, tab, of subprogram "matriX" from relative locations variable field and comment. 5 to 209 in floating point form and in reverse sequence.) b. MAD, MAIYrRAN, FORTHAN: statement label, tab, statement. To place a character in the 14. skippm continuation column: statement label, tab, backspace, character, statement. Used if a pm command is "quit" during output and the previous program interruption is to c. cols. 1-72. be restarted.

7. fap I a 15. listf Causes the file designated as a, fap to Types out list of all file titles on be translated by the FAP translator (assembler). user's private file tape. Files a, symtb and a,bss are added to the user's private file tape giving the symbol table and the relocatable binary BSS form of the file. 340 PROGRAMMING AND CODING

16. printf I a I I y In the deSign of the present system, great Types out file starting at line care went into making each user independent of the other users. However, it would be a useful number y. If Y is omitted, the initial line is assumed. Whenever the user's output buffer fills, extension of the system if this were not always the command program goes into an liO wait status the case. In particular, when several consoles allowing other users to time- until the are used in a computer controlled group such as buffer needs refilling. in management or war games, in group behavior studies, or possibly in teaclting machines, it would be desirable to have all the consoles 17. xdump a I I communicating with a single program. Creates file (if omitted, xdump assumed) on user's private file tape consisting Another area for further improvement within of the complete state of the user's last dormant the present system is that of file maintenance, program. since the presently used tape units are a hind- rance to the easy deletion of user program files. 18. xdump I a I Disc units will be of help in this area as well as with the problem of consolidating and Inverse of xdump command in that it resets file as the user's program, starting scheduling large-scale central input-output it where it last left off. generated by the many console users.

Although experience with the system to date Finally, it is felt it would be is quite limited, first indications are that able to have the distinction between the fore- programmers would readily use such a system if it ground and background systems eliminated. The were generally available It is useful to ask, present-day computer operator would assume the role of a stand-in for the background users, now that there is some operating experience with the 7090 system, what observations can be made. using an operator console much like the other user consoles in the system, mounting and de- An immediate comment is that once a user gets mounting magnetic tapes as requested by the accustomed to computer response, delays of even a fraction of a minute are exasperatingly long, supervisor, receiving instructions to read card an effect analogous to conversing with a slow- decks into the central disc unit, etc. Similarly speaking person. Similarly, the requirement that the foreground user, when satisfied with his a complete typewritten line rather than each program, would by means of his console and the supervisor program enter his program into the character be the minimum unit of man-computer queue of production background work to be communication is an inhibiting factor in the performed. With these procedures implemented sense that a press-to-talk radio-telephone con- the distinction of whether one is time-sharing versation is more stilted than that of an or not would vanish and the computer user would ordinary telephone. Since maintaining a rapid be free to choose in an interchangable way that computer response on a character by character basis requires at least a vestigial response mode of operation which he found more suitable program in core memory at all times, the straight- at a particular time. forward solution within the present system is to have more core memory available. At the very A Multi-LeVel Scheduling Algorithm least, an extra bank of memory for the time- sharing supervisor would ease compatibility prob- Regardless of whether one has a million lems with programs already written for 32,000 word CQre memory or a 32: 000 word memory as word 7090's. currently exists on the 7090, one is inevitably faced with the problem of system saturation For reasons of expediency, the weakest where the total size of active user programs portions of the present system are the conventions exceeds that of the high-speed memory or there for input, editing of user files, and the degree are too many active user programs to maintain of rapid interaction and intimacy possible while an adequate response at each user console. debugging. Since to a large extent these areas These conditions can easily arise with even a involve the taste, habits, and psychology of the few users if some of the user programs are users, it is felt that proper solutions will excessive in size or in time The require considerable experimentation and prag- predicament can be alleviated if it is assumed matic evaluation; it is also clear that these that a good design for the system is to have a areas cannot be treated in the abstract for the saturation procedure which gives graceful de- programming languages used will influence greatly gradation of the response time and effective the appropriate techniques. A greater use 6f real-time computation speed of the large and symbolic referencing for locations, program names long-running users. and variables is certainly desired; symbolic post- mortem programs, trace programs, and before-and- after differential dump programs should play useful roles in the debugging procedures. AN EXPERIMENTAL TIME-SHARING SYSTEM 341

To show the general problem, Figure I Similarly, if a program of size w at level qualitatively gives the user service as a function t, during operation requests a change fn memory of n, the number of active users. This service size from the time-sharing supervisor, then the parameter might be either of the two key factors: enlarged (or reduced) version of the program computer response time or n times the real-time should be placed at the end of the £tI queue where computation speed. In either case there is some critical number of active users, N, representing the effective user capacity, which causes satur- t" = £ + [ log2 ( [=:J + 1 ) J· (2) ation. If the strategy near saturation is to execute the simple round-robin of all users, then Again the process is re-initiated with the head- there is an abrupt collapse of service due to the of-the-queue user at the lowest occupied level sudden onset of the large amount of time required of £'. to swap programs in-and-out of the secondary memory such as a disc or drum unit. Of course, Several important conclusions can be drawn Figure I is quite qualitative since it depends from the above algori thm which allow the perfor- critically on the spectrum of user program sizes mance of the system to be bounded. as well as the spectrum of user operating times. Computational Efficiency To illustrate the strategy that can be em- ployed to improve the saturation performance 1. Because a program is always operated for of a time-sharing system, a multi-level schedu- a time greater than or equal to the swap time ling algorithm is presented. This algorithm also (i.e. the time required to move the program in can be analyzed to give broad bounds on the and out of secondary memory), it follows that system performance. the computational efficiency never falls below one-half. (Clearly, this fraction is adjustable The basis of the multi-level scheduling in the formula for the initial level, to.) An algorithm is to assign each user program as it alternative way of Viewing this bound is to say enters the system to be run (or completes a that the real-time computing speed available to response to a user) to an £th level priority one out of n active users is no worse than if queue. Programs are initially entered into a there were 2n active users all of whose programs level £0' corresponding to their size such that were in the high-speed memory.

£0 = [10g2 ([ :: ] + 1 ) ] (1) Response Time 2. If the maximum number of active users where w is the number of words in the program, is N, then an individual user of a given program w is tge number of words which can be trans- size can be guaranteed a response time, in and out of the high-speed memory from the secondary memory in the time of one quantum, tr 2Nq[ :: ] + 1) (3) q, and the bracket indicates "the integral part of". Ordinarily the time of a quantum, being since the worst case occurs when all competing the basic time unit, should be as small as user programs are at the same level. Conversely, possible without excessive overhead losses when if tr is a guaranteed response of arbitrary the supervisor switches from one program in high- value and the largest size of program is assumed, speed memory to another. The process starts with then the maximum permissible number of active the time-sharing supervisor operating the program users is bounded. at the head of the lowest level occupied queue, £, for up to 2£ quanta of time and then if the Long Runs program is not completed (i.e. has not made a response to the user) placing it at the end of 3. The relative swap time on long runs can the £+1 level queue. If there are no programs be made vanishingly small. This conclusion entering the system at levels lower than £, this follows since the longer a program is run, the process proceeds until the queue at level £ is higher the level number it cascades to with a exhausted; the process is then iteratively begun correspondingly smaller relative swap time. It again at level £+1, where now each program is is an important feature of the algorithm that long run for 2£+1 quanta of time. If during the runs must in effect prove they are long so that execution of the 2£ quanta of a program at level programs which have an unexpected demise are £, a lower level, t', becomes occupied, the detected quickly. In order that there be a current user is replaced at the head of the £th finite number of levels, a maximum level number, queue and the process is reinitiated at level L, can be established such that the asymptotic tt. swap overhead is some arbitrarily small percentage, p: 342 PROGRAMMING AND CODING

a bound on this cut-off point we N L [lOg2 +1)] (4) active users at level £ each running 2 quanta, terminating, and reentering the system again at where w is the size of the largest possible pmax level £ at a user response time, t u ' later. If program. there is to be no service at level £+1, then the computing time, Nq2£, must be greater than or Mul ti-Ievel vs. Single-level Response Times equal to tu. Thus the guaranteed active levels, .e , are given by the relation: 4. The response time for programs of equal a size. entering the system at the same time. and .ea [ log2 (tu) 1 (8) being run for multiple quanta. is no worse than Nq J approximately twice the response-time occurring in a single quanta round-robin procedure. If In the limit, tu could be as small as a minimum there are n equal sized programs started in a user reaction time sec.), but the expected queue at level t. then the worst case is that of value would be several orders of magnitude the end-of-the-queue program which is ready to greater as a result of the statistics of a respond at the very first at the large number of users. £+j level. Using the multi-level algorithm. the total delay for the end-of-the-queue program is The multi-level algorithm as formulated by virtue of the geometric series of quanta: above makes no explicit consideration of the seek or latency time required before transmission of j j Tm'- q2.e {n(2 -l) + (n-l) 2 .J (5) programs to and from disc or drum units when they are used as the secondary memory, (although Since the user has computed for formally the factor Wq could contain an average a time of 2 (2J -l) quanta, the equivalent single- figure for these times). One simple modification level round-robin delay before a response is: to the algorithm which usually avoids wasting the seek or latency time is to continue to (6) operate the last user program for as many quanta as are required to ready the swap of the new user Hence with the least priority user; since ordinarily only the higher level number programs would be forced out into the secondary memory. the 1 + ( ---n-l) (2j--.--- ) 2 (7) n 2J-I extended quanta of operation of the old user while seeking the new user should be but a minor distortion of the basic algorithm. and the assertion is shown. It should be noted that the above conditions. where program swap Further complexities are possible when the times are omitted. which are pertinent when all hardware is appropriate. In computers with input- programs remain in high-speed memory. are the output channels and low transmission rates to and least favorable for the multi-level algorithm; if from secondary memory, it is possible to overlap swap times are included in the above analysis, the the reading and writing of the new and old users ratio of Tm I Ts can only become smaller and may in and out of high-speed memory while operating become much less than unity. By a similar analysis the current user. The effect is equivalent to it is easy to show that even in the unfavorable using a drum giving 100 % multiplexor usage but case where there are no program swaps. head-of-the- t there are two liabilities, namely. no individual queue programs that terminate just as the 2 +j user can utilize all the available user memory quanta are completed receive under the multi- space and the look-ahead procedure breaks down level algorithm a response which is twice as whenever an unanticipated scheduling change fast as that under the single-level round-robin occurs (e.g. a program terminates or a higher- (Le. Tm IT s = 1/2). priority user program is initiated).

Highest Serviced Level Complexity is also possible in storage allocation but certainly an elementary procedure 5. In the multi-level algorithm the level and a desirable one with a low-transmission rate classification procedure for programs is entirely secondary memory is to consolidate in a single automatic, depending on performance and program block all high-priority user programs whenever size rather than on the declarations (or hopes) sufficient fragmentary unused memory space is of each user. As a user taxes the system. the available to read in a new user program. Such a degradation of service occurs progressively procedure is indicated in the flow diagram of the starting with the higher level users of either multi-level scheduling algorithm which is given large or long-running programs; however, at some as Figure 2. level no user programs may be run because of too many active users at lower levels. To determine AN EXPERIMENTAL TIME-SHARING SYSTEM 343

It should also be noted that Figure 2 only In any case, considerable caution should be accounts for the scheduling of programs in a used with capacity and computer response time working status and still does not take into estimates since they are critically dependent account the storage allocation of programs which upon the distribution functions for the user are in a dormant (or input-output wait status). response time, t ' and the user program size, u One systematic method of handling this case is wp , and the computational capacity requested by to modify the scheduling algorithm so that each user. Past experience using conventional programs which become dormant at level £ are programming systems is of little assistance be- entered into the queue at level £+1. The cause these distribution functions will depend scheduling algorithm proceeds as before with the very strongly upon the programming systems made dormant programs continuing to cascade but not available to the time-sharing users as well as operating when they reached the head of a queue. upon the user habit patterns which will gradually Whenever a program must be removed from high- evolve. speed memory, a program is selected from the end- of-the-queue of the highest occupied level number. Conclusions

Finally, it is illuminating to apply the In conclusion, it is clear that contemporary multi-level scheduling algorithm bounds to the computers and hardware are sufficient to allow contemporary IBM 7090. The following approximate moderate performance time-sharing for a limited values are obtained: number of users. There are several problems which can be solved by careful hardware design, q = 16 m.s. (based on 1% switching overhead) but there are also a large number of intricate Wq = 120 words (based on one IBM 1301 model system programs which must be written before one has an adequate time-sharing system. An import- 2 disc unit without seek or latency times included) ant aspect of any future time-shared computer is that until the system programming is completed, tr BNf (based on programs of (32k)f especially the critical supervisor, sec. words) the computer is completely worthless. Thus, it is essential for future system design and imple- £a 10g2 (lOOO/N) (based on tu = 16 sec.) mentation that all aspects of time-sharing system £0 B (based on a maximum program size of problems be explored and understood in prototype 32K words) form on present computers so that major advances in computer organization and usage can be made. Using the arbitrary criteria that programs up to the maximum size of 32,000 words should always get some service, which is to say that Acknowledgements max la= max £0 ' we deduce as a conservative estimate that N can be 4 and that at worst the The authors wish to thank Bernard Galler, response time for a trivial reply will be 32 Robert Graham and Bruce Arden, of the University seconds. of Michigan, for making the compiler available and for their advice with regard to its adaption The small value of N arrived at is a direct into the present time-sharing system. The consequence of the small value of Wq that results version of the Madtran Fortran-to-Mad editor from the slow disc word transmission rate. This program was generously supplied by Robert Rosin rate is only 3.3% of the maximum core memory of the University of Michigan. Of the MIT multiplexor rate. It is of interest that using Computation Center staff, Robert Creasy was of high-capacity high-speed drums of current design assistance in the evaluation of time-sharing such as in the Sage System of in the IBM Sabre performance, Lynda Korn is to be credited for her System it would be possible to attain nearly contributions to the pm and madtran commands, and 100% multiplexor utilization and thus multiply Evelyn Dow for her work on the fap command. w by a factor of 30. It immediately follows tgat user response times equivalent to those _..: .... ___ h-... ,_ ...... : .. l.. .. "'_ ,.:1..; ..... _ •• _..: ...... _ ... ,...:1 h __ .... __ T"t_-C ___ • ___ _ 6 ..... Vw ... " UOUVV":;;: .,...... "".&..1. "'.u..... u ...... ,"'" ".• ,u ...... WVU,.LU Ut;; O .... VC.l.l 1l,1I;;:J,.t;;:.Lt;:11\,;t;:;:' to 30 times as many persons or to 120 users; the total computational capacity, however, would not 1. S trachey, C., "Time Sharing in Large change. Fast Computers," Proceedings of the International Conference on Information Processing, UNESCO (June, 1959), Paper B.2.19. 344 PROGRAMMING AND CODING

2. Licklider, J. C. R., "Man-Computer 6. Codd, E. F., "Multiprogram Scheduling," Symbiosis," IRE Transactions on Human Factors in Communications of the ACM, 3, 6 (June, 1960), Electronics, HFE-l, No.1 (March, 1960), 4-11. 347-350.

3. Brown, G., Licklider, J. C. R., 7. Heller, J., "Sequencing Aspects of McCarthy, J., and PerIis, A., lectures given Mul tiprogramming," Journal of the ACM, 8, 3 spring, 1961, Management and the Computer of the (July, 1961), 426-439. Future, (to be published by the M.I.T. Press, March, 1962). 8. Leeds, H. D., Weinberg, G. M., "Multi- programming," Computer Programming Fundamentals, 4. Corbatc{, F. J .. , "An Experimental Time- 356-359, McGraw-Hill (1961). Sharing System," Proceedings of the IBM Uni versi ty Director's Conference, July, 1961 (to be pub- 9. Teager, H. M., "Real-Time Time-Shared lished) • Computer project," Communications of the ACM, 5, 1 (January, 1962) Research Summaries, 62. 5. Schmitt, W. F., Tonik, A. B., "Sympa- thetically programmed Proceedings 10. Teager, H. M., McCarthy, J., "Time- of the International Conference on Information Shared Program Testing," paper delivered at the processing, UNESCO, (June, 1959) Paper B.2.18. 14th National Meeting of the ACM (not published).

Quantum finished I

1 Any users n·.) t = (J! no initiated , in level £'<.1- '? .L yes Place current Fut user user at head at end of of queue t. 1 queue 1 Find head of i ,l-1' Service occupied leve

Is user at head of queue yes ;\. in memory'? N n --;. .f0 Is there r)om for head of ves queue Figure 1. Service vs. Number of in primary Active Users memory'?

.is there enough slack consolidate Read in in primary slack. program memory for urogram?

out lowest , priori ty I program I

Figure 2. Flow Chart of Multi-Level Scheduling Algorithm