OPERATING SYSTEM PAGE PLACEMENT TO MAXIMIZE CACHE DATA REUSE

Abstract: A software methodology to control replacement of one or more selected pages within a cache memory in a computer system. The operating system designates one or more pages containing critical data, text or other digital information as hot pages within a physical system memory in the computer system and prevents replacement during execution of various application programs of these hot pages when cached. The operating system inhibits allocation of the conflict pages that would map to cache locations occupied by a cached hot page, thereby preserving the hot page within the cache memory. The conflict pages are placed at the bottom of a free list created in the system memory by the operating system. The operating system scans the free list using a pointer while allocating free system memory space at run-time. The system memory pages are allocated from the free list until the pointer reaches a conflict page. This allows the operating system to prevent the conflict pages from getting cached to the hot page location within the cache memory. The operating system can also allow a user to designate one or more hot pages during run-time. The user is warned when the number of hot pages reaches or exceeds a predetermined limit.

Description: TITLE: OPERATING SYSTEM PAGE PLACEMENT TO MAXIMIZE CACHE DATE REUSE BACKGROUND OF THE INVENTION 1. Field of the mventton The present mvention relates to cache data management m a computer system, and more particularly to a software methodology to control replacement of one or more selected pages within a cache memory in the computer system. 2. Description of the related art Modern multiuser/multitasking computer systems run complex operatmg systems to accomplish concurrent executions of myriad user applications. Broadly speaking, an operating system may be defined as a system software that schedules tasks for execution by one or more processing units in the computer system, allocates storage among various application programs, handles the system interface to the peripheral hardware, and presents a default interface to the user when no application program is running. Some examples of operatmg systems include the AT&T UNIX operating system; the IBM OS/2 operating system: the Microsoft Windows family of operatmg systems and MS-DOS; the Macintosh operating system; the Novell Netware; and the Digital Equipment Corporation's VMS operating system. An operatmg system program may be divided into two parts: (1) the operating system kernel that contains the major operatmg system functions, such as the scheduler; and (2) various system programs which use facilities provided by the kernel to perform higher-level house-keeping tasks, such as providmg an mterface to vaπous user application programs. An application program may be defined as a program that performs a specific function directly for the user (perhaps using one or more operatmg system services via the above mentioned interface). This is in contrast to system software, such as the operatmg system kernel, which supports the application programs. Word processmg and spreadsheet software are common examples of popular application programs As used herein, the term "task" refers to a sequence of instructions arranged to perform a particular operation. Application software and the operating system may comprise one or more tasks In a typical multitasking operatmg system, memory management is usually employed for: (1) providing additional memory space when the physical memory space accessed by a processmg unit is not large enough to hold all of the operatmg system and all of the application programs that are being executed by one or more users of the computer system; and (2) ensurmg that executing tasks do not access protected areas of the physical system memory or those areas of the physical system memory allocated to other tasks. Generally, memory management may include allocating pages of physical memory for use by one or more tasks, mapping addresses generated by the tasks ("virtual addresses") to the allocated physical pages ("physical addresses") through an address translation mechanism, and deallocating pages released by a task. A prior art system memory physical page allocation scheme is illustrated in Fig.l. The computer system physical memory or system memory 12 may be visualized as bemg divided into a number of memory blocks or pages. Normally, the operating system kernel routmes and relevant data as well as vaπous software routmes forming portions of one or more application programs being simultaneously executed by the operating system reside m the system memory 12, as respectively shown by the blocks numbered 11 and 13. The operating system software routines (block 11) and the application software (block 13) may require more than one memory page dependmg. among other things, on the page size and on the number of applications currently bemg executed During a program execution, a copy of a memory page 141 (i.e.. the memory page 14) allocated to a program may be placed m the system cache memory 10 If the system cache memory 10 has no allocable space, then the system cache memory 10 may "flush" a correspondmg page from the cache memory 10 to make space for the more recently accessed memory page 141. The cached page 14 typically contams a plurality of cache lines (or blocks), and caching is typically performed on a block by block basis rather than a page by page basis Accordingly, caching a page actually involves cachmg the multiple cache lines of a page. Cachmg improves the rate of program execution by providmg faster access for the processmg unit to read data from/write data into the cached page 14 in the cache memory 10 during the correspondmg application program execution. It is understood that the cache memory space 16 of the cache memory 10 is typically smaller than that of the system memory 12. For example, when the cache memory space 16 is 1MB in size and when the page size is 8KB, the cache memory 10 may store up to 128 complete pages However, the typical system memory physical space may be on the order of 64 MB, 80 MB, or even more In that case, the system memory 12 may be visualized to contain 8192 or 10240 or more pages respectively. Further, it may not be desirable to increase the cache memory size 16 beyond a certain limit. In that event, the operatmg system may need to efficiently manage the resources of the cache memory 10 for a large number of applications that are currently under execution in the computer system. When the user switches tasks or adds more applications for execution, the operating system may need to allocate one or more pages from the system memory 12 for the new tasks or applications. Under the pπor an scheme of Fig. 1, the operatmg system uses a uniform method for allocating memory space, i.e., a request for a page of memory is allocated uniformly across the available memory space 20 according to any of the existing page allocation algorithms This is illustrated in detail in Fig 1 The allocable memory space 20 may be considered to comprise two sections: ( 1) memory pages that map to the same cache memory storage locations as the cached page 14 when placed in the cache memory 10; and (2) the remaining memory pages, 15-1 through 15-N+2 and further, in the allocable memory space 20 that do not map to the same cache memory storage locations as the cached page 14 For the present discussion, the memory pages under (1) may be termed as conflict pages 18 and may be designated as conflιct_page- 1 (18-1) through conflιct_page-N+2 (18-N+2) and onwards. The number of conflict pages depends on the size of the allocable physical memory space and on the size of the cache memory 10 In the previous example of the cache memory of 1MB size, the system memory of 80MB can have a maximum of 79 conflict pages. The 80* "conflict page" would be the cached page 141. In any event, the actual number of conflict pages may not be insubstantial. The memory pages under (2) may then be termed as non-conflict pages or free pages 15 (e g., pages 15-1 through 15- N+2 and further) for the present discussion. Under the uniform method of allocation mentioned above, the operatmg system may simply allocate a conflict page, e.g., the conflιct_page- 1 (18-1), after allocating the page 141 The same method is repeated when the need to allocate an additional system memory page anses. In that event, the operatmg system may again allocate another conflict page, e g., the conflιct_page-2 (18-2), after storing the conflιct_page- 1 into the appropnate memory location, I e., the memory location 18-1 Unfortunately, allocating one or more conflict pages may cause the cached page 14 to be displaced from the cache memory 10 (when the conflict pages are accessed). Subsequent accesses to the page 141 may miss m the cache memory 10, increasing memory latency for the task to which the page 141 is allocated The increased latency described above is particularly a problem in that some data and text (i.e , instruction sequences) are frequently accessed and thus heavily limit access latency when not present m the cache For the present discussion, these data may be referred to as "critical data" and may include not only data and text, but also various software routines, instruction codes or any other digital information already existmg or being generated during an application program execution The present operating system page allocation schemes may also cause a large number of conflict misses in the cache memory 10 when critical data is frequently replaced by other data or text that may have shorter cache lifetimes. Therefore, a method for efficient memory page allocation is desirable so as to maximize cache data reuse. SUMMARY OF THE INVENTION The foregomg described various problems that may frequently arise in case of the existmg operating systems implementing a uniform method of physical system memory page allocation. Described herem is a software methodology to control replacement of one or more selected pages within the cache memory in the computer system In one embodiment of the methodology, the operatmg system is configured to designate a "hot page" within the physical system memory and to prevent the replacement of that hot page when placed within the cache memory during execution of vaπous application programs. One cπteπon for selecting the hot page may be the existence of critical data within the hot page In an alternative embodiment, the user may be allowed to designate one or more hot pages under the operatmg system control However, the operatmg system may warn the user in the event that the number of hot pages placed withm the cache memory exceeds a predetermined limit. In one embodiment, the operatmg system inhibits allocation of the conflict pages that would map to the cache memory storage locations to which the hot page maps when cached. This may be accomplished by a sorted free list in the physical system memory where pages that would map to the same location as the hot page, l e., the conflict pages, are placed at the bottom of the free list and the operating system may be configured to inhibit, to the extent possible, allocation of these conflict pages even if the system is paging. A pomter may be placed in the system memory for scanning the free list for allocable memory space. In one embodiment, the pomter may scan the free list from top to bottom (as pages are allocated) until a conflict page is reached. This may allow the operatmg system to prevent the conflict pages from getting cached to the hot page location within the cache memory In another embodiment, the compiler may mark cntical data or text m a task that would remam in the cache while lightly used data m the task may be placed in those parts of the cache memory which may be replaced due to conflict misses. In a different embodiment, the operatmg system may be configured to establish the amount of conflicting page space within the free list ahead of tune, i.e., pπor to beginning the execution of one or more application programs. This may allow the operatmg system to efficiently identify the total allocable physical memory space beforehand and to accordingly allocate memory pages during program execution A computer system is also contemplated whose operatmg system is configured to identify a plurality of hot pages withm the system memory and to selectively prevent replacement of the plurality of hot pages during execution of one or more application programs. In a further embodiment, a storage medium is contemplated that contams a cache data management program that is executable by a computer system when received from said storage medium and placed within a system memory in the computer system, and wherem upon execution said cache data management program designates a hot page withm the system memory and identifies one or more conflict pages for that hot page The cache data management program may also prevent the allocation of these conflict pages to one or more applications m the computer system. Alternatively, the cache data management program may configure the operating system to accomplish the desired controlled page allocation functionality The cache access times for cntical data pages are thus unproved through reduced access latencies The efficient memory page allocation methodology thus allows for maximization m cache data reuse. Conflict misses in the cache are also prevented for selected memory pages. BRIEF DESCRIPTION OF THE DRAWINGS A better understandmg of the present mvention can be obtamed when the following detailed description of the preferred embodiment is considered in conjunction with the following drawings, m which: Fig. 1 illustrates how a prior an scheme allocates a memory page from the allocable physical memory space to an application being executed m a computer system Fig. 2 depicts how the present methodology determines the allocable physical memory space m the event of designatmg a hot page withm the physical system memory Fig. 3 A shows a flow chart for implementing one embodiment of the methodology. Fig. 3B is an exemplary illustration of how one step m Fig. 3 A may be implemented. Figs. 4A-4D illustrate the free list and pomter mechanism according to one embodiment of the methodology. Fig. 5 shows an example of a computer system compπsmg an operating system configured accordmg to the methodology, and a storage medium contammg the software embodymg the methodology. Fig. 6 illustrates an exemplary hardware configuration of the computer system m Fig. 5. Fig. 7 illustrates one example of how the methodology may be implemented m one computer system usmg a second computer system m a communication network as a storage medium for the software embodymg the methodology. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS Referring now to Fig. 2, the conflict pages 18 are shown hatched m the system memory representation 12. The system memory 12 may compπse any suitable memory device. For example, the memory 12 may compnse one or more RAMBUS DRAMs (RDRAMs), synchronous DRAMs (SDRAMs), static RAM, etc. As discussed earlier, a system memory page may contam some cntical data. For the present discussion, such a system memory page contammg critical data is referred to as a "hot page." As illustrated m Fig. 2, the operatmg system may be configured to restrict allocable physical memory space 20 to those areas 15 m the system memory 12 that exclude the conflict pages 18, the hot page 141, the application software area 13, and memory space contammg any operating system kernel routines 11. Smce the conflict pages 18 are not allocated, those pages are not accessed by the processing units withm the computer system. Accordingly, hot page 14 may remam cached withm the cache memory 10 regardless of other activities withm the computer system. It is noted that the cache memory 10 may be part of a processmg unit m the computer system, m other words, the cache memory 10 may be an internal cache. Alternatively, the cache memory 10 may be an external cache memory in the computer system In one embodiment, the cache memory 10 may include both the internal cache and the external cache in the computer system. In the preferred embodiment, the cache memory 10 is an external cache memory Further, the hatched representation of the conflict pages 18 is not meant to convey that the conflict pages 18 do not exist in the system memory 12. It is, however, simply meant to illustrate that the conflict pages 18 are not allocated (i.e., are not considered by the operatmg system to be part of the allocable physical memory space 20) to one or more applications running in the computer system when a hot page is designated in the system memory 12. The hot page 14 in the cache memory 10 may contain more than one cache line (or cache block). In one embodiment, the cache memory 10 is a direct-mapped cache Therefore, real memory addresses that represent the hot page 141 are mapped to only one location m the hot page 14 when cached. The operatmg system may not allow allocation of any of the conflict pages 18. This effectively preserves the hot page 14 m the cache 10 and prevents it from bemg replaced by one of the conflict pages 18 In an alternative embodiment, the cache memory 10 is n-way (n > 2) set-associative (i.e., n lines per set) with S sets within the cache 10 In one embodiment, the size (e.g., 8KB) of the hot page 14 may be less than the number of sets S dependmg on n, the number of lmes per set, and on the size of the cache 10 (e g , 1MB). If the size of the hot page 14 is more than the number of sets S, then more than one cache line in the hot page 14 may need to be stored m a set contammg another cache block from the same hot page 14 In the preferred embodiment, the occunence of such a "roll-over" is eliminated by havmg more sets than the number of cache lines in a page. In a computer system with a set-associative cache memory 10, the operatmg system may be configured to implement in software a counter or a counter-type mechanism to mamtam a count for the maximum number of conflict pages that may also be allocated along with the correspondmg hot page 141. By way of an example only, when only one hot page 141 is designated, the operatmg system may set the highest count m the counter (not shown) to n- 1. Therefore, a maximum of n- 1 conflict pages (from the total conflict pages 18) may be simultaneously allocated with the hot page 141 to one or more program applications. Generally speakmg, if the number of hot pages is "m", i.e. when there is more than one hot page withm the system memory 12 (and also within the set-associative cache memory 10), the maximum number of conflict pages that may be allocated along with m hot pages is n-m. In this manner the operatmg system may accomplish hot page preservation m the cache 10 along with simultaneous allocation of one or more conflict pages Referring now to Fig. 3A, a flow chart for implementing one embodiment of the methodology for mamtammg hot pages m the system cache memory is illustrated. The first step 301 mvolves designating one or more hot pages m the system memory 12. The total number of hot pages may be fixed or vanable dependmg on the design choice. It is preferable, however, to have the total number of hot pages fixed so that the operatmg system may establish the amount of conflicting page space. At run-time, the operatmg system would designate one or more hot pages within that range of total number of hot pages. In one embodiment, the total number of hot pages may not exceed a predetermined limit because of the limited cache memory space 16 and because of the number of conflict pages 18 which are prevented from bemg allocated. In one embodiment, for example, the total number of hot pages may be restricted to eight with each hot page occupymg 8KB of cache memory of 256KB When the number of hot pages is dynamically modified, conflict misses may occur durmg cache memory accesses and overall system performance may be impacted Fig 3B illustrates two sub-steps of the oπgmal step 301 m Fig 3 A. The operatmg system may be configured to designate one or more hot pages under user control (step 301 A) In other words, the user may determine the critical data either at run-time or pπor to a program execution and may, then, request that the critical data be marked as constituting one or more hot pages dependmg on the size of the cntical data. The compiler software may also designate (to the operatmg system) relevant critical program data or text or any other digital information that need to remam in cache to enhance performance while lightly used data would be using other parts of the cache. An exemplary hot page may include instruction code that normally would conflict with data. In an FFT (Fast Founer Transform) application software, the roots of unity may be placed as part of a hot page because of their constant reuse. The Fourier transform data may not be marked as constituting "critical data" because it may constantly change during FFT program execution, i.e , it may have a short cache lifetime. If the total number of allocable hot pages is fixed, the operatmg system may prohibit the user to ovemde the total number limitation. In an embodiment where the total number of hot pages may be flexibly determmed or where the user may be allowed to go beyond the pre-fixed number of hot pages, the operatmg system in those situations may generate a warning message for the user when the number of hot pages reaches or exceeds a predetermined limit as determmed by the operatmg system based, for example, on the cache memory size and on the system memory physical allocable space This warning step is illustrated by block 30 IB in Fig. 3B and may take one of several forms, e g., audio warning signal, video display of a warning message, shutdown of one or more existing programs after wammg the user, restarting of the computer system m the event that the user does not heed the warning, etc. It may not be desirable to exceed the number of hot pages beyond a certain number because of potentially negative effects on the system performance. For example, because of the limited size of the cache memory 10, a large number of cache misses may occur and frequent thrashmg of cache data may result when the cache memory 10 becomes largely filled with hot pages. Similarly, the operating system may experience "page crunch" when much of the system memory becomes unallocable because of large number of conflict pages This may result in frequent, and slower, accesses to an auxiliary memory storage, e.g., a hard disk drive. Further, mcreased reduction m allocable physical memory space 20 may result in reduced application program execution performance, especially when the number of simultaneously executed program applications is large and the number of allocable physical memory pages are substantially reduced. To avoid such negative performance impacts, the operatmg system may be configured to determine the optimum number of hot pages that a user may be allowed to designate m view of the capacities of the system memory 12 and cache memory 10 However, as mentioned before, m the preferred embodiment the number of hot pages remains fixed and may not be changed by the user or may not be dynamically altered by the operatmg system. Referring back to Fig 3A, block 302 mdicates that the operatmg system identifies a correspondmg set of conflict pages for each hot page designated in step 301. By way of an example, when the hot page is of 8KB size and the cache memory is of 1MB size, then each conflict page (18-1, 18-2, 18-3, etc ) will be of 8KB size and will have an address that is a multiple of 1MB from the address of the hot page 141 as a base address. For example, the first 8KB page m a 64MB physical memory block may start at the following binary address: (x x x x x x x x x x x x 10000000000000) Further, all pages that map to the same cache memory storage location as the above hot page may have their addresses in the following binary form ( 00000000000000000000) Thus, in the present example, conflict pages would be located every 1MB m the system memory 12 Refemng now to Fig 4A, a free list 40 is shown stored m the physical system memory 12 Generally, all allocable physical memory page addresses are initially stored in the free list 40 by the operatmg system As each page gets allocated to an application, the operatmg system removes the page address information from the free list 40 Thus, the free list 40 may represent the available physical memory space that is free to be allocated at any given moment durmg program execution Generally, the operating system allocates the page from the top of the free list 40 (indicated by a software pomter 42) m response to a page allocation request from a task The pointer is then incremented to mdicate a new top of the free list Consulting Figs 3 A and 4A-4D together m step 303 (Fig 3 A) the prevention of allocation of one or more conflict pages identified in step 302 may be accomplished by configuring the operatmg system to locate address information for the conflict pages at the bottom of the free list 40 Fig 4B illustrates one such situation where hot page-1 is allocated before hot page-2, and the conflict pages corresponding to these two hot pages (conflict pages- 1 and conflict pages-2) are placed at the bottom of the free list 40 creatmg reduced allocable memory page addresses 44 Fig 4C illustrates a situation where one more hot page (hot page-3) gets allocated from the allocable memory page addresses 44 The address information for the correspondmg set of conflict pages (conflict pages-3) may then be placed at the bottom most locations of the free list 40 Finally, Fig 4D shows the conflict pages-2 as part of the allocable memory page addresses 44 when the conesponding hot page (hot page-2) is no longer allocated to an application program, I e , when the hot page-2 address information is placed back in the free list 40 The other two hot pages (hot page-1 and hot page-2) are shown still allocated by the operatmg system in Fig 4D It is noted that by merely placmg the addressing information for conflict pages at the bottom of the free list 40 there is no reduction in the actual allocable physical memory space Therefore, in one embodiment, the operatmg system may be modified to search the sorted free list starting from the top to the bottom when allocating the physical memory space (step 304) and may contmue to allocate system memory space until the first conflict page location is reached in the free list 40 (step 305) Subsequently, the operatmg system may not continue allocating system memory space, l e , the operatmg system may be configured to inhibit allocation of one or more conflict pages once all the pages for the physical memory locations represented by the numeral 44 m Figs 4B-4D are allocated (as indicated by step 306 m Fig 3 A) Because of the prevention of allocation of conflict pages through modified operating system software, the allocable memory page addresses 44 constrict at each mstance of allocation of a hot page from the free list 40 In one embodiment, the operatmg system may mark the addresses for conflict pages m the free list 40 usmg a flag or by addmg a bit to each address When a hot page is allocated, the addresses m the free list 40 that comprise one or more conflict pages may have their additional bits set so as to indicate to the pomter (while scanning the free list 40 from top to bottom during memory page allocation) that a conflict page address is reached Based on the total number of hot pages, on the address locations for those predetermined hot pages, and on the size of the system memory 12, the operatmg system may be configured to mark in advance (as with a flag or with an additional indicator bit, as mentioned above) conesponding memory page addresses in the free list 40 so as to enable the operating system (at run tune) to detect (through the pomter 42) when a conflict page location is reached while scanning the sorted free list A bit may be considered "set" when it represents binary "1", and "reset" when it represents binary "0" Alternative identification schemes may be devised to accomplish the same The placing of locations of conflict pages at the bottom of the free list 40 and the vaπability m the size of the allocable memory page addresses 44 may be implemented usmg the following pseudo code end of free list = length of free list - 1 do if (modulo (l, cache size) = page reserved m cache) then new free list (end of free list) = I else top of free list + + new free list (top of free list) = l end The pointer 42 may help the operatmg system replace an allocated memory page back into the appropπate location m the free list 40 A program code similar to the one written above may be written to implement pomter functions m the operating system software. Preferably, the sorted free list 40 and the searchmg of the free list (either through pomter 42 or through any suitable hardware or software mechanism) for allocable physical memory pages are kept simple for expedited processing of application programs. However, the operatmg system may be configured to give an overnde option to the user when the pomter 42 reaches the first conflict page location m the free list 40 (step 306, Fig. 3A). The user may, then, instruct the operating system to allocate one or more conflict pages even though that may result m displacement of correspondmg hot pages from the cache memory 10. In one embodiment, the step 306 may also be modified m a manner similar to that illustrated for step 301 m Fig. 3B. In other words, the operatmg system may be configured to warn the user when the user elects to allocate a conflict page. The operatmg system may place a restπctton on the number of conflict pages that may be simultaneously allocated by the user, m other words, the operatmg system may restrict the number of hot pages that may be replaced by the user dunng run- tune. Appropriate audio, video or audio-visual wammgs and/or shutdown operations may be executed by the operatmg system as descnbed earlier with reference to Fig. 3B In one embodiment, the amount of conflictmg space may be established by the operatmg system m advance of the execution of application programs The conflictmg space may then be marked as unallocable to an applicanon program, e.g., by marking the bottom portion of the free list contammg the location information of such pre-established conflict pages. In other words, the number of hot pages and address information of each hot page may be reserved in advance. Dunng run-tune, the operatmg system may simply allocate one or more hot pages from this reserved memory space. The operatmg system may identify these hot pages withm the free list 40 until one or more of them are allocated. In an alternative embodiment, the operatmg system may be configured to allow a user to establish a new free list contammg user-defined hot pages and correspondmg conflict pages. The user may be required to allocate hot pages from the predefined set of hot pages. Alternatively, the user may contmue defining a hot page (withm a predetermined limit, as discussed earlier) durmg run-time and the operatmg system may dynamically store conespondmg conflict page locations withm the new, user-created free list. The user may request that certam of his/her application pages be placed at the bottom of the user-created free list through an interface to malloc, calloc or mmap functions provided in the C programming language. For example, the top and the bottom of the user- defined free list may be specified by the following assignment operations' u = calloc (getarea, TOP) v = calloc (getarea, BOTTOM) where "getarea" element may designate the size of the user-defined free list Various alternative aπangements for designating hot pages are also possible as can be appreciated by one skilled in the art. As mentioned earlier, it may be preferable not to vary the size of the physical memory space that may be designated as one or more hot pages, either dunng initialization or at run-time. In one embodiment, the critical data that can be placed mto hot pages may be restricted to a maximum size of 64KB allowing eight hot pages of 8KB each. Page faults withm the memory management unit (MMU) may occur when the size of physical memory space allocable as one or more hot pages is dynamically modified. The foregomg discussion utilized the term "page" to refer to fixed-size memory blocks m a virtual memory addressing scheme. However, the methodology may also be implemented m a computer system where the memory addressing mechanism employs "segments" or variable size memory blocks, or a combmation of paged and segment addressmg Furthermore, page size may be programmable. As discussed before, the term "critical data" may refer to any significant digital information besides data and text generated durmg program executions. For example, the operatmg system may place, dunng initialization, the full content of the TSB (Translation Storage Buffer) m the computer system memory management unit mto one or more hot pages in the cache memory 10 This may allow for faster handlmg of TSB misses from the cache memory 10, thereby alleviating the need to access the slower system memory 12 for TSB data. In one embodiment, the content of the TSB (for virtual to physical memory address translation) may be of the order of Vi MB. As another example, the operating system (or the user) may designate various interrupt service routines or trap handler code as constituting the "critical data." The operating system may, then, place such critical data into one or more hot pages in the cache 10 to allow for faster interrupt servicing m the system Referring now to Fig 5, a computer system 50 comprising an operatmg system configured to allocate pages and mamtam hot pages as described above, and a storage medium 52 contammg the memory management software embodying the code to mamtam hot pages in the cache are shown. The storage medium 52 may take any of the various forms, such as a floppy disk, an optical disk, a magnetic tape, a compact disk, a video disk, etc The storage device 52 may be external to the computer system 50, or it may be built mto the computer system 50 The storage medium can be within another computer system 72 (Fig. 7) that transmits the operating system including the memory management software or simply the memory management software to the receiver computer system, e.g., one or more of the computer systems 74, 76 and 78 in Fig. 7, via a communication network as illustrated in Fig. 7. Fig. 6 illustrates an exemplary hardware configuration of the computer system 50. The computer system 50 may comprise a processmg unit 60 coupled to an external cache memory 10 via a high-speed CPU bus 62. The processing unit 60 may mclude one or more of the commercially available processing units, e.g., the Intel x86 family of processors, the Sun SPARC family of processors, etc As previously described, the cache memory 10 may be internal to the processmg unit 60 The system memory 12 is shown coupled to the processing unit 60 via a bus bridge 66. In an alternative embodiment, the physical bus bridge 66 that routes digital signals among various system devices may be absent. Finally, one or more peripheral devices 68 may be coupled to the processing unit 60 via one or more expansion buses 64 Some examples of an expansion bus 64 include a PCI (Peripheral Component Interconnect) bus, an ISA (Industry Standard Architecture) bus, an MCA (Micro Channel Architecture) bus, a USB (Universal Serial Bus) bus, a SCSI (Small Computer System Interface) bus, a Fibre Channel, etc. The peripheral device 68 may be external to the physical unit embodying various other devices of the computer system 50 The peripheral device 68 may mclude one or more of the following, a hard disk drive, a video monitor, a storage array, a compact disk dπve. a floppy disk drive, a keyboard, etc. The complete operating system may reside m the peripheral device 68, and only a portion of the operating system routines may be loaded into the system memory 12 as shown in Fig. 2. In one embodiment, the storage device 52 may supply necessary memory management software routines to the operatmg system, which, in turn, may load that software into the system memory 12 dunng system initialization or at run-tune. Refemng now to Fig. 7, one example of how the methodology may be implemented m one computer system using a second computer system in a communication network as a storage medium for the operatmg system including the memory management software or simply the memory management software is illustrated As described before, the computer system 72 may transmit the necessary operating system (with memory management software) routines or simply the memory management software routines to one or more computer systems (74, 76, and 78) connected to it via a communication network 70. The communication network, for example, may be a local area network (LAN), a wide area network (WAN), the Internet, a wireless communication network (including satellite communication), or any other data communication mechanism. The foregoing discloses a software methodology for cache data management within a computer system The operatmg system software within the computer system may be configured to designate one or more selected system memory pages as hot pages. The operatmg system may then prevent allocation to vaπous application programs of one or more conflict pages that, when cached, map to the selected hot pages withm the cache memory in the system. This allows for preserving the hot pages withm the cache memory, and is useful especially m a situation where the hot pages contam cntical data. The operatmg system software may be configured to utilize the sorted free list in the system memory to control allocation of one or more conflict pages. The user may also control replacement of hot pages from the cache memory While the invention is susceptible of vaπous modifications and alternative forms, specific embodiments thereof are shown by way of examples in the drawmgs and are herein described in detail It should be understood, however, that the drawings and detailed description thereto are not intended to limit the invention to the particular forms disclosed, but on the contrary, the mtention is to cover all such modifications, equivalents and alternatives as may fall within the spirit and scope of the present mvention as defined by the appended claims

