In a multiple-block-per-entry buffer memory (BS) of the swap or store-in type, a swap-out buffer (SOB) having a capacity for at least a block is provided. On the occasion of replacing, a memory access sequence control responds to change bits and validity bits associated with an entry to be replaced as well as the block address designated for memory access so as to execute the data transfer from a main memory (MS) to BS in preference to the sweeping-out of data from BS to SOB so long as the block to be replaced need not be stored in MS. If the block to be replaced needs to be stored, the sweeping-out into SOB is executed with the utmost priority, and the data transfer from MS is then executed in preference to the sweeping-out of any other blocks to be stored into MS.
An apparatus and method for swapping program code and data between a main memory and an auxiliary memory, and a web video phone adopting the apparatus, are provided. The web video phone includes a key input unit for inputting a command of execution of an application program, a flash memory for storing application programs such as a video phone application using the H.324 protocol, an Internet phone application using the H.323 protocol, a web browser, an e-mail application, and a personal information management system (PIMS), a DRAM including a program code region and a data region for storing program codes downloaded from the flash memory and data swapped from the flash memory, and a main processor for controlling the program code of each application program stored in the flash memory to be stored in the program region of the DRAM and controlling the swapping between the data of each application program stored in the flash memory and the data stored in the data region of the DRAM, in response to an execution command of an application program input through the key input unit. Therefore, all application programs can be driven by a small capacity DRAM, and can be easily, individually managed.
In processing a priority queue, the elements are kept in an unsorted stack and are searched for the next highest priority element only after the highest priority element has been read from the holding register. Each time a new element is written into the queue, a comparison is made of the priority of the new element with the priority of the existing element in the holding register. If the new element has a higher priority, then the existing element in the holding register is written onto the top of the stack. Alternately, if the element in the holding register has the higher priority, then the new element is written onto the top of the stack. This assures that the holding register always contains the element having the highest priority. Therefore, a read of the priority queue by reading the contents of the holding register guarantees that the highest priority element is there and it can be accessed immediately without further searching the queue.