Abstract:
A plurality of queues where each queue is defined by a set of criteria, the queue system comprises a plurality of header registers where each header register defines a queue in the queue system and a plurality of task registers where each task register can be associated with each queue in the queue system. Each header register has a unique address and contains a previous field and a next field. Each task register has a unique address and contains a previous field and a next field. Each previous field and said next field stores the address of another register in a given queue such that each queue is formed in a double link structure. Control means is provided for dynamically assigning task registers to queues by controlling the addresses stored in the previous and next fields in each header and task registers such that each of said task registers is always assigned to a queue in the queue system.

Description:
A portion of the disclosure of this patent document contains material which is subject to copyright protection. The copyright owner has no objection to the facsimile reproduction by any one of the patent documents or the patent disclosure as it appears in the United States Patent &amp; Trademark Office patent file or records, but otherwise reserves all copyright rights whatsoever. 
     CROSS-REFERENCE TO RELATED APPLICATIONS 
     The following copending U.S. patent application is assigned to the assignee of the present application, is related to the present application and its disclosures is incorporated herein by reference: 
     Ser. No. 08/006,457 filed Jan. 21, 1993, now U.S. Pat. No. 5,355,486, by Stephen R. Cornaby and entitled SYSTEM FOR ALLOCATING TASKS BETWEEN TWO ACTUATORS SERVICING THE SAME MAGNETIC DISK MEDIA IN A SINGLE DISK DRIVE. 
     BACKGROUND OF THE INVENTION 
     1. Field of the Invention. 
     The invention relates to a system for establishing queues within a processing system and for the effective movement of data between the established queues. 
     2. Description of the Related Art 
     Many computer systems employ queues for managing the transferring of tasks and data within the computing system. Queues can be of many types, such as the first in first out queue (FIFO) where the entries stored in the queue are read from the queue in the sequence that the entries were stored in the queue. Another type of queue is the last in first out queue (LIFO) where the last entry stored in the queue is the first entry read out of the queue. This is to say the newest data stored in the queue will be the first data read out of the queue. 
     Queues have been constructed from hardware registers and from dedicated portions of a memory, acting as a software register, where the queue is operated under the control of a program in the processor. A queue formed from a memory is described in the text Micro-processor Application Handbook, Editor-In-Chief David F. Stout, McGraw-Hill Book Company, 1982. The author discusses in Section 17.6, entitled &#34;A Task-Scheduling Executive&#34;, the formation of a task queue using a forward linked structure. The forward link structure is formed by having each queue&#39;s entry contain a pointer to the address of the next queue entry. A queue formed by the forward link process will define the number and sequence of the registers in the queue at any given instant of time. Further, in many processing systems it is desired to move tasks that are defined as entries within the queue from one queue to another queue where each queue is used to specify a course of action to be taken with regard to the entries in that queue. Normally a task is removed from a queue and physically transferred into another queue. The movement of tasks between queues can be a time consuming process and subjects the task to errors generated during the transfer of the task, thereby requiring error recovery procedures to be invoked or attempt a retry transfer operation. 
     SUMMARY OF THE INVENTION 
     It is an object of the invention to provide a queue system for generating a plurality of queues where each queue can include any task registers in the system. 
     Another object of the invention is that the queues within the queue system are not limited to a fixed length. 
     It is another object of the invention to have a queue system which allows the queues within the system to be of various types of queues. 
     It is another object of the invention to structure the queues in the queue system using a double-linked pointer structure where each register contains a pointer to the previous and next register in the queue in which the register resides at that instance in time. 
     Briefly, this invention is directed to the formation of a plurality of queues from a dedicated set of memory registers within a random access memory unit. The memory registers are either header registers or task registers. Each queue has a specified header register and those task registers assigned to that queue. A task register is always assigned to a queue within the queue system. All registers contains at least two fields, a previous field and a next field. For any register used within the queue system, the previous field will contain the address of the preceding register in that queue and the next field containing the address of the following register in the queue. One queue is designated as an empty queue which will contain those task registers which are not presently being used in one of the active queues in the queue system. Task registers are effectively moved between queues by changing the contents of the next and previous fields of the register to be moved and the next and previous fields of the other registers in the queue which will be affected by the insertion or removal of the task register to be inserted or removed from the queue. The task registers are not physically moved between queues but are effectively moved by controlling the previous and next fields of the register, thereby allowing the formation of pseudo queues within the queue system where the length of each pseudo queue is defined by the number of task registers linked to the header register for that queue at any given instant of time. A control means is provided for performing procedures for inserting and removing task register from queues. 
     Finally, the different type of queues may be included in a queue system. For example, one queue may be a first in first out queue, a second queue may be a last in first out queue, a third queue may be a queue ordered by address and a fourth queue may be a queue ordered by the contents of another field in the task register other than the next and previous fields associated with the task register. 
     An advantage of the present invention is that the queue system can be customized without requiring alteration to the hardware in the system. 
     Another advantage of the invention is that tasks can be transferred quickly from queue to queue without exposing task data to transfer errors. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     The invention will be described with respect to the particular embodiments thereof and reference will be made to the drawings, in which: 
     FIG. 1 is a high level drawing showing the processing system embodying the queue system of the invention; 
     FIG. 2 is a representation of a queue system configuration employing four queues; 
     FIGS. 3A through 3L are diagrams illustrating the movement of tasks between the queues represented in FIG. 2 in accordance with the queue system. 
     FIG. 4 is a flow chart of routine A for removing a task register from a queue. 
     FIG. 5 is a flow chart of routine B for inserting a task register into a queue in an ordered sequence using the example of ordering by task register address. 
     FIG. 6 is a flow chart of routine C for inserting a task register into a queue such that the task register will be in the last position of that queue. 
    
    
     DESCRIPTION OF THE PREFERRED EMBODIMENTS 
     Referring to FIG. 1, the queue system is embodied within a processing system comprised in part by processor 10, read only memory ROM 11 and random access memory RAM 12. Processor 10 communicates with ROM 11 via lines 13 and with RAM 12 via line 14. This general configuration of a processor, read only memory and random access memory, is widely used throughout the industry. The processing system is generally incorporated within a larger computing system and is dedicated to handling specific types of functions within the overall system. For instance, such processing systems are included within disk drive file control units, I/O channel control units, as well as within the main processing unit itself. The processor is running under the control of a system program which was written to enable the processor to perform its designed functions. 
     The queue system of this invention is controlled by processor 10 and uses RAM 12 for the actual formation of the pseudo queues. RAM 12 is structured to contain a plurality of storage addresses where each address includes a number of bits or bytes of data. The queue system requires that addresses within the random access memory be dedicated to the queue system for the formation of the pseudo queues within the RAM. Each of the addresses is considered to be a task register or a header register. Each header and task register includes at least two fields, a previous field and a next field. The previous field of a register stores the address of the preceding register in the queue and the next field stores the address of the following register in the queue. 
     Each queue is comprised of at least a header register. When a queue has no task registers associated with the queue, the header register for that queue will have the header registers own address stored in the previous and next field of the header register for the queue. Therefore the previous and next fields have pointers pointing to the .location of the header register for the queue. Each task register is assigned to a queue at all times. In the queue system one queue is designated as the empty queue whose function it is to contain the task registers that are presently not assigned to a task that is to be operated upon by the operating system. The queue system may have many different configurations and can be tailored to the needs of the designer. 
     FIG. 2 is a configuration consisting of four queues, 20, 21, 22 and 23, within the queue system for the purpose of explaining the preferred embodiment of the queue system. The configuration is comprised of queue D 23 which acts as the empty queue and which initially will contain all the task registers in the queue system. When processor 10 receives a task to be performed by using the queue system, the task is assigned to the task register having the lowest address in queue D 23. The queue is then removed from queue D 23 and inserted into queue A 20. While the task is in queue A 20 the system will perform various operations to determine what the task is and what resources and operations must be performed with regard to that task by the processing system. The processing system then makes a decision as to whether the task is to be processed in accordance with a first processing course associated with queue B 21 or a second processing course associated with queue C 22. The task register is then effectively moved by removing the task register from queue A 20 and inserting the task register in either queue B 21 or queue C 22. When the task is completed the task register is removed from queue B 21 or queue C 22 and inserted into queue D 23. The system has the further option that if the task need not be processed by the processing course associated with queue B 21 or queue C 22, the task register associated with the then completed task is removed from queue A 20 and inserted into queue D 23. 
     Referenced copending patent application &#34;System for Allocating Tasks Between Two Actuators Servicing the Same Magnetic Disk Drive in a Single Disk Drive&#34;, describes a dual actuator system servicing a single magnetic disk media. The queue system of this invention is employed within the microprocessor and RAM unit referred to therein. In Appendix A of this application and the cross-referenced application queue A 20 is the command queue, queue B 21 is the one channel queue where a task for retrieving or storing data onto the magnetic media will employ only one of the two actuators, queue C 22 is a two channel queue which uses both actuators in the performance of a command from the system with regard to the single magnetic media and, finally, queue D 23 is the empty queue. 
     The routines for inserted and removing a task into queue B 21, the one channel queue, is set forth in detail in the cross-referenced copending application and will not be repeated herein. For simplicity in describing the queue system of this invention queue B 21 will be designated as a queue which is address ordered. It should be understood that the queue system of the invention is not limited to the configuration shown in FIG. 2 and the designer of the queue system, in accordance with this invention, can have the queue system comprised of as many queues as the system designer wishes, where each of those queues can be ordered in accordance with the criteria set forth and controlled by the designer. Further, the addresses of the memory registers within the random access memory may be a single block of dedicated addresses or a plurality of blocks of dedicated addresses or addresses that are not consecutive. Again, which addresses and the distribution of those addresses within the random access memory is designer choice and the location of the addresses used in the memory is not critical to the queue system architecture. 
     In review, for simplicity in describing the invention, the task register in queues A 20, B 21 and D 23 are address ordered within the queue and the task registers in queue C 23 are ordered in the sequence of insertion into the queue. If the tasks in queue C 23 are serviced by using the task register address stored in the next field of the header register for queue C 23, then queue C 23 effectively becomes a first in first out (FIFO) queue. If the tasks in queue C 23 are serviced by using the task register address stored in the previous field of the header register for queue C 23, then queue C 23 effectively becomes a last in first out (LIFO) queue. It can readily be seen that the character of the queue is determined by the system designer as to how he orders the queues within the queue system and how he removes tasks from the queue. Once again the classification of each of the queues into a type of queue is not critical within the system except that one queue must be dedicated as an empty queue to ensure that all task registers associated and used in the queue system are always placed within one of the queues of the queue system. 
     Referring to FIG. 4, routine A is a procedure for removing a task register from any queue within the queue system. During a move operation for moving a task register from one queue to another queue, the move operation first executes routine A, the removal of the task register, hereinafter referred to as the current register, from the queue. To perform this removal operation routine A performs the following sequence of steps. Step 1 makes the address stored in the next field of the previous register, whose address is stored in the previous field of the current register, equal to the address stored in the next field of the current register. Step 2 makes the address stored in the previous field of the next register, whose address is stored in the next field of the current register, equal to the address stored in the previous field of the current register. In this manner the linkage between the task registers in the queue has been reestablished after the removal of the current register from the queue. It should be noted that no action at this time is taken with regard to the next field and previous field of the current register being removed as this will be addressed during the insertion routine of the removed current register into another queue. 
     Referring to FIG. 5, routine B is a process for the insertion of a removed current register into a queue in an ordered sequence using the example where the task registers are ordered in ascending order of the addresses of the task registers in the queue. This would be the routine followed when a removed current register is inserted into queues A, B or D of the configuration as heretofore described with regard to FIG. 2. In this operation it is required that the current register be inserted in the queue between the register having the next lowest address and the register having the next highest address than the address of the current register to be inserted in the queue. Attention must be paid to the circumstance that the header register may be one of the registers whose previous or next field will be changed by this procedure. 
     Routine B performs this operation by executing the following sequence of steps. Step 1 selects the header register of the desired queue into which the current register is to be inserted. Step 2 determines if the address stored in the next field of the selected register, which in the first instance will be the header register, is equal to the address of the header register. If the address stored in the next field of the selected register is the address of the header register, the routine will branch to step 5. If the address stored in the next field of the selected register is not equal to the address of the header register, step 3 is performed which tests if the address of the current register is greater than the address stored in the next field of the selected register. If this inquiry is negative, the routine branches to step 5. If the inquiry of step 3 is affirmative, step 4 is performed to make the selected register the register whose address is stored in the next field of the presently selected register and will return to step 2. The loop of step 2, step 3 and step 4 will be repeated until the loop is exited either from step 2 or step 3. When the routine exits from either step 2 or step 3, step 5 is processed. Step 5 makes the address stored in the next field of the removed current register to be equal to the address stored in the next field of the selected register. Step 6 then makes the address stored in the previous field of the removed current register equal to the address of the selected register. Step 7 then makes the address stored in the previous field of the register whose address is stored in the next field of the selected register equal to the address of the removed current register. Finally, step 8 makes the address stored in the next field of the selected register equal to the address of the removed current register. It should be noted that steps 5, 6, 7 and 8 may be interchanged except that step 8 must always follow the completions of presently step 5 and step 7. At the completion of step 8 of routine B, the removed current register will have been inserted in the queue and all task registers within the queue will be order in ascending address order of the task registers in the queue. 
     While Routine B has been described for the ordering of the task register in ascending task register address order, the ordering may be done by using data in an additional field in each header and task register in the queue system. When an additional field is used to determine the sequence of the task registers in the queue, Routine B would be modified in steps 1, 2 , 3 and 4 to determine the appropriate selected register in accordance with the data stored in that additional field being used for that purpose. Once the selected register has been determined then the current task register to be inserted is inserted by step 5, 6, 7 and 8 of Routine B. 
     Referring to FIG. 6, routine C is a procedure for the insertion of the removed current register into a queue where the removed current register will be inserted as the last task register in the queue. Effectively, the task registers are ordered within the queue in the sequence in which the task registers were inserted into the queue. Routine C performs this operation by executing the following sequence of steps. Step 1 selects the header register of the desired queue. In the queue configuration of FIG. 2, routine C would be performed whenever a removed current register is to be inserted into queue C 23. Step 2 then makes the address stored in the next field of the removed current register equal to the address of the header register. This will ensure that the removed current register will be inserted in the queue as the last register in the queue. Step 3 then makes the address stored in the previous field of the removed current register equal to the address stored in the previous field of the header register. Step 4 then makes the address stored in the next field of the register whose address is indicated in the previous field of the header register equal to the address of the removed current register. Finally, step 5 makes the address stored in the previous field of the header register equal to the address of the removed current register. 
     The registers in the queue are linked in a forward loop by the next fields in the registers and in a backward loop by the previous fields in the register. The use of the next field and previous field within each of the registers within each of the queues allows the system to proceed up and down a queue in an orderly fashion. The system may also access any register within the queue regardless of its position within the queue, according to the address of the register being sorted by the system. Again this allows maximum flexibility to the system designer who is designing the queue system to meet the needs of the system designer. If so desired, routines A, B and C may be permanently stored within the ROM 11 to be accessed by processor 10 whenever a move operation between queues is indicated by the operating system. 
     The operation of the queue system will be discussed with regard to the examples shown in FIGS. 3A through 3L. 
     LEGEND FOR FIG. 3 
     ADD Memory Address of Register 
     PF Field With Address of Previous Register in the Queue 
     NF Field With Address of Next Register in the Queue 
     TN Number of the Task Assigned to the Register 
     Q Queue to Which Register is Assigned 
     The figures each show four header registers having addresses A, B, C and D respectively. Address A is the address of the header register for queue A 20, address B is the address of the header register for queue B 21, address C is the address of the header register for queue C 22, and address D is the address of the header register for queue D 23. Nine task registers are shown having addresses from 1 through 9. Again there is no significance to the addresses selected for use in these examples and the addresses may be selected for either the header registers or the task registers in accordance with the criteria specified and used by the system designer. Each of the header registers and task registers have a previous field PF and a next field NF associated with it. Once again the previous field PF will have the address of the previous register within the queue and the next field NF will have the address of the next register within the queue. With regard to the task registers two other columns are supplied, the column labeled TN is used to identify the task that is assigned to a task register and column labeled Q is used to indicate which of the queues a task register is presently assigned. 
     FIG. 3 shows the relationship of the task registers and header registers when all of the task registers are assigned to queue D 23. As can be seen, the header registers for queues A, B and C in addresses A, B and C have each of the address of their own associated header register stored in the previous fields and next fields of their associated register. When the previous field and next field both contain the address of the header register, that queue is empty. Therefore queues A, B and C are empty at this time and all registers are in the queue D 23. The next field of header register for queue D 23 contains the address of the first task register in the queue at address 1 and the previous field of the header register for queue D 23 contains the address of the last task register in the queue at address 9. Hereinafter the task register will be identified by the address of the task register, for example task register 1 is the task register located at address 1 in the RAM 13. In task register 1 the previous field contains address D, the address of the header register, and the next field contains address 2, the address of the following task register in queue D 23. In task register 9, the previous field contains address 8, the address of the preceding task register in the queue, and the next field contains address D, the address of the header register. By observation, task registers 2, 3, 4, 5, 6, 7 and 8 each have their previous field containing the address of the preceding task register in the queue and their next field containing the address of the following task register in the queue. The header register for queue D 23 and task registers 1 through 9 are therefore interlinked to form queue D 23. 
     Assume that the operating system upon receiving a task will store that task in the task register whose address is stored in the next field of empty queue and then will move that register from queue D 23 to queue A 20. Assume that the operating system receives task A1 for processing. To perform the above described operation, the operating system would first store task A1 in task register 1 and then would execute routine A to remove task register 1 from queue D 23. Task register 1 will be the current register referred to in routine A and B. Routine B would next be executed to insert task register 1 into queue A 20 by sequentially executing steps 1, 2, 5, 6, 7 and 8. The results of the procedure are shown in FIG. 3B where task register 1, containing task A1, is in queue A 20 and all other task registers remained in queue D 23. It should be noted that the next field in queue D 23 now points to task register 2 rather than to task register 1. 
     Referring to FIG. 3C, assume that the system next receives task A2 which will now be stored in task register 2 in queue D 23 which will then be moved to queue A 20. After task A2 has been loaded into task register 2, task register 2 will be removed from queue D by routine A. Routine B will next insert register 2 into queue A 20 by executing steps 1, 2, 3, 4, 2, 5, 6, 7 and 8. The results of the procedure are shown in FIG. 3C. 
     Referring to FIG. 3D, assume the system next receives task A3 which is stored in register 3 in queue D 23 and then register 3 is moved from queue D 23 to queue A 20. Routine A will be executed to remove register 3 from queue D 23. Then routine B will insert register 3 within queue A 20 by sequentially executing steps 1, 2, 3, 4, 2, 3, 4, 2, 5, 6, 7 and 8. The results of the procedure are shown in FIG. 3D. 
     In summary, at this time queue A 20 consists of header register A and task registers 1, 2 and 3, queue B 21 consists of header register B, queue C 22 consists of header register C, and queue D 23 consists of header register D and task registers 4, 5, 6, 7, 8 and 9. 
     Referring to FIG. 3E, assume that the system next determines that task A1 should be moved from queue A 20 to queue B 21 for further processing. Since task A1 is stored in task register 1, routine A is executed to remove task register 1 from queue A 20. Routine B is then executed to insert task register 1 into queue B 21 by executing sequentially steps 1, 2, 5, 6, 7 and 8. 
     Referring to FIG. 3F, assume the operating system next receives task A4 which is stored in task register 4 in queue D 23 which is then inserted into queue A 20. Routine A is executed to remove task register 4 from queue D 23. Routine B is executed to insert task register 4 into queue A 20 by executing sequentially steps 1, 2, 3, 4, 2, 3, 4, 2, 5, 6, 7 and 8. The results of this procedure are shown in FIG. 3F. 
     In summary, queue A 20 now contains header register A and task registers 2, 3 and 4, queue B 21 contains header register B and task register 1, queue C 22 contains header register C and queue D 23 consists of header register D and task registers 5, 6, 7, 8 and 9. 
     Referring to FIG. 3G, assume next that the operating system determines that task A3 should be moved from queue A 20 to queue C 22. Since task A3 is stored in task register 3, routine A will be executed to remove task register 3 from queue A 20. Routine C will then be executed to insert task register 3 into queue C 22 by sequentially executing steps 1, 2, 3, 4 and 5. The results of this procedure are shown in FIG. 3G. 
     Referring to FIG. 3H, next assume that tasks A5, A6 and A7 are received in that order by the system to be processed by the system. These tasks will be inserted in task registers 5, 6 and 7. Task registers 5, 6 and 7 will then be moved from queue D 23 to queue A 20. Each of these operations will include the operation of executing routine A and then routine B for each of these tasks. The results of these procedures are shown in FIG. 3H. 
     In summary, at this time queue A 20 consists of header register A and task registers 2, 4, 5, 6 and 7, queue B 21 consists of header register B and task register 1, queue C 22 consists of header register C and task register 3, and queue D 23 consists of header register D and task registers 8 and 9. 
     Referring to FIG. 3I, assume that the operating system determines that task A5 should be moved from queue A 20 to queue C 22. Since task A5 is in task register 5, routine A will be executed to remove task register 5 from queue A 20. Routine C will then be executed to insert task register 5 into queue C 22 by sequentially executing steps 1, 2, 3, 4 and 5. The results of this operation are shown in FIG. 3I. 
     Referring to FIG. 3J, next assume that the operating system determines that task A2 should be moved from queue A 20 to queue C 22 for processing. Since task A2 is located in task register 2, routine A is executed to remove task register 2 from queue A 20. Routine C is then executed to insert task register 5 into queue C 22 by sequentially executing steps 1, 2, 3, 4 and 5. The results of this procedure are shown in FIG. 3J. 
     In review, at this time queue A 20 consists of header register A and task registers 4, 6 and 7, queue B 21 consists of header register B and task register 1, queue C 22 consists of header register C and task registers 3, 5 and 2, and queue D 23 consists of header register D and task registers 8 and 9. 
     Referring to FIG. 3K, the system next having determined that task A1 has been completed will return task register A1, storing task A1, from queue A 20 to queue D 23. Routine A will be executed to remove task register 1 from queue A 20. Routine B will then be executed to insert task register into queue D 23 by sequentially executing steps 1, 2, 3, 5, 6, 7 and 8. The results of this procedure are shown in FIG. 3K. 
     Referring to FIG. 3L, assume that the operating system task 8 which is stored in task register 1 in queue D 23 which is then inserted into queue A 20. After task A8 is stored in task register 1, routine A is then executed to remove task register 1 from queue D 23. Routine B is then executed to insert task register 1 into queue A 20 by sequentially executing steps 1, 2, 3, 5, 6, 7 and 8. The results of this procedure are shown in FIG. 3L. 
     In summary, at this time queue A 20 contains header register A and task A8, A4, A6, A7 stored in task registers 1, 4, 6 and 7, respectively, queue B 21 consists of header register B, queue C 22 contains header register C and task A3, A5 and A2 stored in task registers 3, 5 and 2, respectively and queue D 23 consists of header register D and task registers 8 and 9. 
     The foregoing discussion has exemplified the operation of the queue system and how the queue system can be customized by the designer to meet the designer&#39;s needs. While the queue system has been described as using memory locations within a random access memory, it should be understood that dedicated hardware registers could be used instead of the random access memory. 
     It can readily be appreciated that the movement of the tasks between queues only necessitated the modifications of the previous and next fields of the registers being affected by the removal and insertion of a task register into a queue. At no time is it necessary to move the actual data associated with the task stored within the task register when the task register containing the task was effectively moved between queues. In the foregoing manner the queue system has allocated registers to form pseudo queues where each pseudo queue is comprised of a header register and one or more of the task registers and where each task register is always assigned to a queue in the queue system. The resulting queue system is one that is readily available to be customized by the designer and easy alteration and modification as the system requirements are changed. 
     The routine set forth in FIGS. 4, 5 and 6 are implemented in microcode using known digital software implementation and were assembled using Motorolla 68C11 Assembler, Series 5.0. The microprograms are detailed in Appendix A and carry out the function of the routines of the flow charts as shown in FIGS. 4, 5 (not by task register ordering but by additional field ordering) and 6. It should be understood that the method can be embodied in other microprograms using other programmable languages or can be stored in the read only memory within a computer system. The functions of processor 10 can be implemented by a hardware state machine dedicated to perform the functions necessary to carry out the routines described herein. 
     While the invention has been particularly shown and described with reference to the preferred embodiments therefore, it will be understood by those skilled in the art that changes in form and detail may be made therein without departing from the spirit and scope of the invention. Given the above disclosure of general concepts and specific embodiments,, the scope of the protection sought is defined by the following claims. ##SPC1##