Patent Publication Number: US-5893924-A

Title: System and method for overflow queue processing

Description:
CROSS-REFERENCE TO OTHER APPLICATIONS 
     This application id a continuation of application Ser. No. 08/506,922, filed Jul. 28, 1995, now abandoned. 
     The following application of common assignee contains some common disclosure, and is believed to have an effective filing date identical with that of the present application. 
     &#34;COMPUTER PROGRAM PRODUCT FOR OVERFLOW QUEUE PROCESSING,&#34; Attorney Docket No. 1252.2320000. 
    
    
     DESCRIPTION 
     1. Technical Field 
     The present invention relates generally to data storage and retrieval in a data processing environment, and more particularly to a system and method for processing queues so as to avoid a queue full condition. 
     2. Background Art 
     In some data processing systems, a plurality of applications store data in and retrieve data from a shared queue that is implemented on a computer storage medium. The computer storage medium has a finite storage capacity. Thus, a situation can arise where the shared queue grows to such a size that it occupies the entire computer storage medium. 
     When this occurs, it is not possible to store any additional information in the shared queue. In such cases, the shared queue is said to have reached a &#34;queue full condition.&#34; 
     Conventionally, new requests to store information in a shared queue are rejected while a queue full condition exists. Such new requests are processed only after information has been removed (i.e., &#34;drained&#34;) from the shared queue. After such draining, the queue full condition no longer exists. 
     This approach is not ideal, however, because it results in degrading overall system performance. This is the case, because requests to store information in the shared queue are not immediately processed, and because such requests must be transmitted from the applications to the shared queue multiple times. 
     Thus, what is required is a system and method for managing a shared queue so as to avoid or minimize the impact of a queue full condition. 
     DISCLOSURE OF INVENTION 
     Briefly stated, the invention is directed to a queue management system (and method performed therein). The system includes a computer storage medium having a primary storage medium and an overflow storage medium. The system also includes a manager for managing a plurality of data structures (queues) stored in the computer storage medium. 
     The invention operates as follows. The manager receives a request to store a data object in a target data structure. The manager determines whether an overflow mode condition currently exists. If an overflow mode condition does not currently exist, then the manager determines whether a combined size of all data structures stored in the primary storage medium plus a size of the data object is greater than a predetermined threshold. 
     If a combined size of all data structures stored in the primary storage medium plus a size of the data object is greater than a predetermined threshold, then the manager enters an overflow mode. Also, the manager selects one or more data structures currently stored in the primary storage medium, and moves the selected data structures from the primary storage medium to the overflow storage medium. The overflow storage medium is then directly accessed to process any subsequent actions involving these data structures. 
     Further features and advantages of the invention, as well as the structure and operation of various embodiments of the invention, are described in detail below with reference to the accompanying drawings. In the drawings, like reference numbers generally indicate identical, functionally similar, and/or structurally similar elements. The drawing in which an element first appears is indicated by the digit(s) to the left of the two rightmost digits in the corresponding reference number. 
    
    
     BRIEF DESCRIPTION OF FIGURES 
     The present invention will be described with reference to the accompanying drawings, wherein: 
     FIG. 1 is a data processing environment according to a preferred embodiment of the present invention; 
     FIG. 2 is a block diagram of a computer system according to a preferred embodiment of the present invention; and 
     FIGS. 3A, 3B, 4, and 5 are flowcharts depicting the preferred operation of the invention. 
    
    
     BEST MODE FOR CARRYING OUT THE INVENTION 
     The present invention is directed to a system and method for managing a shared queue so as to avoid or minimize the impact of a queue full condition. 
     FIG. 1 is a block diagram of a data processing environment 101 according to a preferred embodiment of the present invention. The data processing environment 101 includes a plurality of applications 112 (each representing a software program executing in a computer) interacting with a computer storage system, such as data management system 102. 
     The data management system 102 includes a manager 104 and a computer storage medium 105 having a finite storage capacity. The size of the computer storage medium 105 is implementation dependent. At any time, zero or more data structures are stored in the computer storage medium 105. The manager 104 controls access to and manages these data structures. 
     Preferably, the data structures stored in the computer storage medium 105 represent queues, and the invention is described below with respect to the use and management of queues. It should be understood, however, that the invention is not limited to the use and management of queues. Instead, any well known data structure may be used in place of queues. 
     The computer storage medium 105 includes a primary storage medium 106 and an overflow storage medium 108. The queues are stored in the primary storage medium 106 and (possibly) the overflow storage medium 108. An overflow name list 110 is preferably stored in the computer storage medium 105. The names of any queues stored in the overflow storage medium are stored in the overflow name list 110. 
     The invention operates as follows. When the manager 104 detects that the combined size of the queues in the primary storage medium 106 has reached a predetermined threshold (which is preferably a percentage of the total storage capacity of the primary storage medium 106), then the manager enters an overflow mode and performs overflow threshold processing (an overflow mode condition is said to exist). During overflow threshold processing, the queues having the most data objects enqueued are selected and moved from the primary storage medium 106 to the overflow storage medium 108. Once these selected queues are moved to the overflow storage medium 108, any subsequent accesses to these queues by the applications 112 are processed using the overflow storage medium 108 until the overflow mode is exited. 
     By moving queues with the most data objects to the overflow storage medium 108, storage space on the primary storage medium 106 is reclaimed. This allows additional data objects to be placed on to the queues remaining in the primary storage medium 106. The manager 104 also allows data objects to be placed on to the queues in the overflow storage medium 108. If the overflow storage medium 108 becomes full, new work for the queues stored therein is rejected. 
     The manager 104 exits the overflow mode when the following two conditions are met: (1) all data objects on the overflow storage medium 108 have been removed from the overflow storage medium 108; and (2) usage of the primary storage medium 106 is below the predetermined threshold. 
     Preferably, the data management system 102 is implemented using a computer system 202 as shown in FIG. 2. The computer system 202 includes one or more processors, such as processor 204. The processor 204 is connected to a communication bus 206. 
     The computer system 202 also includes a main memory 208, preferably random access memory (RAM), and a secondary memory 210. The main memory 208 and/or the secondary memory 210 represent the computer storage medium 105. 
     The secondary memory 210 includes, for example, one or more hard disk drives 212 and/or one or more removable storage drives 214, each representing a floppy disk drive, a magnetic tape drive, a compact disk drive, etc. These devices may be connected directly to the bus 206 or may be connected over a network (not shown). The removable storage drives 214 each reads from and/or writes to a removable storage unit 216 in a well known manner. 
     Removable storage unit 216, also called a program storage device or a computer program product, represents a floppy disk, magnetic tape, compact disk, etc. As will be appreciated, the removable storage unit 216 includes a computer usable storage medium having stored therein computer software and/or data. 
     Computer programs (also called computer control logic) are stored in main memory 208 and/or the secondary memory 210. Such computer programs, when executed, enable the computer system 202 to perform the features of the present invention as discussed herein. In particular, the computer programs, when executed, enable the processor 204 to perform the features of the present invention. Accordingly, such computer programs represent controllers of the computer system 202. (For example, the manager 104 preferably represents a computer program executing in the computer system 202.) 
     In another embodiment, the invention is directed to a computer program product comprising a computer readable medium having control logic (computer software) stored therein. The control logic, when executed by the processor 204, causes the processor 204 to perform the functions of the invention as described herein. 
     In another embodiment, the invention (particularly the manager 104) is implemented primarily in hardware using, for example, a hardware state machine. Implementation of the hardware state machine so as to perform the functions described herein will be apparent to persons skilled in the relevant art(s). 
     The applications 112 each preferably represents a computer program executing in a computer system such as that shown in FIG. 2. 
     Storing a Data Object In a Queue 
     The operation of the invention shall now be described in greater detail. 
     FIGS. 3A and 3B collectively depict a flowchart 302 representing the operation of the invention when an application 112 sends to the manager 104 a request (called the &#34;request being processed&#34; for reference purposes) to add a data object to a queue. For reference purposes, this queue is called the &#34;target queue.&#34; Flowchart 302 begins with step 304, where control immediately passes to step 306. 
     In step 306, the manager 104 determines whether it is currently in overflow mode (by accessing an appropriate flag, for example). If it is in overflow mode, then control flows to step 322 in FIG. 3B. Step 322 is described below. If it is not in overflow mode, then step 308 is performed. It is noted that, if the manager 104 is not in overflow mode, then all queues (including the target queue) are stored in the primary storage medium 106. The overflow storage medium 108 and the overflow name list 110 are empty. 
     In step 308, the manager 104 determines whether the act of adding the data object to the target queue in the primary storage medium 106 would result in the combined size of all queues on the primary storage medium 106 to reach or exceed a predetermined threshold. The predetermined threshold is preferably equal to: (predetermined percentage)*(total storage capacity of the primary storage medium 106). The values of the predetermined percentage and the predetermined threshold are implementation dependent. For example, the predetermined percentage may be equal to 70%, such that the predetermined threshold is equal to 70% of the total storage capacity of the primary storage medium 106. Thus, in step 308, the manager 104 determines whether the act of adding the data object to the target queue in the primary storage medium 106 would result in the combined size of all queues on the primary storage medium 106 to reach or exceed 70% of the total storage capacity of the primary storage medium 106. In one embodiment, the predetermined percentage is equal to a value in the range from 50%-70%, although the invention is not limited to these values. 
     If the act of adding the data object to the target queue in the primary storage medium 106 would not result in the combined size of all queues on the primary storage medium 106 to reach or exceed the predetermined threshold, then step 316 is performed. In step 316, the manager 104 adds the data object to the target queue in the primary storage medium 106. Flowchart 302 is complete after the performance of step 316, as indicated by step 318. 
     If, instead, the act of adding the data object to the target queue in the primary storage medium 106 would result in the combined size of all queues on the primary storage medium 106 to reach or exceed the predetermined threshold, then step 310 is performed. 
     In step 310, the manager 104 enters overflow mode (the manager 104 may set an overflow flag). 
     In step 312, the manager 104 begins to select queues in the primary storage medium 106. Preferably, the manner 104 selects the queues having the most data objects enqueued thereon (i.e., the selection process moves in a descending order based on the number of data objects on each of the queues). The manager 104 stops selecting queues once a predetermined number of queues has been selected (this predetermined number is implementation dependent), or once the size of the selected queues is equal to or exceeds a predetermined amount (this predetermined amount is implementation dependent). In one embodiment, the predetermined number is equal to 512 and the predetermined amount is equal to 20%, although the invention is not limited to these values. The selected queues are called &#34;first queues&#34; for reference purposes. 
     In step 314, the manager 104 moves the first queues from the primary storage medium 106 to the overflow storage medium 108. Also, the manager 104 places the names (or some other identifiers) of the first queues into the overflow name list 110. 
     Step 322 in FIG. 3B is then performed. In step 322, the manager 104 determines whether the target queue is in the overflow storage medium 108 by checking to see if the name of the target queue is in the overflow name list 110 (alternatively, the manager 104 may determine whether the target queue is in the overflow storage medium 108 by scanning the overflow storage medium 108). If the target queue is in the overflow storage medium 108, then the manager 104 knows that it must directly access the overflow storage medium 108 to service the request being processed. In particular, the manager 104 performs step 336. 
     In step 336, the manager 104 determines whether the overflow storage medium 108 has sufficient available storage capacity to accommodate the data object. If the overflow storage medium 108 has sufficient available storage capacity to accommodate the data object, then step 338 is performed. In step 338, the manager 104 adds the data object to the target queue in the overflow storage medium 108. Flowchart 302 is complete after step 338 is performed, as indicated by step 340. 
     If, in step 336, the manager 104 determines that the overflow storage medium 108 does not have sufficient available storage capacity to accommodate the data object, then step 342 is performed. In step 342, the manager 104 rejects the data object. The details of such rejection are implementation dependent. For example, the manager 104 may require that the application 112 retransmit the request to store the data object at a later time. Alternatively, the manager 104 may retain the request until it is possible to process it. Other rejection protocols will be apparent to persons skilled in the relevant art(s). Flowchart 302 is complete after step 342 is performed, as indicated by step 344. 
     An advantage of the invention should now be apparent. By employing an overflow protocol that employs a primary storage medium 106 and an overflow storage medium 108, the invention operates to isolate &#34;faulty&#34; applications (also called &#34;runaway applications&#34;) from &#34;non-faulty&#34; applications. 
     Faulty applications tend to write excessive amounts of data objects to their queues (i.e., the queues being used by the faulty applications). Thus, these queues tend to become larger in size than the queues being used by non-faulty applications. According to the present application, the queues having the most data objects (and being most likely associated with the faulty applications) are moved to the overflow storage medium 108. Thus, the queues associated with non-faulty applications remain on the primary storage medium 106, while queues associated with faulty applications are moved to the overflow storage medium 108. Accordingly, non-faulty applications are isolated from faulty applications. 
     The faulty applications may cause the overflow storage medium 108 to fill to capacity (such that subsequent attempts to write to their queues will be rejected), but that is not of great importance since such applications are, by definition, faulty. What is important is that a queue full condition on the overflow storage medium 108 does not affect the primary storage medium 106. Accordingly, non-faulty applications can operate normally, even when faulty applications exist. 
     If, in step 322, the manager 104 determines that the target queue is not in the overflow storage medium 108, then the manager 104 knows that the target queue is in the primary storage medium 106. The manager 104 then performs step 324. In step 324, the manager 104 determines whether the act of adding the data object to the target queue in the primary storage medium 106 would result in the combined size of all queues on the primary storage medium 106 to reach or exceed the predetermined threshold (discussed above with reference to step 308). 
     If the act of adding the data object to the target queue in the primary storage medium 106 would not result in the combined size of all queues on the primary storage medium 106 to reach or exceed the predetermined threshold, then step 332 is performed. In step 332, the manager 104 adds the data object to the target queue in the primary storage medium 106. Flowchart 302 is complete after the performance of step 332, as indicated by step 334. 
     If, instead, the act of adding the data object to the target queue in the primary storage medium 106 would result in the combined size of all queues on the primary storage medium 106 to reach or exceed the predetermined threshold, then step 326 is performed. 
     In step 326, the manager 104 begins to select queues in the primary storage medium 106. As in step 312 (discussed above), the manner 104 preferably selects the queues having the most data objects enqueued thereon (i.e., the selection process moves in a descending order based on the number of data objects on each of the queues). The manager 104 stops selecting queues once a predetermined number of queues has been selected (this predetermined number is implementation dependent, and may be the same as or different from the predetermined number discussed above with respect to step 312), or once the size of the selected queues is equal to or exceeds a predetermined amount (this predetermined amount is implementation dependent, and may be the same as or different from the predetermined amount discussed above with respect to step 312). The selected queues are called &#34;second queues&#34; for reference purposes. 
     In step 328, the manager 104 determines whether the overflow storage medium 108 has sufficient available storage capacity to accommodate all of the second queues. If the overflow storage medium 108 has sufficient available storage capacity to accommodate all of the second queues, then the manager 104 in step 330 moves the second queues from the primary storage medium 106 to the overflow storage medium 108. Also, the manager 104 places the names (or some other identifiers) of the second queues into the overflow name list 110. Control then flows back to step 322. 
     If, in step 328, the manager 104 determines that the overflow storage medium 108 does not have sufficient available storage capacity to accommodate all of the second queues, then the manager 104 rejects all attempts to store additional data in the second queues. The manager 104 does this since such second queues may be associated with faulty applications. Thus, this is another example of how the invention isolates non-faulty applications from faulty applications. In particular, in step 346 the manager 104 determines whether the target queue is one of the second queues. If the target queue is not one of the second queues, then the manager 104 in step 348 adds the data object to the target queue in the primary storage medium 106. If, instead, the target queue is determined to be one of the second queues, then the manager 104 in step 350 rejects the data object (i.e., does not store the data object in the target queue). This is the case, even though the target queue is still in the primary storage medium 106. 
     Flowchart 302 is complete after the performance of either step 348 or step 350, as indicated by step 352. 
     Retrieving a Data Object From a Queue 
     FIG. 4 is a flowchart 402 depicting the operation of the invention when the manager 104 is processing a request from an application 112 to retrieve a data object from a queue (again called the target queue for reference purposes). Flowchart 402 begins with step 404, where control immediately passes to step 406. 
     In step 406, the manager 104 determines whether it is executing in overflow mode (by accessing an appropriate flag, for example). If it is not executing in overflow mode, then the manager 104 in step 408 retrieves the data object from the target queue located on the primary storage medium 106. Flowchart 402 is complete after the performance of step 408, as indicated by step 410. 
     If, instead, the manager 104 is executing in overflow mode, then step 412 is performed. In step 412, the manager 104 accesses the overflow name list 110 to determine whether the target queue is in the overflow storage medium 108. If the target queue is not in the overflow storage medium 108, then step 408 is performed (described above). Otherwise, the manager 104 in step 414 retrieves the data object from the target queue located on the overflow storage medium 108. Flowchart 402 is complete after the performance of step 414, as indicated by step 416. 
     Deleting a Data Object From a Queue 
     It is assumed herein that retrieval of a data object from a queue does not result in deletion of the data object from the queue. To delete a data object from a queue, it is necessary to execute a delete operation. 
     FIG. 5 is a flowchart 502 depicting the operation of the manager 104 when processing a request from an application 112 to delete a data object from a queue (again called the target queue). 
     It should be understood that the invention contemplates both the retrieval and deletion of a data object from a queue upon the processing of a single retrieval command. In such embodiments, the steps of flowchart 502 are performed after the completion of flowchart 402. 
     Flowchart 502 begins with step 504, where control immediately passes to step 506. In step 506, the manager 104 determines whether it is executing in overflow mode (by accessing an appropriate flag, for example). If it is not executing in overflow mode, then the manager 104 in step 508 deletes the data object from the target queue located on the primary storage medium 106. Flowchart 502 is complete after the performance of step 508, as indicated by step 510. 
     If, instead, the manager 104 is executing in overflow mode, then step 512 is performed. In step 512, the manager 104 accesses the overflow name list 110 to determine whether the target queue is in the overflow storage medium 108. If the target queue is not in the overflow storage medium 108, then step 508 is performed (described above). Otherwise, the manager 104 in step 514 deletes the data object from the target queue located on the overflow storage medium 108. 
     In steps 516, 518, 520, 522, and 524, the manager 104 determines whether it should exit the overflow mode and return to the normal mode (i.e., the non-overflow mode). 
     Specifically, in step 516 the manager 104 determines whether the target queue is empty. If the target queue is not empty, then there is at least one non-empty queue on the overflow storage medium 108. If this is the case, then the manager 104 remains in the overflow mode. Flowchart 502 is then complete, as indicated by step 526. 
     If, in step 516, the manager 104 determines that the target queue is empty, then the manager 104 in step 518 deletes the target queue from the overflow storage medium 108 and removes the name of the target queue from the overflow name list 110. 
     In steps 520 and 522, the manager 104 determines whether the overflow storage medium 108 is devoid of queues (by seeing if the overflow name list 110 is empty), and whether the total size of all queues on the primary storage medium 106 is less than the predetermined threshold (discussed above with reference to step 308 in FIG. 3A). If both these conditions are not true, then the manager 104 remains in the overflow mode. Flowchart 502 is then complete, as indicated by step 526. However, if both of these conditions are true, then in step 524 the manager 104 enters the normal mode. While in the normal mode, all queues are stored in the primary storage medium 106, and the overflow storage medium 108 and the overflow name list 110 are empty. Flowchart 502 is then complete, as indicated by step 526. 
     While various embodiments of the present invention have been described above, it should be understood that they have been presented by way of example only, and not limitation. Thus, the breadth and scope of the present invention should not be limited by any of the above-described exemplary embodiments, but should be defined only in accordance with the following claims and their equivalents.