UPDATING READ-ONLY SOFTWARE MODULES

Abstract: A method and system are described for updating software modules bundled in a read-only device of a computer. According to the invention, when a software module is to be executed from the read-only device, the operating system identifies any other software modules stored within the read-only device on which the application depends. After identifying all of the dependencies, the operating determines whether a newer version of any of the identified software modules has been installed on the computer. The operating system copies into a read/write device a portion of the software module that references the old software modules. After copying the portion, the operating system modifies all references to point to the new versions of the software module. The invention allows software modules to be primarily executed from the read-only device with only a small updated portion being executed from a read/write device.

Description: UPDATING READ-ONLY SOFTWARE MODULES TECHNICAL FIELD This invention relates generally to the field of data processing and more particularly to a method and system for updating read-only software in a computing system. BACKGROUND Many conventional systems have mechanisms for executing software modules that are bundled in a read-only device such as a read-only memory (ROM). The software modules within the read-only device may be software applications, such as word processing software, or may be shared software libraries that are used by the applications during execution. For example, a readonly device may contain dynamically linked libraries (DLL's) that are shared by the software applications stored within the read-only device. Speed and memory efficiencies can be achieved by executing the software applications and the libraries directly from the read-only device and not requiring that they be first loaded into random access memory (RAM). One problem with this approach is that in order to make even a small modification to one of the software modules the entire read-only device must be reprogrammed or replaced. For these reasons, and for other reasons stated below which will become apparent to those skilled in the art upon reading and understanding the present specification, there is a need in the art for a mechanism by which read-only software modules can be updated without requiring that the read-only device be reprogrammed or replaced. Furthermore, there is a need for a mechanism by which read-only software modules can be updated dynamically at the time of execution. SUMMARY The invention provides a mechanism by which software modules executing from a read-only device may be updated to use newer versions of other software modules without requiring that the device be reprogrammed or replaced. The invention advantageously allows software modules to be primarily executed directly from the read-only device while only a small updated portion is executed from read/write device. The software modules may be stand- alone software applications or shared software libraries. According to one aspect, the invention is a method of executing a software module on a computing system. A portion of the software module is loaded from a read-only device into a read/write device. The loaded portion of the software module is executed directly from the read/write device while a remainder of the software module is executed from the read-only device. In one embodiment virtual memory is allocated for both the portion of the software module loaded within the read/write device and for the remainder of the software module within the read-only device. The loaded portion of the software module is modified to correctly address the newer software modules. Much of the software module is executed directly from the read-only device while just the modified portion is executed from the read/write device. According to another aspect, the invention is a computing system having a read-only device that contains a first portion of a software module. A read/write device contains a second portion of the software module. An operating system executes the software module by executing the first and second portions of the software module from their corresponding devices. BRIEF DESCRIPTION OF THE DRAWINGS FIG. 1 is a diagram of the hardware and operating environment of a limited resource computer in conjunction with which embodiments of the invention may be practiced; FIG. 2 is a block diagram showing functional components of the computer shown in FIG. 1 ; FIG. 3 is a block diagram illustrating one embodiment of a read-only device having executable software applications and shared libraries; FIG. 4 is a block diagram that illustrates a mapping from virtual memory to physical memory that includes read-only memory (ROM) and random-access memory (RAM); and FIG. 5 is a flowchart illustrating one mode of operation in which the invention updates software modules stored in a read-only device without requiring that the contents of the read-only device be reprogrammed. DETAILED DESCRIPTION In the following detailed description of exemplary embodiments of the invention, reference is made to the accompanying drawings that form a part hereof and, which show by way of illustration, specific exemplary embodiments in which the invention may be practiced. These embodiments are described in sufficient detail to enable those skilled in the art to practice the invention. It is to be understood that other embodiments may be utilized and that logical, mechanical, electrical and other changes may be made without departing from the spirit or scope of the present invention. The following detailed description is, therefore, not to be taken in a limiting sense, and the scope of the present invention is defined only by the appended claims. The detailed description is divided into four sections. The first section describes the hardware and the operating environment that is suitable for use with the invention. The second section provides a detailed description of the embodiments of the inventive system. The third section provides methods for operating an exemplary embodiment of the invention. Finally, the fourth section provides a conclusion of the detailed description. Hardware and Operating Environment FIG. 1 is a diagram of resource-limited computer in which read-only applications are updated at run-time according to the various embodiments of the invention. The invention is described in the general context of computer- executable instructions, such as program modules, being executed by a computer, such as a personal computer. Generally, program modules include routines, programs, objects, components, data structures, etc., that perform particular tasks or implement particular abstract data types. FIG. 1 illustrates a typical handheld personal computer (H/PC) 20 having limited computing resources. H/PC 20 has a casing 22 with a cover or lid 24 and a base 26. H/PC 20 has a liquid crystal display (LCD) 28 with a touch -sensitive screen mounted to the lid 24. The lid 24 is hinged to the base 26 so as to pivot between an open position, which exposes display 28, and a closed position, which protects the display. The H/PC 20 is equipped with a stylus 30 to enter data through the touch screen display 28 and a miniature keyboard 32. The stylus 30 and keyboard 32 are both mounted in base 26. H/PC 20 can also be implemented with a wireless transceiver (not shown) such as an infrared transceiver and/or an radio frequency transceiver. Although the illustrated implementation shows a two-member H/PC 20 with a lid 24 and a base 26, other mechanical implementations of the H/PC might also be used. FIG. 2 illustrates the primary functional components of the H/PC 20 shown in FIG. 1. The H/PC 20 includes microprocessor 40 that executes operating system 48. Processor 40 has three modes of operations: full-speed, standby and suspend. Full-speed mode is used to execute applications. Standby mode is used during brief idle periods. Suspend mode is used during long idle periods and uses less than one-thousandth of full speed power. H/PC 20 includes timers 42 for providing interrupts and other timer events as well as the current date and time. Read-only memory (ROM) 44 stores operating system 48 as well as bundled applications 56. Random access memory (RAM) 46 includes user area 52 for executing user-installed applications and object store 54 for storing data. Object store 54 is used in place of conventional direct-access storage devices like disk and tape drives. In addition, object store 54 maintains a registry for H/PC 20. User input and output devices 60 communicate with external devices. Similarly, connectivity block 62 represents a number of standard connectivity devices such as a serial port, infrared communications hardware, etc. The hardware and operating environment in conjunction with which embodiments of the invention may be practiced has been described. The following section provides a more detailed description of the embodiments of the inventive system. System Level Overview FIG. 3 illustrates one embodiment of a read-only memory (ROM) 44 having software applications 56 and shared libraries 135 stored therein. Readonly memory (ROM) 44 may be any memory-addressable device that is readonly or any device which only supports block writes such as flash memory, a flash memory card, etc. Software applications 56 represent application programs, such as word processing software, that are stored in ROM 44 and which primarily execute from ROM 44 in order to increase initial execution speed and to conserve RAM 46. Libraries 135 are not stand-alone applications but are invoked by applications 56 or even by other libraries 135. For example, in one embodiment libraries 135 are dynamically linked libraries (DLL's). Within this application, the term software module includes both software applications 56 and libraries 135. Table of contents 120 lists all software applications 56 and libraries 135 stored within ROM 44 and provides a corresponding starting address for each software module. As discussed above, in conventional resource-limited computing devices any change to libraries 135 often requires reprogramming or replacing the entire ROM 44. With consumer-oriented products, such as with palmtop and even laptop computers, this is especially problematic because it requires the user or a service technician to physically install a new ROM 44. A user cannot simply load a new version for one of the libraries 135 to hard disk drive 27 because all references to the replaced library 135 within ROM 44 will be unchanged and will incorrectly point to the old version. Thus, in conventional systems, users are forced to replace the entire read-only device, rewrite the entire device in the case of a flash memory device, or use the old versions of applications 56 and libraries 135. In order to illustrate the invention, assume the user has installed a newer version of library 135D onto computer 20 and that software application 56A depends on library 135D. According to the invention, when software application 56A is to be executed, operating system 48 identifies libraries 135 on which the application 56 depends. After identifying all of the dependencies, operating system 48 determines whether a newer version of any of the identified libraries 135 has been installed on the computer 20. Thus, in this example operating system 48 determines that software application 56A depends on library 135D and that a newer version of library 135D has been loaded onto computer 20. Because a new version of library 135D has been installed, operating system 48 updates application 56 and any other required libraries 135 that depend on library 135D such that they correctly reference the new library. More specifically, operating system 48 allocates one or more physical pages in RAM 46 and copies into RAM 46 a portion of application 56A that references library 135D. After copying the portion, operating system 48 modifies all references to point to the new version of library 135D. Operating system 48 repeats this process for each library 135 on which application 56A depends and that references the library 135D. Next, operating system 48 executes software application 56A from both ROM 44 and RAM 46. In this manner, much of software application 56Ais executed from ROM 44 while just the updated portion is executed from RAM 46. The updated libraries 135 are similarly executed. In this manner the invention facilitates updates to any of the libraries 135 contained within the ROM 44. If a new version for library 135D had not been installed then operating system 48 would have executed software application 56A directly from ROM 44 without modification. As illustrated in FIG. 4, in one embodiment operating system 48 includes a virtual memory (VM) system that maps virtual memory 140 to physical memory 145. More specifically, the VM system maps virtual memory pages 155 to physical pages located within either ROM 44 or RAM 46. In this embodiment, most of the virtual memory pages 155 that are allocated for executing applications 56 are mapped directly to the physical pages within the ROM 44. A small number of virtual memory pages 155, however, are allocated for the portions that have been modified in RAM 46. By using the VM system to map virtual memory pages to both ROM 44 and RAM 46, computer 20 can seamlessly execute applications 56 and libraries 135 with only initial modification to a small portion of the software. Methods of an Exemplary Embodiment of the Invention In the previous section, a system level overview of the operation of exemplary embodiments of the invention was described. In this section, the particular methods performed by the exemplary embodiments are described by reference to a flowchart. The methods to be performed by the embodiments constitute computer programs made up of computer-executable instructions. Describing the methods by reference to a flowchart enables one skilled in the art to develop such programs including such instructions to carry out the methods on suitable computers from computer-readable media. FIG. 5 is a flowchart 400 illustrating one exemplary method of operation of operating system 48 for updating at run-time software modules residing in ROM 44. Much of flowchart 400 is contained within loop 403 in which operating system 48 updates one of the software applications 56 that is to be executed and then repeats loop 403 for each required library 135. Operating system 48 begins flowchart 400 with block 402 and enters loop 403 by proceeding to block 404. In block 404, operating system 48 identifies all libraries 135 that are necessary to execute the desired software application 56. In one embodiment each software application 56 and each library 135 contains an import table that lists all libraries 135 that are necessary for execution. An import table for a software module is an array of 32-bit pointers that identifies all necessary imports for a software module. The last entry is set to zero (NULL) to indicate end of the table. For example, the import table for software application 56A may identify libraries 135A, 135B and 135C as necessary for execution. In block 406 operating system 48 determines whether a new version has been installed for any of the identified libraries 135. In order to determine whether a new version exists, the operating system 48 follows a predefined search path while looking for files having identical names to required libraries 135. For example, operating system 48 examines the root directory for any mounted volumes, the root directory for the built-in volume of H/PC 20 and an operating system specific directory. Any file found by operating system 48 that has the identical name as one of the required libraries 135 is presumed to be a newer version. If no newer versions have been installed, operating system 48 jumps to block 412 and repeats loop 403 for each library 135 that is necessary for execution of the software application 56A. If a new version has been installed for one or more of the necessary libraries 135 then operating system 48 proceeds from block 406 to block 408. In block 408 operating system 48 allocates one or more physical pages within RAM 46 and loads a portion of the software application 56 into the allocated pages. More specifically, operating system 48 loads the physical pages from ROM 44 to RAM 46 that contain the references to the replaced library 135. For example, in one embodiment operating system 46 loads the import table, or a portion thereof, into RAM 46. In block 410, operating system 48 modifies the portion of application 135 that has been loaded into RAM 46. Operating system 48 updates the RAM- based portion such that any reference to a replaced library 135 now points to the new version. In one embodiment, operating system 48 modifies the import table that has been copied to RAM 46. After updating RAM-based portion, operating system 46 proceeds to block 412 and repeats loop 403 for each library 135 necessary to execute the desired software application 56. When all of the dependencies have been examined and all libraries 135 have been updated if necessary, operating system 48 exits loop 403 and proceeds to block 414. In block 414 operating system 48 executes application 56. In order to execute an application, operating system 56 allocates a set of virtual memory pages 155 that map to the physical memory pages consumed by the application 56 and any necessary libraries 135. If portions of application 56 and the necessary shared modules 135 have been copied to RAM 46, operating systems 56 instructs the VM system to map the virtual memory pages 155 to the updated portions. Once virtual memory 140 has been allocated for the ROM -based portions and the RAM-based portions, computer 20 seamlessly executes software application 56. After software application 56 has completed execution, operating system 48 proceeds to block 416, deallocates virtual memory pages 155 and removes all portions of software application 56 and libraries 135 that have been copied to RAM 46. Conclusion Various embodiments for updating software modules stored in a readonly device of a computer have been described. The invention provides a mechanism by which a user can install newer versions of software modules that are used by ROM-based software modules without requiring that the user install a new ROM. The invention advantageously allows software modules to be primarily executed from the read-only device while only a small portion is updated and executed from a read/write device. The software modules may be stand-alone software applications or shared software libraries. Although specific embodiments have been illustrated and described herein, it will be appreciated by those of ordinary skill in the art that any arrangement which is calculated to achieve the same purpose may be substituted for the specific embodiments shown. Therefore, this application is intended to cover any adaptations or variations of the present invention.

