II B R.AR.Y OF THE UN 1VERSITY Of ILLI NOIS S\o.fc4- y\o. 2A5- 2.49 coo- 2* The person charging this material is re- sponsible for its return on or before the Latest Date stamped below. Theft, mutilation, and underlining of books are reasons for disciplinary action and may result in dismissal from the University. UNIVERSITY OF ILLINOIS LIBRARY AT URBANA-CHAMPAIGN ►W 14 1972 E£B 1 6 Re^i Digitized by the Internet Archive in 2013 http://archive.org/details/storageallocatio247hech I Report No, 2kl MhTH- FEB V COO-1018-1126 STORAGE ALLOCATION MODULE FOR A TIME SHARING SYSTEM Robert W. Hecht September 19, 1967 Report No. 247 STORAGE ALLOCATION MODULE FOR A TIME SHARING SYSTEM* by Robert W. Hecht September 19, 1967 Department of Computer Science University of Illinois Urbana, Illinois 6l801 *This work was supported in part by the Atomic Energy Commission under Contract No. US AEC AT(ll-l)-10l8 and was submitted in partial fulfillment for the Master of Science degree in Electrical Engineering, September 19, 1967. . L a 1 p j Professor Mc "k for I ritii of this paper The material in section k .2 was developed by David Gold, and the material in section 6 2 i i and some ma1 riaJ L n section developed by John Rohr Th€ i nor worked with Randall John on in developing the material in section 6 The author greatly appreciates the help ti by hi wife. Charlene,in polishing up the grammar of tn r. iv TABLE OF CONTENTS Page ACKNOWLEDGEMENT „ . . . . . . ...... . . . . . . . . „ . . . . . . . . . . . . . . . . . . . . . . . . iii LIST OF FIGURES .............................................. v LIST OF ABBREVIATIONS ........................................ vi 1 . INTRODUCTION ................................................. 1 1.1 An Introduction to Time Sharing ......................... 1 1.2 An Example of a Program with a Block Structure- -PL-/ 1 .... 2 2 . SEGMENTATION ................................................. 6 2.1 Transfers and Calls ..................................... 6 2.2 Data and Execution Segments ............................. 6 3 . ILLXAC III HARDWARE .......................................... 8 3.1 Contents of Taxicrinic Registers ........................ 8 3.2 Use of Taxicrinic Processors . . . „ . . . . . . ... ... . . . . . . . . . . . . 9 h , STORAGE OF USER ■ S DATA ....................................... 11 U.l Program Tables .......................................... 11 U ,2 The Binary Chop Pointer ................................. l6 h , 3 Segment Directory ....................................... 18 h.k Associated Segment List ................................. 21 h , 5 The Loading of the Various User Tables .................. 22 5 . DELEGATION OF CORE TO SE ;-MENTS - ............................ 23 5,1 Splitting Core into Binary Size Blocks .................. 23 5 ,2 Core Map . .............................................. 2^4 6 . SCHEDULING MODULE ............................................ 26 6.1 Local and Global Scheduling ............................. 26 6.2 Global Scheduling ....................................... 27 6.3 Local Scheduling ......... ................. ............. , 32 7. THE HANDLING OF TASKS ........................................ hk 7.1 Task Interruption ....................................... UU 7.2 The Choice of Segments .................................. 1+5 7.3 Ping Pong Lists 50 1 ,k Old Task Lists ........................................... 51 7,5 Determination of Size for Following Run ................. ^h 8. SUMMARY ....................................................... 55 LIST OF REFERENCES ........................................... 56 LIST OF FIGURES Figure Title Page 1 . Sample Program ............................. 5 2. A User's Program Description Library ....... 12 3 . Active Program Table ....................... 13 U. A Segment Directory For a Program o„o „<,„.<><, * 20 Entry in Core Map .......................... 25 6 . Scheduling Module .......................... 28 7. Program Using Parallel Processing .......... 31 8. Active Task List ........................... 33 9 - Cycle Table and Headers . . „ . . ...... . . , „ . . . . . 35 10 . Cycle Table Entry ................'.......... 36 11. Combination Table .......................... 39 12 . Another Program ............................ k'] 13 Program Describing Old Task Lists „ „ . . . <= „ , c . 53 VI LIST OF ABBREVIATIONS Abbreviations Term AA Absolute Address APT Active Program Table AS Associated Segment ASL Associated Segment List ATL Active Task List BCP Binary Chop Pointer BR Base Register BTU Basic Time Unit FCD Frequency Count Down FSM File Service Module HIP High Pointer I D, Identification l/O Input -Output LOP Low Pointer LSB Low Speed Buffer NTL Next Task List OS Operand Stack OTL I Old Task List I OTL II Old Task List ] I PDL Program Description Library PPL I Ping Pong List I PPL II Ping Peng List II PR Pointer Register Vll Abbreviation Term SAM Storage Allocation Module SD Segment Directory SD I Segment Directory I SD II Segment Directory II SS Secondary Storage TOS Top of the Operand Stack TP Taxicrinic Processor TSS Time Sharing System 1 . INTRODUCTION 1 1 An Introduction to Time Sharing The purpose of this paper is tc present the Storage Allocation Module (SAM) for a Time Sharing System (TSS), The TSS for which the SAM was designed is to be implemented on the Illiac ITT computer being built at the University of Illinois in Urbana : Illinois. The charac- teristics of Illiac III helped determine what to implement in the system, A brief discussion of time-sharing will be given here. When a computer is time^shared, a program is not run from start to finish as in a conventional operation, but it is only executed for a short time, and then a different program is executed. After the other programs in the system receive a share of time,, the first program will receive another turn- This cycling is continued until the program is finished. Then it will either be printed out on the printer or stored until the user calls for his results A program can be entered into the system by conventional means , such as a card reader: or by a remote console, which may be a Teletype machine. A completed program that is stored on the disk may be fed out onto a remote console at the command of the user There are several advantages that a TSS has over batch pro- cessing, A small program will be finished in a few turns, allowing the user to obtain the results of the program almost immediately „ This feature makes it possible for the user to edit sections of a large program easily. A disadvantage of batch processing is that the pro- cessor is held up for input -output (l/o) operations. In a TSS if core 2 is large enough and if the SAM is properly designed, the processor need net wait for I/O, hut rather the processor can switch to another program which is assumed to be in core. Therefore, if the processor is to run continuously, a large core is needed. The SAM is responsible for the storage of all information in the system, both in core and in the Secondary Storage (SS). It is also responsible for the act of initiating transfers between core and secondary storage at the correct time. Segmentation, the procedure whereby a program is broken into segments, is performed by the translator. To have an efficient system, segmentation is not a random partitioning of the program, but reflects the block structure of the program. Preferably every program should be written in a language having block structure. "BAL, PL/'l, ALGOL, etc, Additional pseudo-orders may be added to other programming language so that, for example, a FORI RAN program can be broken into blocks. Alternatively the program could be sufficiently short that it fits into one segment- -in which case the segmentation procedure degener- ates the traditional baton processing strategy. 1.2 An_ExampLe_of a Program with a Block Structure — PL/l An example of a PL/1 program can be used to demonstrate the concept of segmentation. A brief description of some aspects of PL/l follows . Locations in core must be reserved for the data used in a program. Data can be represented in various forms* for example, it can be real or complex, floating point, fixed point, or an integer constant. For example, the real floating point variable A, significant to ten digits, is declared by DECLARE A REAL (10) FLOAT; A block is a series of declarations and statements enclosed in the statement parenthesis BEGIN'; and ENE ? . It is preceded by the name of the block, for example the block A is declared A BEGIN j ****** END A? '- 1 - When a program is very long, there are reasons for having block structure in addition to allowing for segmentation, It may be convenient to have several users work on different parts of the same program. If more than one programmer is to work on one program, it would be more efficient to have a minimum amount of communication be- tween the programmers. Assume that a block uses variables A s B, C and produces variables S, T, U and temporarily uses variables P, Q, Variables P and Q are called intermediate variables, Two different pro- grammers could use the same name for example [NT for different inter- mediate variables. Therefore, the compiler should not assign the same location for variables of the same name when they are declared in different blocks. However if a block & is part of a larger block B, then B' can use the variables declared in B The concept of local and global variables solves the above problem. Variables declared in a block are called local variables name of the variable can be the sa r ne as tne name of a different variable declared in other blocks , variables declared in a block having one or more sub-blocks are global to the sub-blocks. If B' is a sub-block of B-, variables declared in B are global variables of B' , B' therefore, can access the variables declared in B but if B' declares a variable with the same name as a variable in E. then B' will not be able to access the variable of that name declared in E ™ k The data declarations mentioned previously only allow core storage for single variables. For large amounts of data, it is possible to reserve an entire section of core with an array declaration. A variable may be subscripted to one cr more dimensions. The bounds of an array are enclosed in parenthesis and immediately follow the array name, for example; DECLARE BILL (4:17)^ Thirteen locations would be reserved for the variable BILL. The two- dimensional integer array CAM is declared by the statement: DECLARE CAM (100, 25:75) FIXED (10); Locations for five thousand ten digit decimal numbers would be reserved. Generally, the bounds on an array will be given by variables. The values of these variables are only known at the time the block is entered during execution. In the following sample program, only the instructions pertain- ing to storage allocation will be given. An * will represent a series of other statements. A: BEGIN; DECLARE A, B, C, K (l;50);*; B: BEGIN; DECLARE N (50:100) FIXED (S), K(20:100)j*| END B;*; - BEG •!; DECLARE X (l:25);*; D: BEGIN; DECLARE Y;*; END D;*; END C; E: BEGIN; DECLARE ACE (1:10);*; F: BEGIN; DECLARE K (1:500);*; G: BEGIN; DECLARE S, T;*; END G;*; END F;*; E1TD E;*; END A; The diagram of the block structure is A B C D E F la Figure 1„ Sample Program Assume blocks A, B„ and F declare different variables by the same name „ If K is used by A, C_, D, or E, the variable in question would be the one declared in A, If r > ases K, G would use the variable declared in F. The variable K declared in F is local in F and global in G. 6 2 . SEGMENTATION 2 . 1 Transfers and Calls At any time a transfer can be made out of a block to any point in a higher block. For example, a transfer can be made out of block D to any point in C or in A. A block may be called by transferring to the label of that block. Blocks B, C, or E could be called by an order in block A; block D could be called when operating in block C. 2 ,. 2 Data and Execution Segments An innermost block of code that can be executed is referred to as an execution file. Any block minus all nested files within it is also called an execution file. A data array is called a data file. The term segment will mean execution segment or data segment, If the execution files are very small, the compiler may combine several files together to form an execution segment. An execution segment is, therefore, a single execution file or a collection of small execution files. If the segment contains more than one file, the files are either nested or related logically in some manner. Similarly, a data array could become a data segment, or single variables and several small data arrays could be combined into one data segment. The maximum length of the data segment depends upon available core size. It is convenient to have an entire data array contained in one segment, because if a call is made to some data in an array, one dees not know tc what part of the array the call is being made prior execution time; therefore, the entire array should 7 be in core when the call to the array is made. An exception could be made to this rule if the programmer supplies additional information to the system for example, that only one column of a matrix is needed each time the innermost loop is entered. The maximum length of an execution segment also depends on the size of core , Since there may be an exceedingly large number of transfers within one block, it is well to have at least an entire block contained in an execution segment, It is the responsibility of the programmer to make sure that his blocks will be small enough to fit into an execution segment. 3o ILL: AC ED HARDWARE 3 • 1 Contents of 'Taxlcrinic Registers A brief explanation of the hardware of Illiac III will be given here. The smallest accessible unit of core is one byte. A byte consists of eight bits plus one flag bit, A word is made from four bytes, A page is a block of 256 bytes, Two registers are needed to access any byte in core, the Base Register (BR) and the Pointer Register (PR), The maximum amount of core that can be addressed is 2 or 65536 pages. The Base Register consists of three bytes „ Base Register Address of any page Page count i 2 3 The first two bytes hold the address of any page in core,. The page count is explained below The Pointer Register consists of two bytes and can address any byte within a block of 256 pages (.maximum). Pointer Register Address of any byte in block , A ^ k 5 1 2+U 5 9 If a segment is assigned to a section, or block, of core of n pages where n < 256, then the PR can access any byte within this block, but not beyond it. To provide protection, n=l is placed in the "page count" of the block BR. To address any byte in core, field four of the PR is added to fields one and two of the BR and field five is concatenated as a suffix to the sum. The summation of fields two and four could produce a carry into field one. The resulting three bytes, , form the address of the byte being referred to. Therefore, a core address is three bytes long. 3.2 Use of Taxicrinic Processors Illiac III has four Taxicrinic Processors (TP's) and each TP has 15 PR's and 8 BR's. '^r.eri a program is compiled, one or more PR's are assigned to each segment. Pointer Register "0" holds the current instruction and PR "13" is used for the operand stack pointer. Other PR s can be used for operand identification within the segment. One BR will be assigned to a segment. In three flag bits of each PP. assigned to the segment is a number from zero to seven identifying the BR assigned to that segment. When a segment is pxaced in core, it must begin at a page boundary. The number for this page is placed in the BR assigned to that segment. If a word k bytes from the top of the segment is to be read, where k < 2 , then k is placed in the appropriate PR. To access the word, the PR is added to the BR as explained above. 10 To transfer from one execution segment to another, the names of the PR's are permuted so that the PR assigned to point to the instruc- tion strip of the new program is now called "0". Therefore, it is possible to have a program with a total of eight segments which can switch from one segment to another by permuting the PR's. In reality, any number of segments can be used, but the system must change the BR's and PR's appropriately, as will be explained in section 7-2. 11 k. STORAGE OF USER'S DATA k , 1 Program T ab les When a user enters the system, he submits his name, identifica- tion number (i.D ). and department name, A Department User I.D. table, which is a list of all users in that department, is stored in the system. If the name and I.D. number correspond to a pair on the list, the user's Program Description Library C DL is brought into cere, I.D, numbers are used for guarding against unauthorized use of the machine and for billing, One user may have more than one I.D. number, but may want all of his programs in one PDL. Therefore, the I.D. number used when entering the system would be the number that would be billed, 4 1.1 Pr ogr am_Des cription J^lbra_ry The PDL is a list of all the programs a user has in the system. The term "program" has been used informally up to this point. In the remainder of this paper "program" shall have the following meaning (1) an independent collection of execution and data segments, or (2) execution segments, with or without data segments, that are used as procedures by several different programs , or (3) data segments need by several programs or executable segments using two and three above, The user will give each program in the PDL an alphanumeric name that he uses to access the program, This name is variable in length and can be up to 31 characters in length, where each character requires one byte of storage, 12 T3 (D •P CO •H o o CO < -P CO CJ o ij •p C (U i bO (U CO e CO !h tao o u Q. -p co H ►J -P a s (30 5 u o -p CJ 0) M a cy S 00 a> CO a cu E aO a CO M o CH CU (S3 •H CO O Sh QJ ,0 ■P C CU £ (30 CU CO -p c cu E 00 CU CO M o -p CJ CU M Pa m O -P CJ CU u CU > ■H •P CJ < ft o ft E co fn •30 o u cu i 3 5n o Cm CO U (3D O u ft E CO qO o f-l P4 CO Si ft CO M CO M •H Ml G O •H -P ft •H Sh CJ co CU fl E CO & o ft CU w CM (30 •H ft 13 The user may call for a program by giving the program name, ne does not know what programs he has in the system, the user may ask for a display of all his programs, When a program becomes active,, that is, is to be executed, it is assigned a two-byte program number. The program number is determined by the position of the program in the Active Program Table. Each segment in a program is assigned a two- byte number during compilation. Therefore, associated with each active segment is a four -byte number, ^ - 1 ' 2 Active Program Table An entry for each active program is stored in the Active Program Table (AFT''- Each entry in this table will be as follows: Location of Location of Program Segment Directory Description Library Pointer to Associated Programs T Jse Counter Pointer to Core Map Location in Secon- dary Storage Pointer to Core Map Location in Secondary Storage Pointer to Program in User' s Figure 3, Active Program Table Ik The structure of tne APT is as follows: Assume the number of bytes needed for one entry in each column of the APT is x c Then the n program would be at the n*x location from the top. This procedure allows for easy access of pro- gram n since the BR can be set at the top Of the APT and the PR is set to n*x, If a program is deleted,, the location in the APT is linked to ether empty positions, A new program is assigned a program number which corresponds to an empty position in tne APT, or if there are not any empty positions, the program is assigned to a number at the end of the list, Although two bytes will accommodate 6^53^ active programs,, the size of the system will limit the maximum number of programs to a considerably smaller number : When empty positions are linked together,, a free list results The structure of tne associated programs and of the alphanumeric names in the PDL is a list structure also employing a free list. The Segment Directory (SD) explained in section 1+.3 is a segment itself. To keep the system uniform, a segment number will be assigned to the SD, This number is at the bead of the segment and is used to check for errors; for instance, whether or not the correct segment was brought into core. This number is listed in the column ''Segment Directory" in that user's PD1 , As with all other segments of that program^ the first two bytes are the program numbers. The locations of the user's Segment Directory and Program Description Library are stored in the Active Program Table, The delegation of core to segments is explained in section 5« 15 [f one program calls anotner program, then at the time the transfer is made, segments from both programs should be in core. Con- sequently, the 3D s from both programs should be in core. The Associ- ated Program List contains the alphanumeric name of all programs asso- ciated with the first program. Program A is assigned an active program number. The user may execute parts of A. but he will m t be able to execute the entire program without declaring where the program should be transferred since., normally ; the program would transfer to B, Assume program A calls program B, The user may want to edit program A before program B is written. User A may call for a program from user B s POL assuming that user A has access rights to user h s program, .If the program is from another PDL, the first flag bit of the entry "Active Program Number'' in the user's PDL would be changed from zero to one. Even though tr.e associated program is not in the user's PDL, a space is reserved for it in the E ll However in this case^ the fields normally containing the Segment Directory, Segment Size and Segment Location would now contain the necessary information to find the other user's D DL The Associated Program List and the program name are of variable length, but this is acceptable since the PDL is a linked structure. A short PDL for system procedures will remain in core at all times. If the associated program is a library procedure, then there will be a pointer to the entry in the system PDL that gives the SD for the appropriate class of procedures, For example a SD for all trigo- nometric and logarithmic procedures would be classed under one program in the PDL, 16 The active program number is inserted into the user's PDL for the following reason. The active program A calls program C which also becomes active. While the programs are being executed, the user may decide to execute program B which calls C 3 It will be observed that C is already active, so the Use Counter in the APT is increased by one. When program A is completed, the Use Counters for A and C are decreased by one. Since C still has a positive number, it remains active. When program B is completed, the Use Counter in C becomes zero, It is then taken off the APT, The entry in the APT, Pointer to the Program in User's PDL, is used for deleting the active program number in the User's PDL, h , 2 The Bina ry Cho p Pointer The entries of the PDL will be stored using a method called the Binary- Chop Pointer (BCP) which is a combination of a list process., and storage in continuous core. If entries are sorted by increasing values and then stored in continuous core, a binary chop method of access could be used; however, to insert or delete an entry would require a great deal of shifting, A list structure would allow for easy additions and deletions, but would necessitate a sequential search. In a BCP directory two pointers are needed, a High Pointer (HIP) and a Low Pointer (LOP* . When searching the directory for a particular entry, a three-value decision is necessary; 17 (l) equal to--the item has been found, 1,2) less than- -the item is less than the one being searched for and the HIP indicates the next entry to be considered, (3) greater than --the item is greater than the one sought; the LOP points to the entry to be examined „ The process shall be illustrated by an example. The follow- ing nine numbers are inserted over a period of time into the directory which is initially blank: 2, 7, 5, 16, k, 12, 6, 3, 10 Forming the directory and searching for a particular value involves the same process. The numbers are stored in consecutive core starting with X, although a more general list structure could also be used, A primary pointer points to the first entry, which is two in this case. Subsequent entries and searches are made through this pointer , Location Entry X 2 X + 1 7 X + 2 5 X + 3 16 X + k k X * 5 12 X + 6 6 X + 7 3 x + 8 10 LOP HIP X + 1 X 4 2 X r 3 X 4- 4 X + 6 X + 5 X + 7 X r 8 18 The tree for this example is: Arrows to the right indicate HIP s and arrows to the left indicate LOP's. If the numbers are inserted in a monotonic fashion, the process will degenerate to a sequential search, but, in general, will be more efficient as the above example indicates. The BCP structure is used for sorting the program names, although the sorting is alphabetic in nature, that is A> X> OJ CO -p CM CD -P CO CD P XI CM 0) s CO w o Ph CO o O P o CD P> g bO CD CO bO •H 21 segment in several locations at one time. If data is read bat not changed, it would not be necessary to recopy it back into the Secondary Storage., The Old Task List section 7 k ) yields another reason for having several entries for the location of a segment. k , k Associated Segment List Referring back to the sample program 'section 1.2,,, it is possible for block F to call blocks A, E, or .-, and for it to use data declared in blocks F, A^ or E. generally, however, a program with a similar structure will not call every possible block which is accessible to it. Since a call to a block or data may be conditional, it is impossible to guarantee that a block will be used. But if no call is made to a block, the compiler will know wi tn certainty that that block will not be called. Therefore, it is advantageous to have the compiler prepare a list of segments that tne original segment may call, This list of segments is called the Associated Segment List (ASL). The as- sociated segments will be kept in tabular form. When the segment to be run is loaded into core, an interrupt for l/O could be delated if the Associated Segments are also loaded. The ASL is stored in the SD I„ Two bytes are used for each Associated Segment .AS yielding a pointer to tne appropriate entry in the 3D If the AS is from a different program, then the alphanumeric name is stored in a section of the SD J „ Six bytes immediately before the first byte of the alphanumeric name are reserved for the program name, the segment number, and the point of entry to the segment. Tirie entry in the ASL is a two-byte numcer pointing to the first byte of this s-ix-byte number, 22 Associated with each two-byte entry in the ASL are two flag bits. These will be coded as follows: - AS from this program- -another entry in ASL 1 - AS from another program- -another entry in ASL 1 - AS from this program- -last entry in ASL 1 1 - AS from another program--last entry in ASL h . 5 The Loading of th e Vari ous User Tables Before a program receives execution for the first time, the various SB's '.from the calling program and the associated programs) are brought into core, The FSNTs of the respective programs are then read into core. The alphanumeric names of the AS ■ s from different programs are stored in one section of the SD I so that they can be reached easily during this initialization process. The FSM and Active Program Table are used to fill in the six bytes concerning the Associated Segment, If the A3 actually turns out to be several segments, for example, a call is made to an entire program consisting of several segments, then one of the six flags is checked and a pointer is made to a list of AS f s„ This list is inserted in the SD I. Since this list is added after the SD is formed, it may be advisable to form at least part of the SD I at the end of the SD, It would then be possible to expand the SD ] and thus the SD, by copying the SD into a larger block in core . . When the program is completed, it is not necessary to erase the program number from the SD because a copy of the original SD is kept on the disk. Therefore, when a program is completed, the modified SD is destroyed. 23 5. DELEGATION OF CORE TO SEGMENTS 5 • 1 Splitt ing Core into Binary _S ize Blocks All of core will be broken up into blocks of binary size,, that is, blocks having 1, 2, h, 8,„„256 pages „ Thus there are nine different sized blocks „ The blocks of one size will be linked together, and a [31 table of pointers will point to the first entry in each list. Large blocks can be bisected forming two blocks one-half the original size Larger blocks are formed whenever two free adjacent blocks of the same size occur, or in the case represented by the graphs 1 n 2 n 1 n The three blocks will be combined tc form a bio k kry pages long, ^n is a power of two. If the segment is just under a binary size that is, the segment is 58 pages long then it will oe stored in the next larger size block,, 6k pages in this case. If the segment is slightly larger than a binary size, for instance 66 pages then it is put in a block of 128 pages, but the remaining 62 pages are broken into binary sizes and put in their respective lists.' for example, the 62 will make one 32-page block, one 16-page block- one 8 -page block, one U-page block and one 2 -page block, A critical size is one m which any segment larger than that size 24 will not store the remainder and below tnat size will store the remainder of the block,, Naturally, when the 66 -page block in this example becomes free it will be broken into a 64-page dIock and a 2-page block. After a short time, the system could stabilize with many short blocks. Then when a large segment is to be loaded, there would not be a block large enough to hold it. In this case, two alternatives are 5sible One is to partition the segment and place it into many small blocks : The value of the BP is equated to the number of the page contain- ing a map of the locations of the other pages of the segment. This method, called the "partition mode," would double the access time since it is necessary to check the map and then go to that location. Each page in which the segment is stored could be at any location of core. 5.2 The second solution, and the one normally used, is to consolidate all of the active code at one end of core leaving a large free block at the other end, This action is called a 'core collapse". For this pur- se the core map is Lnde: of th location of all segments currently in the core 1' a core collapse is necessary the entries in the core may be sorted according to increasing core locations. Then it is easy to determine in what order the segments are to be moved, Since system procedures, library procedures,, and other segments may be used by more than one Taxacrinic Processor TF at the same time, the core map is checked to see if a particular segment is already in core. If one TP is using the segment, the TF counter is set to one. See Figure 5 = 25 k bytes h bytes 2 bytes 1 byte 1 byte TP Segment Number HIP/LOP Lore Location Page Count i Counter 'Figure 5- Entry in Core Map If another TP wants that segment, the TF counter is increased by one. When a TP no longer needs the segment, the TP counter is decreased by one. Only when the TP counter is zero can the segment be copied over. The structure of the core map will us 3 Binary Chop Pointers (section k.2). If an entry is removed, an empty location will be left. Empty locations are linked together and a header points to the first entry of the free list. A pointer in a Segment Directory gives the location of a segment in the core map. Since the segment could be removed and a new one inserted in the location of the core map, the segment number should be checked to see if the segment number is correct. Since each segment is piaced at the top of a page, only two bytes are needed to give the core location for the segment, and one byte for the page count. 26 6, SCHEDULING MODULE 6,1 Local and Glob al Scheduling The Scheduling Module allocates system resources to user- specified tasks, A task may be the execution or compilation of a program, or transmission of data requiring storage. In short, a task is a user-specified process requiring an allocation of the resources of the computer system. Manufacturing processes have been studied to gain insight for scneduling computer tasks, A simple scheduling problem of the type an industrial concern could face is one in which five items are to be produced, each item requiring one operation on five different machines. The time taken for each manufacturing operation is known and, therefore, an optimal sequence of operations is sought for which the overall time to produce five items is least. However, there are 25 billion possible sequences, and a consecutive search by a computer would take eight centuries to find an optimum sequence. The above problem is normally not considered in an industrial concern, because an industrial plant is rarely concerned with finding an optimum sequence that minimizes production time. Instead, the industrial scheduling problem is usually separated into two areas. Global and Local Scheduling,, ' global Schediling deals with message handling, accepting or rejecting new job orders 'tasks', and serves as an information service between customer 'user) and company \ system). It also assigns the deadline for an order, but it cannot guarantee an early deadline of an 27 item ( task) unless its production is consistent with the sequence of present job orders ( tasks ) Local Scheduling handles resource coordination, processor al- location, directory allocation, storage allocation, channel allocation, and user allocation. The Local Schedular normally operates with a large backlog of orders to process and thereby can keep each machine (subprocess) reasonably busy processing some order „ Continuous operation of each machine is not guaranteed, but the large job queue and long deadline normally assures that each machine can be kept occupied without considering a complex scheduling algorithm,, 6,2, Global Scheduling The Global Schedular of the Time Sharing System is patterned after a scheduling procedure which could be' used in industry, A diagram of the Scheduling Module is giver in Figure 6, En a factory, the sales department accepts or rejects job requisitions and establishes deadline times for the accepted job orders depending upon the demand on the production department . Shipping is responsible for dispatching completed orders and checks to see if tne deadline times are being met, If they are not, then Shipping notifies Sales. Production and tne client. En this way Sales and Production can modify their behavior to minimize the production scheduling problem, 6,2,1 Man/Ma cn ine jCommuni ca t ions JVIod ule The Man/Machine Communications Module serves as tne communi- cation interface between the user and the Global Schedular, 28 Production Man/ Ma chine Communications Module Resource Coordination Procedure Allocation Directory Allocation Storage Allocation Jhannel Allocation User Allocation J Jons^es Figure 6, Scheduling Module Local r Scheduling "^ Global Scheduling J 29 6 , 2 „ 1 . 1 Cons ol e Messag e Center The Console Message Center has two major activities:: polling consoles for input (2) dispatching messages from the Global Schedular to consoles. Input and output to low speed devices such as Teletype consoles are buffered in the Low Speed Buffer { LSB I „ a small core memory with associated control circuitry. Characters of a line of input are packed into separate sections for later retransmission to main core. Output data is collected into a block of main core, subsequently transferred to the LSB, and finally sent out serially by the designated terminal by the LSB control, 6 . 2 „ 1 „ 2 Mess age Scans. The Message Scanner performs three functions; (I; Empties the polling buffer Edits input lines 3? Scans input lines for special begm/end -of -message characters. The Message Scanner is called when the polling buffer is filled to a predetermined level or by a clock interrupt. The data is then sorted into individual user's buffer areas. 6.2,1.3 Task Request Sea n ne r The Task Request Scanner is a collection of procedures which decode messages. Messages or task requests are of two kinds: 30 ( l) quick reply requests such as LOGIN, LOGOUT, and program status inquiries which are processed entirely by Sales or Shipping 2} requests (for example COMPILE, EXECUTE'* which require production, in other words, must be routed to Local Scheduling , For each task request, the decoding procedure inserts an entry into the Common Task List. 6,2,2 Sales Sales checks new user requests for legality in terms of user name, aser identification., department, etc. If the task is legal, Sales removes the entry from the Common Task List. If the task request requires only a short fix-up procedure to generate the reply, the procedure is called and processed, and the reply is returned to the user. If the task requires production (that is, it cannot be satisfied by a snort procedure) , then the task is transferred to the User's Task List to await Global Scheduling. Tasks requiring production are accepted or rejected by Sales depending upon the current demand on Local Scheduling. Sales may maKe suggestions, such as to use smaller segments which could make a task acceptable. Sales establishes the starting time for each task. For example, consider a program with the following structure: D 3i Figure 7. Program Using Parallel Processing Here independent blocks B and C use data produced by the execution of block A, Block D uses data produced by A , B, and C. Accordingly, block A mast be executed first followed by block B or block C, and finally block D„ In a multiple process computer, blocks B and C could be executed simultaneously by different Taxicrmic Processors , En general, Sales specifies when a task may begin, that is, B and C may begin after A has been executed and D may begin after A, B, and C are completed The user mast provide Sales, via the Man/ Machine Communications Module, witn the above information; otherwise the sequence of blocks will oe executed serially. In the former case, each block is considered a separate task and is assigned a unique Task Number -'section 6,3,1,1', The TasK. dumber is equivalent to the Active Program Number (section hj. „ Consequently, each block must be considered as a separate program. When a program is split into several sub-programs for the purpose of parallel processing, there cannot be any loops connecting the sub -programs. 32 If a task is accepted by Sales and its starting time has been reached, it is transferred from the User's Task List to the Active Task List (ATL) . The ATL forms the bridge from the ilobal Schedular to the Local Schedular, A User's Task List may expand after processing one task. For example, a COMPILE entry may result in specifying several sub-tasks requiring execution, 6 , 3 Local Scheduling The Local Schedular of the Time Sharing System, like that of the industrial concern, normally will choose tasks to be processed from a larger background set of tasks , The Local Schedular takes tasks off the ATL and inserts them into the Cycle Table, The Cycle Table holds all tasks which are in the process of being executed. Tasks that are to be entered into core are placed on the .Next Task List by the Local Schedular, The primary concern of the Local Schedular is to make efficient use of core storage , The initial size of core for [Iliac III is rather small which forces considerable rationing of core among the various TP's. Some tasks may need as much as one -half of core Therefore, a task of this variety must be executed when other TF ; s are executing pro- grams needing much less core. Consequently, the Local Schedular has been developed with the objective of providing room in core for very large tasks, and still effectively employing all four TP's, This does not imply that 33 other resources are neglected in the scheduling, but they are dealt with under the philosophy that the system should not be so overloaded that optimization is necessary c 6 . 3 . 1 Active Task List An entry on the Active Task List consists of a doable word with four half-word fields . Task Size <*— □ □ Link to Next Entry Task Number Task Type Task Priority Figure 8 : Active Task List 6.3,1.1 Task Number The Task Number is identical with the Program dumber. If several programs comprise one task., the Task Number will be the Program dumber of the first program of that task to receive execution 6.3.1 2 rask Size Each task falls under one of the four size categories? 3 < 3 < S < 3, . The actual sizes of the size categories are parame- 12 3 4 & -ti- ters that mast be adjusted. The following may be the first estimate 3'-+ S = 1/16 core = 64 pages S '1/8 core = 128 pages S = l/h core = 256 pages 3, = 1/2 core = 512 pages The size of the task is placed into the field Task Size which is made from the two flag bits of the Task Type field, 6.3.1.3 Task Type Large tasks take more time to be loaded than small tasks. If continuous storage in core is needed a core collapse may be necessary, (See section 5»* Once a large task has been entered into core it should receive an execution time that is longer than average. Cor- respondingly, small tas'K.5 cannot be given an equal time slice because if all tasks were given the large time slice, system response would be very slow. The actual amount of time given to a task may be a function of tne operating conditions,. Therefore, a code is inserted into the field Task Type which is used in computing tne time. 6 „ 3 . 1 . *+ Task Pr_ipr ity All tasks receive a finite, but not necessarily equal, n lumber of turns in one cycle. The total length of time a task receives in one cycle is a function of the user's status., for example, professor, student, etc. and/or of the importance of the program. A code inserted in the field Task Priority is used to give the total amount of time a task receives during one cycle. Thus a small-sized 3*5 task with high priority may receive a large number of turns in one cycle. A low priority task which is very large will probably receive a large time slot, but may receive only ore turn in any given cycle. 6 . 3 . 2 Cycle Table Before a task is executed it is transferred from the ATL to the Cycle Table. The Cycle Table consists of four lists, each cor- responding to one of tne four size categories S n , S , S , S . & 1 2' 3 4 The format of the Cycle Table is as follows: Headers L. ^H Cycle Table Entries Figure 9. Cycle Table and Headers Even though the Cycle Table consists of four lists, the word '"Table" is used because the headers are stored in consecutive words. Each header consists of two pointers., one pointing to the first entry on the list and the other pointing to the next entry to be processed. 36 Each entry on the Cycle Table is composed of two double words with eight fields. Task Size □ Out Flag Q Q Link to Next Entry Task Number Task Type Task Priority Time Slice Fre- quency Time Slice Count Down Frequency Count Down Figure 10 . Cycle Table Entry The Task Number. Task Type, Task Priority, and Task Size was explained in section 6.3. 1 6,3.2.1 Time Sli ce and Fre q uen cy_ The Task T \£e and Task Priority are used by the procedure called Time in conjunction with a table used to find the Time Slice and Frequency. The table is a function of the current scheduling demand. The Basic Time Unit (BTU' is a quantum of time measured by the computers clock. The value of Time Slice (SLICE) is the BTU multiplier for that task. The actual amount of time a task receives during one turn is denoted AAT „ Consequently; A AT = SLICE * BTU Frequency '.FREQ^ is the number of times a task is executed during one cycle „ The total amount of time a task receives during one 3 7 cycle is denoted by TAT. Therefore, TAT - PREQ * AAT -. FFEQ * SLICE * B The TAT for task a is denoted TAT (n , The total length of time to complete one cycle is called CYCLE TIME, The total number of tasks in the Cycle Table is H, consequently 9 N CLE riME -- I ,TAT n n=l Normally, instead of catting down the values of the Time Slice or Frequency new tasks are simply not accepted if the CYCLE TIME is too long, 6,3.2.2 Cou nt Do wn There are two Count Down fields in a Cycie Table entry. Time Slice Count Down (TSCD) and Frequency Count Down (FCD) „ The TSCD is decreased by one each time a BTU is reached. When the TSCD becomes zero, the task's turn is complete, and execution is transferred to a new task. If the task is interrupted for I/O and the task is removed from core, then the value of the time remaining is stored in the TSCD, When a tasK. receives a complete turn, that is TSCD = 0, then the FCD is decreased by one. When the FCD becomes zero, the Out Flag is checked and the task receives no more tarns daring that cycle, If a new task is inserted into the Cycle Table after the beginning of a new cycle, then the value of the FCD is scaled down by the fractional part of the Time Cycle already elapsed. Thus, if one- half of the cycle time has elapsed, then the FCD is scaled down by a factor of two. 38 New tasks are inserted into the position of the Cycle Table where they will be chosen as soon as their respective size is called „ This allows tasks which may be completed in one turn to be removed from the Cycle Table, which prevents it from becoming unduly long„ 6,3,3 Next Task List The Next Task List (NTL) is a list of tasks that are to be loaded into core by the Storage Allocation Module, Each entry in the NTL is identical with its corresponding entry in the Cycle Table. When the number of tasks in the NTL reaches some minimum length, the Cycle Table Scanner is called to add new entries to the NTL. Upon first consideration, it seems that a linear programming routine should be used to determine how to choose tasks from the Cycle Table . The current amount of core available plus the size of tasks currently awaiting execution should determine how to choose the appropriate size of tasks to be executed next. However, a linear programming routine would take almost as much time to execute as a Time Slice itself (approximately 1/10 second}; therefore, a Combination Table is used, The Combination Table gives the combinations of task sizes that can run together. It is assumed that one TP is continuously processing systems' procedures, The other three TP : s could each be processing a task, and in addition, one task could be entering core and one could be leaving core. Therefore, a minimum of five tasks should be in core at one time, A combination of five tasks that can run together is placed into the NTL at one time. As stated above, the actual amount of core allocated to the various S sizes must be determined after the system is operational. 39 The first estimate of the size categories is: S -- 1/16 of core S a 1/8 of core S = l/U of core S, a 1/2 of core Assuming that tre system occupies 1/4 of core, then 3/ 4 of core is left for user programs. □ □ n □ 4 1 2 1 2 4 1 1 3 1 -) 2 1 3 1 1 3 i S 2 S 3 s * Borrow Flags Figure 11. Combination Table The Combination Table shows that one S, will fit with four J 4 S, 's. Only six combinations need to be shown since any combination of five S ' s or S ' s would fit in 3/ 4 of eore The Combination Table 12 ' only guarantees that core space is available, but free core is not necessarily in continuous storage, and a core collapse may be necessary The Combination Table shows what combination of five tasks can fit into core, but does not guarantee that groups of five, when overlapping, will fit into core,, Assume that two groups of five tasks are in the NTL - ko 11111 22222 ti m i-p m m m rp'- rn 1 - m'- m 1 - • 1 ]_J x 2' V l\ } S 1' 2^ V 4' 5' 112 2 2 There is no guarantee that T, , T,_ s T n , T_, T„ will fit into & 4 5- 1' 2 } 3 core since the Cycle Table was not designed to handle the overlapping of two groups . Therefore, a buffer of two S tasks precedes and follows each group of five. Groups of seven tasks are added to the NTL at one time, that is, the group of five in the Combination Table plus one S before it and one after it. The tasks in the group of five will be arranged so that the largest task is in the middle. Assume an S, task is to receive execution. Then a portion of the NTL is as follows: s s 1 1 t s i \ s i S l 1 S S 1 1 Buffer from preceeding V Group of 5 Buffer from following group | group _J V Group of 5 with buffer In this example four S tasks precede and follow each S. task, The poorest combination is the one which contains an S, task and by extension other cases will also work under this scheme. As can be seen from the table, there must be many more S tasks than larger tasks. It is assumed that most tasks, possibly after compilation, will fall into the S or S category. However, 41 during one cycle all S and S tasks may complete their turns before the S and S, tasks complete theirs,, "f this happens., then a Eorrow 3 4 Flag is checked and tasks from the S list can be used which must normally wait for the next cycle,. The use of the Borrow Flag is necessary because when tne values of the Frequency Count Down for the S and S tasks finally become zero, then tne next cycle is started without giving the S or S tasks further scheduling, 6 , 3 • ^ Many Combination Tables In Figure 11, it was assumed that 3/4 of core was available for user programs. The core is used as an I/O buffer and some tasks will take more time than others „ Therefore, several Combination Tables are used possibly as many as l6„ The Combination rabies can accommodate a core of various sizes from 1/6 of core, 1/8 of core, 1/4 of cere, 5/6^ „ „ .7/8 of core. When the procedure that scans the Cycle Table is called, the projected availability of core is studied by using the list jailed Busy in order to find the correct Combination Table, An S. task will probably have a larger Time Slice than an S . task, therefore, a group of sever, tasks following a group containing an Si task probably will not have as Larj,e an area of free core at 4 its disposal, Tne Busy list contains the Time Slice of all tasks and a similar quantity for I/O buffers. Each time a BTU is reached, each entry in the Busy List is decreased by one, A task could terminate before the Time Slice is completed, thereby, the Busy List would indicate that core was filled when in 42 actuality it was not. As scon as a task terminates prematurely , its entry in the Busy List is removed, but since the Busy List is used to calculate future availability of core, the information of removal would come too late. Therefore, this scheme using the Combination Table and Busy List does not guarantee that some core space is not being wasted ; but will guarantee that core space is available when a task is to be loaded. As was indicated before, this is most valuable for S, tasks h which take up to l/2 of core, 6 . 3 . 5 Method of Scanning Cycle Table At the beginning of a new cycle each S, task receives one turn. It may not be possible to choose an S task during each group since the free core may not be large enough. After each S. task has received one turn, then each S task should receive one using the second and tnird row in the Combination Table 'Figure 11 . After all S and S, ' 3 4 tasks receive one turn, S tasks begin to receive tneir second turn and this process continues in this fashion until the Out Flags of all S and Sl tasks are checked. If, by this time the S and S„ tasks are not in the borrow 1 2 phase, they are executed until all Out Flags are checked, 6 . 3 . 6 F uture Developments The above scheme could be a first implementation of the system. A more involved method will be presented below: The Secondary Storage will probably consist of one or two drums and possibly eight disks. Each disk has two reading heads giving, in effect, l6 disks, or eight disks for each drum. Assume that the drum access time is ten times faster than the disk; then all eight disks could transfer information to the drum simultaneously if the core is used as a buffer. One page in core for each disk is needed to time share the channel. The scheduling scheme becomes more complicated because it would be necessary to place tasks on the Next Task List from seven different disks. A three -dimensior.al Cycle Table would be necessary. For each S size, several lists are necessary. Each list would be for a different drum, it would be necessary to find which disk contained the fewest entries cf a certain size before unloading the drum. Also, a complicated procedure would be necessary to choose the next task from the various sizes and drums, since net only is it necessary to choose tasks from each size category, but also from the various drums. After the initial scheduling scheme is implemented, this more complicated method could be developed. 7, THE HANDLING OF TASKS 7.1 Task Interruption When a task has used up the time allotted to it, the TSS must interrupt the TP so that control can be transferred to a new task. An order, called STORE ALL, will be used for this purpose. Essentially, the values of the PR's, BR's, and other TP registers will be stored in the Operand Stack of that program,, When items are entered into the Operand Stack (OS), they are stored in continuous storage in core Each item is inserted through the Top of the Operand Stack (TOS), but in reality, the hardware will move the TOS to allow for the continuous storage of data. When an order STORE ALL is called, the PR's and BR's are pushed into the OS and then the Absolute Address (AA) of the TOS is stored in a predetermined location which we shall call LOC , When an order LOAD ALL is given along with the AA of the LOC, the reverse occurs and the PR's and BR's are loaded with their previous values. If the segment is moved after an order STORE ALL : for example, the segment is taken out of core and then returned, then the value of LOC is not useful since the OS has been moved. The OS is stored in the segment with which the PR 13 is associated, The PR 13 is a fixed distance from the TOS and from this information, the number of the BR associated with this segment can be read from the flags of the PR 13. The BR will give the address of the top of the segment containing the OS, Subtract this address from the value of LOC and the difference is the relative distance of the TOS from the top of the segment, The segment number and this relative dis- tance are stored in the SD I „ When the task is reactivated, the new AA of TOS is computed from the relative distance computed above and the new value of the top of the segment containing the OS. The new addresses for the BRs are stored in the respective position from TOS and the order LOAD ALL is given., 7 „ 2 The Choice _of_Sejgment s It is tne purpose of the SAM to load into core the appropriate segments of each task on the NrL It is expected that Tlliac III will eventually have a large slow core„ A slow core has a longer access time and its primary function is to store frequently -used segments such as system procedures, and is to be used as a buffer area for in- formation being transformed between the Secondary Storage and the fast core, where all execution takes place,, Initially, however, the system will possess a drum rather than a slow core „ A task will first be brought onto the drum, and when there is room, into the core. When a task is to be brought into core, the first segment to be executed,, called "main", has its segment number stored in the SD I„ The SAM will compile two lists containing this segment plus some of the associated segments, It is assumed that tne drum will be larger than core. Therefore, more segments could be brought onto the drum than could be put in core G The SAM will compute the input list wmcn is a list of segments to be put on the drum, and the execution list which is a list of segments to be put in core. 46 The total length of segments making up an execution list will fall into one of the four size categories „ The SAM will determine what size a task must be and then it will choose the main segment, plus as many associated segments as are needed to make up that size category, The length of the input list would be proportionately larger than the execution list, and would therefore contain a few more associated segments . In the example presented on page 5 (Figure l), segments B, C, and E are associated with A „ Segment D is associated with C, and F with E, and G with F„ If A is the main segment, then the input list would be made up from A, then B, C, and E„ If there is still more room in that task's size category, then D and F are loaded, and in the next stage G is loaded. This procedure thus provides a sequence of nested associated segments. If in the process every segment in one level cannot be loaded, for example, B, C, and E cannot all be loaded along with A, but only one of them, then it would be convenient to load the segment that is called most often. Every time an execution segment is called, a counter for that segment will be increased by one or this may be done by a hardware bit. This means that tne system must be called each time a transfer is made, but except for two cases mentioned below, this is necessary for other reasons. Consider an example of a task with the following diagram" U7 A B lo D E Figure 12. Another Program B and D are Associated Segments (AS ! s) of A; C is an AS of B and E is an AS of D. Also assume C and E nave the same PR assigned to them, If A, B, C, and D are each assigned a PR and BR and E is put in core but not assigned a BR, and if E is called from D, then an incorrect transfer is made to C. Therefore,, each time a change of segments is made, tne system is called and a cneck is made to see if the flags in the PR and the value in the BR correspond to tne segment being called, Tn two cases the system would not have to De called and this makes it impossible to count the segment being called. Phis situation occurs when a data segment or a procedure segment,, a segment containing procedures, is accessed. A procedure is called similarly to the way a block is called, but when leaving the procedure, a returr is made back to the block and thus to the segment that called tne procedure. In the usual case., the return is made to the next order following the one that called the procedure. In a similar manner, a procedure can call another procedure, and when both procedures are completed, a transfer is made to the calling position in the original segment. If a particular segment calls only a small number of data segments and procedures which are contained in segments other than the calling segment, then it is not necessary to call the system each time one of these transfers is made. There are 13 PR's available to the user, but only seven are allocated for use in the segment. For example, some can be used for push-down stacks within a segment which leaves 6 PR's available for accessing a data segment or a procedure segment. Let us assume that a segment calls six or less data segments and procedure segments. Then a BR and PR is assigned to each of the segments, and when a transfer is made to that segment, a permutation is made in the case of a procedure segment, or a direct access to a data segment is made, and execution can be continued without calling the system. When a transfer is made to another major segment, the system must be called. When a task is compiled, the compiler will thus assume that when a particular segment is in core, then its data segments and procedure segments will also be in core. However, limitations of available core size may prevent tne loading of all the above- mentioned segments. The following information is used in solving this problem: Two of the flags in eacn of the BR"s contain access information about the segment which the}- control. If the combination No Access (0,0) is set, no access is possible witn that BR„ Therefore, 49 if a data or procedure segment cannot be loaded, the access bits in the BR associated with that segment are set to 'No Access' and the system will be called., The system would tner load the appropriate segments. Since the system is called if an associated data or procedure segment is not in core, a counter could be used for the appropriate segment, If a choice must be made as to which data or procedure segments should be loaded, the segments having the highest count would be loaded first. [f there are more than six data and procedure segments called by a main segment, then five of them could be accessed without calling the system, and the others could share the last JR. To access one of these segments the compiler will insert a call to the system to load the FR and PR with the appropriate information so that the correct segment is accessed. The most important Associated Segments are the data and pro- cedure segments. Since all the flag bit values are taken as explained under '-+.U, a different partition ^s .-.ecessarj to distinguish between data and procedure segments and other procedure segments. Two bytes containing the number zero will be used for this purpose. : first entries in the Associated Segment List (ASL) will be the associated data and procedure segments; then the two-byte partition, and then the other associated segments. If there are no associated data and procedure segments, then the first two bytes become the zero partition. If the only Associated Segments are data 50 and procedure segments „ then the last entry in the ASL would contain the necessary flag bit information signaling that no more AS r s follow. In this case the zero partition would not be needed,, 7 o 3 Ping Pong Lists If a call is made to a segment that is not in core but is on the drum, the task is put on the Ping Pong List I {PPL l)„ When this occurs, control is given to a different program in core. If no program is there, it must stand idle. One or more segments of the program are transferred to the drum and the segment that is called is transferred to core. When the exchange is completed, control is given back to the program. As was noted in section 6.3=3 at least five tasks are to occupy core at one time, but the Storage Allocation Module will continue to load core with new tasks as long as there is room. Since an S task preceeds and follows every group of five, quite often there will be more than five tasks in core, and when an interrupt occurs., it may be possible to switch, to another task. If a call is made to a segment that is not on the drum, then the task is put on the Ping Pong List II -PPL II ' i this case, every segment of the task is copied onto the drum, and a different task, is put into core to replace it. Because of the problem of relative sizes explained above, the SAM would not know when to run this task again since this is the function of the Schedular Module (SM) . The SM will give a task on the PPL II top priority by changing its position in the Cycle Table so that the task is chosen as soon as 51 its respective size is chosen. Rearranging entries in the Cycle Table is not difficult since it is made from a list structure. Since it is not known when a task on will be run, a copy of it will be transferred to the Secondary Storage „ As long as there is room on the drum, no other segments will be written over a tasK on the PPL IT because the SM gave this task top priority, and therefore, it Wwuld be placed on the NTL shortly. Fowever, if tnere is nc more room en the drum, then the task must be written over which explains why the copy is transferred to the Secondary Storage, If it should happen, however, that the task appears on the NTL before the task is destroyed, then only the new segments need to be loaded o It is very likely that many of the segments that were in core would have to be loaded again „ If there are several entries on the P.PI II, then a decision must be made as to which task is to be written over first c As soon as an entry is placed in the PPL II, the input list for that task is compiled. If most of the segments on the next input list are the same ones as those already on the arum, then the task is given a high status and is one of the last to be written over If there are few segments in common, a low tricrity is given, and if every segment on the input list is different I on the drum, then the task is not put on the PPL II, but is simply copied into the Secondary Storage, T . ^ Old Task Lists The Old Task Lists ' and EI are similar in purpose to the FPL II. When a task has completed a turn, it is copied into the 52 Secondary Storage as soon as possible, but as long as there is sufficent room in the core or on the drum,, it is not written over. Most of the other tasks in the system will receive a turn before the first one gets another turn, and with a small core and drum the task would be written over in most cases. But at certain times of the day, there may be so few tasks in the system awaiting execution that every task may fit into core or at least on the drum at the same time. Old Task List I (OTL l) is a list of all tasks that have received a turn and are still stored in core. The Old Task List II (OTL II; is a list of all tasks that have received a turn and are still on the drum, In general, the OTL II will be much longer than the OTL I and usually the OTL I will be empty when a small core is used. Systems with a very large fast core will make much use of the OTL I„ An entry either on the OTL I or OTL II will be the Task Number and a pointer to a list of segments comprising the old tasks. This list will be in the SD I . All tasks, after receiving a turn, will be placed on the two : "s except when the task is completed or is a Ping Pong task. The tasks that would be removed first from either list would be the ones that were added last. This leaves the oldest tasks on the list since generally they will receive a turn again before the more recent ones. If one or more segments from an entry in an OTL are copied over, but not every segment making up that task, then the task is left on the OTL: however, a flag is set indicating that some segments are missing. If this is the case, and that task is to receive another turn, then the SAM must compute an input list and load the appropriate segments . 53 Tf a tasK on the OIL ! is to receive another turn, the '"lore Map should be checked to see if the segments are still in core. If a task is taken off the OTL s„ then the SAM will compute an input list for the task for the next time that it is to be run New input and execute lists are created instead of loading the previous segments for the reason that follows, Consider a program with the following structure: T f the TP Counter in the Core Map at one time had a maximum value of two or more and finally became zero, then the segment would be referred to by two or more entries on the OTL [ , If more room was needed in core, one of the old tasks would be removed, and .the segment would be written over. Some other old tasks also refer to the segment as being in core, For this reason whenever the OTL's are used, a check should always be made to the Core Map to see if the segment in question is actually in core. A L~ LI u. Figure 13. Program Describing Old Task Lists 54 The first time the task is to receive a turn, the segment that is to be executed first may be block A, Then the AS's would be B, E, and F. After the first turn, the processor could be executing in B. In this case, the AS's would be A, C, and D If no segment was removed from the PPL II then it would be advantageous to reload the task into core and execute it until a Ping Pong task occurs. 7.5 Determination of Size for Following Run Immediately after a task has received a turn, a partial input list is compiled,, Two numbers would be computed, one of which is the number of pages of the next segment to be executed, and the other the length of this segment plus the length of the associated data and procedure segments. These numbers will be made available to the SM„ The first number would be the absolute minimum amount of storage needed when the task is to be executed in its next turn. The second number would be the preferred minimum amount of storage for the next turn. If more storage were made available,, more Associated Segments could be loaded. The Sales Procedure of the SM would use these numbers to determine what size the task is to be. 55 8 . SUMMARY The basic unit of code that is manipulated by the Time Sharing System is the segment. In section 2, the reasons for segmenting a program have been discussed. Section 3 tells how the segments are easily manipulated with the hardware of Illiac III. In section k, the many tables necessary to store the segments in the system are presented, and section 5 tells how core is delegated to the segments . Since the Scheduling Module, and especially the Local Schedular, is directly concerned with Storage Allocation, section 6 explains the Scheduling Module. Section 7 deals with the problem of how the Scheduling Module and the Storage Allocation Module are interrelated. 56 LIST OF REFERENCES [l] PL/l: Language Specifications , IBM System Reference Library, File No, S360-29, Form C28-657I-3, [2] Bottenbruch, H,, "Structure and Use of ALGOL 60," Journal of the ACM, Volume 9, Number 2, (April 1962), pp. l6l-221. [3] Knowlton, Kenneth C, "A Last Storage Allocator," Communi cat ions of the ACM, Volume 8, Number 2, (October 1965), pp 623-625. [h] Pounds, William F„, "The Scheduling Environment," Industrial Scheduling , edited by John F„ Muth and Gerald L Thompson, Englewood Cliffs, New Jersey: Prentice Hall, Inc., 1963°