Claims: What is claimed is' In a computer system having a cache memory and a system memory, a method of cache data management comprising: designating a first page within said system memory, wherein said first page comprises a plurality of cache lmes; and preventing replacement of said first page upon bemg cached withm said cache memory durmg execution of one or more applications in said computer system. 2. The method as in claim 1. wherein said first page is a portion of said system memory that contains critical data and or instructions. 3. The method accordmg to claim 2, wherein said critical data is defined at run-time by a user of said computer system. 4. The method of claim 3, further comprising: warning said user when size of said cntical data exceeds a predetermined limit. 5. The method as in claim 1, wherein said preventmg said replacement of said first page compnses: locatmg one or more conflict pages withm said system memory, wherein each of said one or more conflict pages is a portion of said system memory that maps to said first page when cached; and inhibiting allocation of said one or more conflict pages to said one or more applications being executed in said computer system 6. The method of claim 5, wherein said locatmg said one or more conflict pages comprises: establishing a sorted free list in said system memory, wherein said sorted free list contains location information for memory space m said system memory that is allocable to said one or more applications during said execution thereof; and placmg said location information for said one or more conflict pages at the bottom of said sorted free list. 7 The method as recited in claim 6, wherem said inhibiting said allocation includes: scanning said sorted free list from top to bottom when allocating memory pages to said one or more applications during said execution thereof; and continumg allocating said memory pages until a conflict page from said one or more conflict pages is reached. The method according to claim 7 wherein said scanning said sorted free list is accomplished through a pointer The method as m claim 5, wherein said locating said one or more conflict pages compnses reserving m said system memory a space that contains addressing information for accessing said one or more conflict pages, and markmg said space as unallocable durmg said execution of said one or more applications, wherein said marking and said reserving are performed during power-up of said computer system based on a predetermined size of said first page A method of selectively replacmg data m a cache memory of a computer system havmg a system memory to store said data, said method comprising designating a plurality of pages within said system memory, wherein each of said plurality of pages contains a portion of said data, identifying one or more conflict pages for each of said plurality of pages, wherem each conflict page is a memory space in said system memory that maps to a correspondmg one of said plurality of pages when cached, and controlling allocation of said one or more conflict pages to one or more applications being executed in said computer system The method according to claim 10, wherein said each of said plurality of pages is of equal size The method as in claim 10, wherem said plurality of pages mcludes a first page and a second page, and wherem said controlling said allocation of said one or more conflict pages comprises reserving m said system memory a free list that contains location information to access allocable memory pages in said system memory, placing said location information for said one or more conflict pages that conespond to said second page at the bottom of said free list, further placing said location information for said one or more conflict pages that conespond to said first page at a first space m said free list immediately preceding said location information for said one or more conflict pages conespondmg to said second page, and allocating to said one or more applications physical portions of said system memory that are accessible by said location information contamed above said location information for said one or more conflict pages corresponding to said first page The method of claim 12, wherein said plurality of pages further mcludes a third page, and wherem said controlling said allocation of said one or more conflict pages is modified to mclude further placing said location information for said one or more conflict pages that conespond to said third page at said bottom of said free list while moving said location information for said one or more conflict pages conespondmg to said first and said second pages upwards m said free list so as to immediately precede said location information for said one or more conflict pages conespondmg to said third page, and further allocating to said one or more applications said physical portions of said system memory that are accessible by said location information contained above said location information for said one or more conflict pages conespondmg to said first page The method as recited in claim 10, further comprising discontmumg designating one of said plurality of pages and wherein said controlling said allocation of said one or more conflict pages includes allowing said allocation of said one or more conflict pages that conespond to said one of said plurality of pages The method accordmg to claim 10, wherein said controlling said allocation of said one or more conflict pages includes allowing a user to inhibit said allocation of said one or more conflict pages to said one or more applications A computer system comprising a processing unit, a system memory coupled to said processing unit to store data among a plurality of memory pages, a cache memory coupled to said processmg unit and said system memory, and an operating system to manage execution of a plurality of applications through said processing unit and said system memory, wherem said operating system is configured to identify a first page within said system memory and to prevent replacement of said first page withm said cache memory during said execution of said plurality of applications The computer system of claim 16, wherein said cache memory is direct-mapped The computer system as in claim 16, wherein said cache memory is set-associative The computer system according to claim 16 wherein said operating system is configured to selectively prevent replacement of said first page by inhibiting allocation of one or more conflict pages, wherein each conflict page is a memory space in said system memory that maps to said first page when cached The computer system of claim 16, wherein said system memory includes a free list contammg location information for memory space in said system memory that is allocable to said plurality of applications during said execution thereof, and wherein said operatmg system is configured to mark as unallocable a predetermined portion of said free list to prevent allocation of said one or more conflict pages The computer system as recited in claim 19, wherein said system memory includes a user-defined free list that contains addressing information for accessmg said one or more conflict pages, and wherem said operating system inhibits said allocation of said one or more conflict pages based on a user command, thereby allowing a user to control said replacement of said first page The computer system as in claim 21 , wherem said first page is one of a plurality of pages identified by said operating system, and wherein said operatmg system is configured to warn said user when combined size of said plurality of pages exceeds a predetermined limit A storage medium contammg a cache data management program, wherem said cache data management program is executable by a computer system when received from said storage medium and placed withm a system memory in said computer system, and wherein upon execution said cache data management program performing the following designatmg a first memory space withm said system memory in said computer system, wherem said first memory space contams critical data and/or instructions, identifying a second memory space within said system memory in said computer system, wherein said second memory space maps onto said first memory space when cached, and preventmg allocation of said second memory space to one or more applications bemg executed in said computer system upon caching of said first memory space The storage medium of claim 23, wherem said preventmg said allocation of said second memory space is performed at run-time under user control The storage medium accordmg to claim 23, wherem said preventmg said allocation of said second memory space compnses: reserving m said system memory a free list that contams location information to access allocable memory pages m said system memory; placmg said location mformation for said second memory space at the bottom of said free list; and allocating to said one or more applications only those portions of said system memory that are accessible by that location information in said free list which is contamed above said location information for said second memory space.

Inventors: PARADY BODO, PARADY, BODO
Applicants: SUN MICROSYSTEMS INC, SUN MICROSYSTEMS, INC.
Application year: 2000
Main classification: H01J49
IPC codes: G06F12