Claims: What is claimed is: 1. A method of executing a software module on a computing system comprising: loading a portion of a first software module from a read-only device within a computer into a read/write device within the computer; and executing the loaded portion of the first software module from the read/write device and a remainder of the first software module from the readonly device. 2. The method of claim 1, wherein loading the portion of the first software module includes copying the portion from Read-Only Memory (ROM) to Random Access Memory (RAM). 3. The method of claim 1, wherein the executing step includes allocating virtual memory for the loaded-portion of the first software module within the read/write device and for the remainder of the first software module within the read-only device. 4. The method of claim 1, wherein the loading step includes copying at least one physical memory page from the read-only device to a physical memory page of the read/write device. 5. The method of claim 1, wherein loading the portion of the first software module includes: identifying a set of references within the first software module that refer to other software modules that have been updated with newer software modules; and copying the identified set of references to the read/write device. 6. The method of claim 5, wherein loading the portion of the first software module includes modifying the set of references to address the newer software modules. 7. The method of claim 5, wherein identifying the references includes examining an import table for the first software module, wherein the import table lists the references to the other software module. 8. The method of claim 7, wherein identifying the set of references includes examining import tables for the software modules listed within the import table of the first software module. 9. A computer-readable medium having computer-executable instructions to cause a computer to perform the method of: loading a portion of a first software module from a read-only device within a computer into a read/write device within the computer; and executing the loaded portion of the first software module from the read/write device and a remainder of the first software module from the readonly device. 10. A computing system comprising: a read-only device containing a first portion of a software module; a read/write device containing a second portion of the software module; and an operating system that executes the software module by executing the first and second portions of the software module from their corresponding devices. 11. The computing system of claim 10, wherein the operating system loads the first portion of a software module from the read-only device into the read/write device. 12. The computing system of claim 10, wherein the read-only device is Read-Only Memory (ROM) and the read/write device is Random Access Memory (RAM). 13. The computing system of claim 10, wherein the operating system includes a virtual memory system to allocate virtual memory for the first portion and the second portion of the software module. 14. The computing system of claim 10, wherein the operating system copies at least one physical memory page from the read-only device to a physical memory page of the read/write device. 15. The computing system of claim 10, wherein the operating system: identifies a set of references within the software module that refer to other software modules within the read-only device that have newer versions installed within the computing system; and copies the set of references to the read/write device. 16. The computing system of claim 15, wherein the operating system modifies the references to refer to the newer software modules. 17. The computing system of claim 15, wherein the first portion of the software module includes an import table for the first software module, wherein the import table lists the references to the other software module, and further wherein the operating system examines the import table to identify the references that refer to the newer software modules. 18. A method of executing a software module stored within a on a read-only memory (ROM) of a computing system comprising: identifying a set of references within the software module that refer to other software modules within the ROM that have a corresponding newer version loaded on the computing system; copying the set of references from the ROM into a random access memory (RAM) within the computing system; allocating virtual memory for the references stored in RAM and for a remaining portion of the software module stored in ROM; and executing the remaining portion of the software module from the ROM. 19. The method of claim 18, wherein the software module is a dynamically linked library (DLL). 20. A computer-readable medium having computer-executable instructions to cause a computer to perform the method of: identifying a set of references within the software module that refer to other software modules within the ROM that have a corresponding newer version loaded on the computing system; copying the set of references from the ROM into a random access memory (RAM) within the computing system; allocating virtual memory for the references stored in RAM and for a remaining portion of the software module stored in ROM; and executing the remaining portion of the software module from the ROM. 21. A resource-limited computing device comprising: a read-only device containing a software module; a read/write device operable to receive a modified portion of the software module; and an operating system that executes an unmodified portion of the software module from the read-only device. 22. The resource-limited computing device of claim 21 , wherein the operating system executes the modified portion of the software module from the read-only device. 23. The resource-limited computing device of claim 21 , wherein the readonly device is Read-Only Memory (ROM) and the read write device is Random Access Memory (RAM). 24. The resource-limited computing device of claim 21, wherein the operating system includes a virtual memory system to allocate virtual memory for the modified portion and the unmodified portion of the software module. 25. The resource-limited computing device of claim 21 , wherein the operating system copies at least one physical memory page from the read-only device to a physical memory page of the read/write device. 26. The resource-limited computing device of claim 21 , wherein the operating system: identifies a set of references within the software module that refer to other software modules within the read-only device that have newer versions installed within the computing device; and copies the set of references to the read/write device. 27. The resource-limited computing device of claim 26, wherein the operating system modifies the references to refer to the newer software modules. 28. The resource-limited computing device of claim 26, wherein the software module includes an import table that lists the references to the other software module within the read-only device, and further wherein the operating system examines the import table to identify the references that refer to the newer software modules.

Inventors: GINSBERG MICHAEL, GINSBERG, MICHAEL
Applicants: MICROSOFT CORP, MICROSOFT CORPORATION
Application year: 2000
Main classification: G06F9
IPC codes: G06F9