WO2010113380A1 - Calculator system - Google Patents

Calculator system Download PDF

Info

Publication number
WO2010113380A1
WO2010113380A1 PCT/JP2010/000804 JP2010000804W WO2010113380A1 WO 2010113380 A1 WO2010113380 A1 WO 2010113380A1 JP 2010000804 W JP2010000804 W JP 2010000804W WO 2010113380 A1 WO2010113380 A1 WO 2010113380A1
Authority
WO
WIPO (PCT)
Prior art keywords
unit
shared
block
data
read
Prior art date
Application number
PCT/JP2010/000804
Other languages
French (fr)
Japanese (ja)
Inventor
高橋雅彦
Original Assignee
日本電気株式会社
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 日本電気株式会社 filed Critical 日本電気株式会社
Publication of WO2010113380A1 publication Critical patent/WO2010113380A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/544Buffers; Shared memory; Pipes

Definitions

  • the present invention relates to a computer system, and more particularly to a computer system including an external storage device that stores a file containing read-only data, a main storage device that includes a shared memory unit, and a data processing device.
  • Protection attributes such as read (read), write (write), execute (execute), etc. can be set independently for the memory, so if you set the protection attributes appropriately when reading a program or shared library into the memory For example, when there is a bug in the program, an appropriate countermeasure can be taken.
  • a program and a shared library are divided into a text area (program body to be executed) and a data area (data used when executing the program).
  • a data area data used when executing the program.
  • the text area sets read and execute attributes
  • the data area sets read and write attributes. That is, the value in the data area can be rewritten, while the value in the text area cannot be rewritten.
  • the text area is read-only, the text area of the same shared library can be shared with another program even while a certain program is being executed.
  • a memory address used in a program at the time of memory access is called a virtual memory address (or virtual address).
  • the virtual memory address designated by the program is converted into a fixed physical memory address (or physical address) of the actually mounted memory. This address conversion work is performed at high speed by hardware called MMU (Memory Management Unit).
  • the MMU manages the memory separately for each block.
  • a certain virtual memory address is divided into a virtual block address and an intra-block offset.
  • a certain physical memory address is divided into a physical block address and an intra-block offset.
  • the intra-block offset uses the intra-block offset of the virtual address as it is as the intra-block offset of the physical address, and converts the virtual block address into a physical block address.
  • a method in which one virtual storage area exists in the entire computer system and the virtual storage area is divided into partitions and used is called a single virtual storage system.
  • a method of assigning independent virtual memory for each program is called a multiple virtual memory method.
  • storage protection and security can be maintained between programs.
  • the shared library is mapped so as to have the same address on the shared memory.
  • the text library When arranging the text area of the shared library in the shared memory, the text library is arranged so that the head address of the text area of the shared library matches the head address of the memory block (for example, see FIG. 8 of Patent Document 1).
  • the data area of the shared library needs to be changed from the text area and the protection attribute, the data area is arranged in a memory block different from the memory block in which the text area is arranged.
  • the start address of the data area is arranged in an area starting from a position shifted from the start address of the memory block by an offset equal to the size of the text area (for example, see Non-Patent Document 1). .
  • the size of the text area of the shared library is not necessarily the same as the memory block size. For this reason, the problem of an area that cannot be used in the memory block occurs. This problem is called internal memory fragmentation.
  • there are two shared libraries A and B where the text areas are a and b, and the data areas are a 'and b'.
  • the size of the memory block is 4 kilobytes and the size of the text area and data area of the shared libraries A and B is 4 kilobytes or less, if these two shared libraries A and B are arranged in the shared memory, for example, FIG. As shown. In FIG. 8, an unhatched area in the memory block and an offset area located in front of the data areas a 'and b' are unused areas.
  • a computer system capable of changing the size of a memory block has been put into practical use in accordance with the increase in the amount of memory mounted and the necessity of efficient memory management.
  • a computer system that can specify any size among nine types of block sizes, 4 kilobytes, 16 kilobytes, 256 kilobytes, 1 megabyte, 4 megabytes, 16 megabytes, 64 megabytes, and 256 megabytes.
  • the file size of the shared library is not necessarily increased accordingly.
  • the internal fragmentation of the memory increases as the block size increases.
  • a larger unused area is created in the memory block, resulting in a situation where the memory cannot be used up.
  • the unused area generated in the memory block in which the data areas a ′ and b ′ are arranged has a problem in terms of storage protection and file structure, but the memory in which the text areas a and b are arranged.
  • the unused area generated in the block has room for reduction.
  • An object of the present invention is to provide a computer system that solves the above-described problem, that is, the problem that the internal fragmentation of a memory becomes large when loading read-only data of a file into a shared memory.
  • the computer system of the present invention includes an external storage device that stores a plurality of files including read-only data that is commonly used by one or more programs, and a main memory that includes a shared memory unit that is commonly used by the one or more programs. Execution of a program for loading read-only data of a plurality of files into the same memory block of the shared memory unit in a computer system comprising a device and a data processing device connected to the external storage device and the main storage device A part.
  • the internal fragmentation of the memory that occurs when loading the read-only data of the file into the shared memory can be reduced.
  • FIG. 10 is an explanatory diagram of a method for arranging a shared library in a memory block in Patent Document 1.
  • FIG. FIG. 5 is an illustration of a method according to the invention for placing a shared library in a memory block. It is a figure which shows the example of allocation of the physical block address of a main memory. It is a figure which shows the state of a certain time of the mapping table part of a 1st execution program. It is a figure which shows the example of the content at another time of the mapping table part of a 1st execution program. It is a figure which shows the example of the content at a certain time of the mapping table part of a 2nd execution program. It is a figure which shows the example of the content at another time of the mapping table part of a 2nd execution program.
  • the computer system 100 includes at least a main storage device 110, an external storage device 120, and a data processing device 130 that operates under program control.
  • the main storage device 110 includes a shared memory unit 111.
  • the shared memory unit 111 is a memory shared between programs (application programs and the like), and is managed by being divided into blocks having the same size as the virtual storage block of the program.
  • the block size is variable, and an arbitrary size can be designated from a plurality of predetermined sizes.
  • the minimum value of a plurality of predetermined sizes is 4 kilobytes (4,096 bytes), and the remaining size is 2 n times (n is a positive integer of 1 or more) times 4 kilobytes. It is a size.
  • the reason why the remaining block size is 2 n times the minimum size is as follows.
  • the shared library 1211 is loaded so that its head address coincides with an address boundary determined by the minimum size. For this reason, if the size of the remaining block is not 2 n times the minimum size, a case may occur where the head address of the block does not coincide with the address boundary determined by the minimum size. This is because when the first shared library is loaded into the block, an empty area is generated at the beginning of the block.
  • Each block of the shared memory unit 111 can be shared by a plurality of programs.
  • the text area of the shared library is read by the data processing device 130.
  • the text area of the shared library read into the block of the shared memory unit 111 is called from the program and used.
  • the external storage device 120 includes a file system unit 121.
  • the file system unit 121 holds an execution file, a shared library, and other files necessary for the execution of the data processing device 130.
  • the shared library 1211 includes one or more library functions that are commonly used by one or more programs.
  • the external storage device 120 is used for reading a file, but the method of using the external storage device 120 is not limited thereto.
  • the data processing device 130 includes a shared memory management unit 131, a shared memory management table unit 132, a program execution unit 133, a shared library management table unit 134, a mapping table unit 135, and a mapping address determination unit 136. Composed.
  • the shared memory management table unit 132 is a table for managing the usage status of the shared memory unit 111.
  • FIG. 5 shows the structure of one entry of the shared memory management table unit 132, which is composed of a shared memory block address 1321, a head physical address 1322, and a free size 1323.
  • the entry of the shared memory management table unit 132 includes attributes representing access restrictions such as read / write / execution of access to the shared memory unit 111 and other attributes for control. May be.
  • the shared memory block address 1321 is a number (memory block number) used when managing the shared memory unit 111 in block size.
  • the start physical address 1322 is the start physical address of the block of the shared memory unit 111.
  • the empty size 1323 indicates an unused memory size in the block of the shared memory unit 111.
  • the initial value of the empty size 1323 is a block size, and every time a new shared library 1211 is loaded into the block, an amount corresponding to the size of the shared library 1211 is subtracted.
  • the on-demand paging method is a method in which a physical page (physical block) is allocated to a logical page (logical block) at the time when the memory contents of the corresponding address are required.
  • the page is not read into the memory unless the page is actually accessed, so that the memory usage can be kept low.
  • the block size of the computer system 100 is the minimum block size of 4 KB
  • the page size is also 4 KB. That is, pages are read into the memory in units of 4 KB. Therefore, if the top address of the shared library 1211 always coincides with the 4 KB boundary, the shared library 1211 having a capacity of 4 KB or less can be accommodated in one page, and can be read into the memory by paging processing for one page.
  • the shared memory management table unit 132 may have various management methods other than those described above. For example, a method of managing not every shared memory block but every free area is also conceivable. This is convenient for the purpose of releasing the memory in which the shared library 1211 is loaded when a certain shared library 1211 is not linked from any program.
  • the shared memory management unit 131 refers to or rewrites the shared memory management table unit 132 to manage the physical address and remaining capacity of the shared memory unit 111 mapped to the program.
  • the shared library management table unit 134 is a table for managing the usage status of the shared library 1211 and the loading status to the shared memory unit 111.
  • FIG. 6 shows the structure of one entry of the shared library management table unit 134, which is composed of a shared library name 1341, a shared memory block address 1342, and a physical address 1343.
  • the entry of the shared library management table unit 134 may include an attribute representing access restriction of the shared library 1211 and other attributes for control.
  • the shared library name 1341 is the file name of the shared library 1211 included in the file system unit 121.
  • the shared memory block address 1342 is a shared memory block address of the shared memory unit 111 in which the shared library 1211 is loaded.
  • the physical address 1343 is a physical address at which the shared library 1211 is loaded, and is a physical address in the block of the shared memory unit 111 indicated by the shared memory block address 1342.
  • the program execution unit 133 loads the shared library 1211 necessary for executing the program to the shared memory unit 111 and maps it, and then executes the program.
  • the program execution unit 133 determines whether or not the shared library 1211 is already loaded in the shared memory unit 111, and obtains information on the shared library 1211 loaded in the shared memory unit 111. 134 is referred to or rewritten.
  • the program execution unit 133 attempts to reduce internal fragmentation of the memory by actively loading a plurality of shared libraries 1211 into one block of the shared memory unit 111.
  • the mapping table part 135 describes the correspondence between the virtual memory address of the program and the physical memory address of the main storage device 110. Since the computer system 100 according to the present embodiment employs a multiple virtual storage management system that provides virtual space independently to each program, the mapping table unit 135 exists for each program. In the memory access instructed by the program, the main storage device 110 is accessed using the physical address obtained by searching the mapping table unit 135 corresponding to the program with the virtual address.
  • a computer system to which the present invention is applied is not limited to a computer system that employs a multiple virtual storage management method, and can also be applied to a computer system that employs a single virtual storage management method.
  • FIG. 7 shows one entry of the mapping table unit 135, which is composed of a virtual block address 1351 and a physical block address 1352.
  • the entry of the mapping table unit 135 may include attributes representing access restrictions such as reading / writing / execution of memory access and other attributes for control.
  • the virtual block address 1351 is a block number of a virtual memory address assigned for each program. Since all programs can have the same size, for example, in the case of a 32-bit address space, all programs hold information corresponding to 1,048,576 entries.
  • the physical block address 1352 is a block number of a physical memory address where the program is actually loaded.
  • the same physical block address is written in association with the same or different virtual block address in the mapping table unit 135 of a plurality of programs, the plurality of programs are in a state of sharing the physical block. For this reason, if the text area of the shared library 1211 is stored in the physical block, the text area of the shared library 1211 is shared by a plurality of programs.
  • the mapping address determination unit 136 refers to the mapping table unit 135 to determine a virtual memory address for mapping the block of the shared memory unit 111 loaded with the shared library 1211 necessary for program execution to the program. . Further, the mapping address determination unit 136 notifies the mapping table unit 135 of the physical block address 1352 of the shared memory unit 111 and the determined virtual block address 1352 to update the mapping table unit 135.
  • the mapping address determination unit 136 maps the block if there is already a block of the shared memory unit 111 including the shared library 1211, and otherwise maps the block. A block of the shared memory unit 111 that is sufficiently free to place the shared library 1211 is secured, the shared library 1211 is read, and the block is mapped to a free virtual address of the program.
  • FIG. 2 is a flowchart showing the program execution operation in the computer system 100 according to the present embodiment.
  • the program execution unit 133 first checks the file of the execution program and maps the necessary shared library 1211 to the execution program (step S10). Thereafter, the program execution unit 133 executes the execution program (step S20).
  • FIG. 3 is a flowchart showing the details of step S10 of FIG. 2, that is, the mapping operation of the shared library 1211 before executing the program in the present embodiment.
  • the program execution unit 133 performs the process of FIG. 3 for each shared library 1211 necessary for executing the execution program.
  • the mapping operation of the shared library 1211 in the present embodiment will be described with reference to FIG.
  • the program execution unit 133 searches the shared library management table unit 134 to check whether or not the shared library 1211 is already loaded in the shared memory unit 111 (step S100).
  • the shared memory management unit 1131 allocates a block of the shared memory unit 111 that has enough free space for the shared library 1211 to be loaded. Then, it is loaded (step S101) and loaded into a vacant part of the block of the allocated shared memory unit 11 (step S102).
  • the text area of the shared library 1211 is loaded, the text area of the shared library 1211 is loaded into an empty block so that the physical address at the head of the text area matches the address boundary determined by the minimum block size. To do.
  • the program execution unit 133 assigns a free virtual memory address of the execution program by the mapping address determination unit 136 (step S103) and loads the shared library 1211 of the shared memory unit 111 to the virtual memory address. Is mapped (step S104).
  • step S100 When the necessary shared library 1211 is loaded in the shared memory unit 111 (Yes in step S100), the program execution unit 133 assigns a free virtual memory address of the execution program by the mapping address determination unit 136 (step S103). Then, the block in which the shared library 1211 of the shared memory unit 11 has been loaded is mapped to the virtual memory address (step S104).
  • the program execution unit 133 starts executing the execution program.
  • mapping of a certain shared library 1211 can be delayed until the execution program actually accesses the library function in the shared library 1211 for the first time, not when the execution program is started. The contents are the same.
  • a main storage device 110 composed of a nonvolatile storage unit 112 and a volatile storage unit 113 is connected to a CPU 140 through a bus 160.
  • the CPU 140 has an MMU 141.
  • the CPU 140 corresponds to the data processing device 130 of the first embodiment in FIG.
  • the nonvolatile storage unit 112 stores an OS 150 and a plurality of programs (not shown) in advance. Further, the mapping address determination unit 136, the shared memory management unit 131, and the program execution unit 133 are implemented as a function of the OS 150.
  • a shared memory unit 111 In the volatile storage unit 113, a shared memory unit 111, a mapping table unit 135, a shared memory management table unit 132, and a shared library management table unit 134 are secured.
  • the data processing apparatus 130 includes a shared memory management unit 131, a shared memory management table unit 132, a program execution unit 133, a shared library management table unit 134, a mapping table unit 135, and a mapping It is assumed that the address determination unit 136 is provided in hardware.
  • the shared memory management unit 131, the program execution unit 133, and the mapping address determination unit 136 are realized by the CPU 140 and the OS 150 executed thereon.
  • the shared memory management table unit 132, the shared library management table unit 134, and the mapping table unit 135 are stored in the main storage device 110 as tables that are referenced and updated from the OS 150.
  • the shared memory management unit 131, the program execution unit 133, and the mapping address determination unit 136 can be realized in hardware and can be realized in software.
  • FIG. 10 shows an example of physical block address allocation of the main storage device 110.
  • physical block addresses 0x11 to 0x19 are assigned to the nonvolatile storage unit 112, and physical block addresses 0x111 to 0x119 are assigned to the shared memory unit 111.
  • the size is extremely small in order to easily explain the present embodiment, and many physical block addresses are assigned to the actual storage medium.
  • the memory block size selected by designation is 1 megabyte (hexadecimal 0x100000), and the minimum block size is 4 kilobytes (hexadecimal 0x1000).
  • FIG. 11 shows a specific example of the contents of the mapping table unit 135 in the initial state of the first execution program (size is 1 megabyte). Although the number of entries is extremely reduced in FIG. 11 for ease of explanation, there are actually many entries. As shown in FIG. 11, in the initial state, the physical block address of the block that stores the first execution program stored in the nonvolatile storage unit 111 for the block of the virtual block address 0x1000 of the first execution program 0x12 is written.
  • FIG. 13 shows a specific example of the contents of the mapping table unit 135 in the initial state of the second execution program (size is 2 megabytes). Although the number of entries is extremely reduced in FIG. 13 for ease of explanation, there are actually many entries.
  • FIG. 15 shows the specific contents of the initial state of the shared memory management table unit 132. Although the number of entries is extremely reduced in FIG. 15 for ease of explanation, there are actually many entries. As shown in FIG. 15, in the initial state, the shared library is not loaded in each shared memory block, and all are free areas.
  • FIG. 19 shows specific contents of the initial state of the shared library management table unit 134. Although the number of entries is extremely reduced in FIG. 19 for ease of explanation, there are actually many entries. As shown in FIG. 19, in the initial state, all entries in the shared library management table unit 134 are NULL. That is, in the initial state, no shared library 1211 is loaded in the shared memory unit 111.
  • shared library c shared library / lib / libc. so (text area is 1 kilobyte)
  • shared library m shared library m
  • shared library j The following two shared libraries are required by the second execution program.
  • Shared library m (2) Shared library / lib / libj. so (text area is 16 kilobytes) (hereinafter referred to as shared library j).
  • the first program and the second program require the same shared library m. Further, the first program does not require the shared library j required by the second program, and the second program does not require the shared library c required by the first program.
  • the first execution program has a size of 1 megabyte and is loaded into the physical memory block 0x12, and the corresponding virtual block address uses 0x1000. Since it is 1 megabyte, only one physical memory block is used.
  • the mapping table unit 135 of the first execution program is as shown in FIG.
  • the program execution unit 133 searches each entry in the shared library management table unit 134 to search whether the shared library c is included in any shared memory block.
  • the program execution unit 133 notifies the shared memory management unit 131 of the size of 1 kilobyte of the text area of the shared library c and requests a block of the shared memory unit 111. Since the shared memory management unit 131 refers to the shared memory management table unit 132 and is in the state shown in FIG. 15, for example, a shared memory block address 0 and a head address 0x11100000 are programmed as information related to a shared memory block having a free space of 1 kilobyte. Return to the execution unit 133.
  • the program execution unit 133 issues an instruction to read the shared library c from the file system unit 121 to the shared memory unit 111, and the shared library c is 1 kilobyte starting from the physical address 0x11100000 of the block at the block address 0 of the shared memory unit 111. Load into region. When the loading is completed, the program execution unit 133 registers “shared library name / lib / libc.so”, “shared memory block address 0”, and “physical address 0x11100000” in the shared library management table unit 134. As a result, the shared library management table unit 134 changes from the state of FIG. 19 to the state of FIG.
  • the program execution unit 133 sets the size of the text area of the shared library c to 1 kilobyte, but the minimum block size is 4 kilobytes.
  • the shared memory management table unit 132 is updated to reduce only kilobytes. As a result, the shared memory management table unit 132 changes from the state of FIG. 15 to the state of FIG.
  • mapping address determination unit 136 searches for an empty area of the virtual memory block of the first program. Assuming that 0x1001 is obtained, the mapping address determination unit 136 registers “virtual block address 0x1001” and “physical block address 0x111” in the mapping table unit 135 of the first program. As a result, the mapping table unit 135 of the first program changes from the state of FIG. 11 to the state of FIG.
  • the program execution unit 133 loads the data area of the shared library c into an empty block of a memory other than the shared memory by a method similar to the conventional method, and maps the block to a virtual memory block of the first program.
  • the program execution unit 133 holds “shared library name / lib / libm.so” and “virtual address 0x100100000” as information necessary for calling the shared library c from the first execution program.
  • the shared library c includes a plurality of library functions, what is actually called is a library function in the shared library c.
  • Specific processing for realizing dynamic linking follows a standard format such as ELF.
  • the program execution unit 133 searches each entry of the shared library management table unit 134 to search whether the shared library m is included in any shared memory block. Since the shared library management table unit 134 at this time is in the state shown in FIG. 20, it can be seen that the shared library m is not loaded in the shared memory unit 111.
  • the program execution unit 133 notifies the shared memory management unit 131 of the size of the text area of the shared library m, 8 kilobytes, and requests a block of the shared memory unit 111.
  • the shared memory management unit 131 refers to the shared memory management table unit 132 and is in the state of FIG. 16, for example, the shared memory block number 0 and the head address 0x11101000 are used as information related to a shared memory block having a free space of 8 kilobytes or more. It returns to the program execution unit 133.
  • the program execution unit 133 issues an instruction to read the shared library m from the file system unit 121 to the shared memory unit 111, and loads the shared library m into an 8 kilobyte area starting from the physical address 0x11101000 of the block of the shared memory block address 0 To do.
  • the program execution unit 133 registers “shared library name / lib / libm.so”, “shared memory block address 0”, and “physical address 0x11101000” in the shared library management table unit 134.
  • the shared library management table unit 134 changes from the state of FIG. 20 to the state of FIG.
  • the program execution unit 133 is shared through the shared memory management unit 131 to reduce the free size of the shared memory block number 0 by 8 kilobytes.
  • the memory management table unit 132 is updated. As a result, the shared memory management table unit 132 changes from the state of FIG. 16 to the state of FIG.
  • mapping address determination unit 136 Since the block having the shared memory block address 0 is already mapped to the first execution program, the mapping address determination unit 136 does not need to perform mapping processing on the mapping table unit 135 of the first execution program again. That is, the mapping table section 135 of the first program remains in the state shown in FIG.
  • the program execution unit 133 loads the data area of the shared library m into an empty block of a memory other than the shared memory by a method similar to the conventional method, and maps the block to a virtual memory block of the first program.
  • the program execution unit 133 Since the in-block offset is 0x1000, the program execution unit 133 has information of “shared library name / lib / libm.so” and “virtual address 0x100101000” as information necessary for calling the shared library m from the first execution program. Are stored in the data area (not shown) of the first execution program.
  • one shared memory block is shared by the text areas of a plurality of shared libraries, so that the internal fragmentation of the memory can be reduced.
  • the main body of the second execution program has a size of 2 megabytes and is loaded into physical memory blocks 0x13 to 0x14. Further, 0x1000 to 0x1001 are used as virtual block addresses. Since it is 2 megabytes, two physical memory blocks are used. In this case, the mapping table unit 135 of the second execution program is as shown in FIG.
  • the program execution unit 133 searches each entry of the shared library management table unit 134 to search whether the shared library m is included in any shared memory block. Since the shared library management table unit 134 at this time is in the state shown in FIG. 21, it can be seen that the shared library m is already loaded in the block of the shared memory block address 0 of the physical block address 0x111.
  • mapping address determination unit 136 searches for a free area in the virtual memory block of the second execution program and obtains 0x1002.
  • the mapping address determination unit 136 registers “virtual block address 0x1002” and “physical block address 0x111” in the mapping table unit 135 of the second execution program.
  • the mapping table unit 135 of the second execution program changes from the state of FIG. 13 to the state of FIG.
  • the program execution unit 133 Since the in-block offset is 0x1000, the program execution unit 133 has information of “shared library name / lib / libm.so” and “virtual address 0x100201000” as information necessary for calling the shared library m from the second execution program. Are stored in the data area (not shown) of the second execution program.
  • both the shared library c and the shared library m are loaded in the block of the shared memory block address 0.
  • the second program does not need to link the shared library c, but can be read from the address space of the second program as a result.
  • mapping is performed in a read-only manner, there is no particular problem even if the shared library c is shared.
  • the program execution unit 133 searches each entry in the shared library management table unit 134 to search whether the shared library j is included in any shared memory block. Since the shared library management table unit 134 at this time is in the state shown in FIG. 21, it can be seen that the shared library j is not loaded in the shared memory unit 111.
  • the program execution unit 133 notifies the shared memory management unit 131 of the size of the text area of the shared library j, which is 16 kilobytes, and requests a block of the shared memory unit 111.
  • the shared memory management unit 131 refers to the shared memory management table unit 132
  • the shared memory management table unit 132 is in the state of FIG. It returns to the program execution unit 133.
  • the program execution unit 133 issues an instruction to read the shared library j from the file system unit 121 to the shared memory unit 111, and loads the shared library j into a 16-kilobyte area starting from the physical address 0x1113000 in the block of the shared memory block address 0 To do.
  • the program execution unit 133 registers “shared library name / lib / libj.so”, “shared memory block address 0”, and “physical address 0x11103000” in the shared library management table unit 134.
  • the shared library management table unit 134 changes from the state of FIG. 21 to the state of FIG.
  • the program execution unit 133 is shared through the shared memory management unit 131 to reduce the free size of the shared memory block number 0 by 16 kilobytes.
  • the memory management table unit 132 is updated. As a result, the shared memory management table unit 132 changes from the state of FIG. 17 to the state of FIG.
  • mapping address determination unit 136 Since the block having the shared memory block address 0 has already been mapped to the second execution program, the mapping address determination unit 136 does not need to perform the mapping process on the mapping table unit 135 of the second execution program again. That is, the mapping table part 135 of the second program remains in the state shown in FIG.
  • the program execution unit 133 loads the data area of the shared library j into an empty block of a memory other than the shared memory by a method similar to the conventional method, and maps the block to a virtual memory block of the second program.
  • the program execution unit 133 Since the intra-block offset is 0x3000, the program execution unit 133 includes information on “shared library name / lib / libj.so” and “virtual address 0x100203000” as information necessary for calling the shared library j from the second execution program. Hold.
  • the shared memory block address 0 is loaded with the shared library c, the shared library m, and the shared library j.
  • the first program does not need to link the shared library j, but as a result can be read from the address space of the first program.
  • the mapping is performed only for reading, there is no particular problem even if the shared library j is shared.
  • the internal fragmentation of the memory that occurs when the shared library is loaded into the shared memory can be kept small.
  • the first reason is that one shared memory block is shared by multiple shared library text areas.
  • the second reason is that when one shared memory block is shared by the text areas of a plurality of execution programs, even if a text area of a shared library which is unnecessary for the execution program is included, Because sharing is done. That is, when a shared library text area used by a program is newly loaded, even if the shared library text area not used by the program is already loaded, as long as there is a free area, This is because an algorithm for selecting as a load destination shared memory block is employed.
  • FIG. 9 shows an example when the minimum block size is 2 kilobytes.
  • the program execution unit 133 determines that the top physical address for loading the text area of the shared library 1211 is the minimum block size (first and second embodiments). In this case, the text area of the shared library 1211 is loaded into the memory block of the shared memory unit 111 so as to coincide with the address boundary determined by 4 KB). However, as a third embodiment of the present invention, the program execution unit 133 matches the address boundary determined by the size of the head physical address for loading the text area of the shared library 1211 smaller than the minimum block size. As described above, the text area of the shared library 1211 may be loaded into the memory block of the shared memory unit 111. According to the third embodiment, the internal fragmentation of the memory that occurs when the text area of the shared library is loaded into the shared memory can be further reduced.
  • the case where the text area of the shared library is arranged in the shared memory has been taken up.
  • the data of the read-only data file is arranged in the shared memory.
  • the present invention is also applicable to.
  • FIG. 23 is a block diagram illustrating a configuration of a computer system according to the present embodiment. In the present embodiment, an outline of the above-described computer system will be described.
  • the computer system according to the present embodiment is common to the external storage device 2 that stores a plurality of files 1 including read-only data commonly used by one or more programs and the one or more programs.
  • the same memory block of the shared memory unit 3 in a computer system composed of the main storage device 4 including the shared memory unit 3 used for the memory, the external storage device 2 and the data processing device 5 connected to the main storage device 4 Are provided with a program execution unit 6 for loading read-only data of a plurality of files 1.
  • the program execution unit 6 transfers the read-only data of the file 1 to the shared memory unit so that the leading physical address for loading the read-only data of the file 1 matches the address boundary determined by a predetermined size. 3 is loaded into the memory block.
  • the computer system adopts a configuration in which the minimum value of the block size, which is a storage space management unit, is used as the predetermined size.
  • the size of a block which is a management unit of storage space, is variable.
  • the minimum value of the block size is S
  • the variable block size other than that is 2 n (S).
  • the configuration is such that n is a positive integer) times.
  • the program execution unit 6 when the program execution unit 6 newly loads read-only data of a file used in a certain program into the memory block of the shared memory unit 3, the read-only data of the file that is not used by the program is stored.
  • a configuration is adopted in which even a memory block that has already been loaded is selected as a load destination memory block as long as there is an empty area.
  • the predetermined size is set.
  • S where L is the size of the read-only data of the loaded file and f up is a function for rounding up the decimal point
  • the free size of the memory block managed by the shared memory management table unit is expressed as S ⁇ f up (L / S)
  • a shared memory management unit that subtracts only is adopted.
  • the above computer system adopts a configuration in which the read-only data of file 1 is the text area of the shared library.
  • the above computer system adopts a configuration in which file 1 is a read-only data file.
  • the read-only data management method which is executed when the above-described computer system operates, stores a plurality of files 1 including read-only data commonly used by one or more programs. And the external storage device 2 including the shared memory unit 3 commonly used in the one or more programs, and the external storage device 2 and the data processing device 5 connected to the main storage device 4.
  • Read-only data management method in the computer system the step of loading the read-only data of the file 1 into the memory block of the shared memory unit 3, and the reading of another file when there is an empty area in the memory block And a step of loading the dedicated data into the memory block.
  • the computer system described above can be realized by incorporating a program into a computer.
  • a program according to another aspect of the present invention is common to the external storage device 2 that stores a plurality of files 1 including read-only data that is commonly used by one or more programs, and the one or more programs.
  • a computer composed of a main storage device 4 including the shared memory unit 3 used for the above, and an external storage device 2 and a data processing device 5 connected to the main storage device 4 is placed in the same memory block of the shared memory unit 3.
  • a configuration is adopted in which the program execution unit 6 loads the read-only data of the plurality of files 1.
  • the present invention can be applied to uses such as a computer system that realizes a system with small internal fragmentation of memory.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)
  • Memory System Of A Hierarchy Structure (AREA)

Abstract

In order to solve a problem that the internal fragmentation of memory becomes larger when read-only data of a file is loaded to a shared memory, the calculator system is configured with an external storage device which stores a plurality of files containing read-only data commonly used by one or more programs; a main storage unit containing a shared memory unit which is commonly used by one or more programs; and a data processing device connected to the external storage device and the main storage device. A program execution unit to load read-only data of a plurality of files is provided in a same memory block of the shared memory unit.

Description

計算機システムComputer system
 本発明は計算機システムに関し、特に、読み込み専用データを含むファイルを記憶する外部記憶装置と共有メモリ部を含む主記憶装置とデータ処理装置とから構成される計算機システムに関する。 The present invention relates to a computer system, and more particularly to a computer system including an external storage device that stores a file containing read-only data, a main storage device that includes a shared memory unit, and a data processing device.
 コンピュータシステム上で実行されるプログラムの作成方法として、共有ライブラリを利用する方法がある。複数のプログラムから頻繁に利用される関数(ルーチン)を共有ライブラリという形でまとめておき、プログラムの実行前に共有ライブラリをプログラムのメモリに読み込み、プログラム実行時に必要に応じて共有ライブラリの必要な関数を実行する。 There is a method of using a shared library as a method of creating a program to be executed on a computer system. Functions (routines) that are frequently used from multiple programs are collected in the form of a shared library, the shared library is loaded into the program memory before program execution, and the necessary functions of the shared library are used as needed during program execution. Execute.
 メモリにはリード(読み込み)、ライト(書き出し)、エグゼキュート(実行)などの保護属性がそれぞれ独立して設定可能であるので、プログラムや共有ライブラリをメモリに読み込むときに保護属性を適切に設定すると、例えばプログラムにバグがあった場合に適切な対処が可能となる。 Protection attributes such as read (read), write (write), execute (execute), etc. can be set independently for the memory, so if you set the protection attributes appropriately when reading a program or shared library into the memory For example, when there is a bug in the program, an appropriate countermeasure can be taken.
 一般に、プログラムや共有ライブラリは、テキスト領域(実行するプログラム本体)とデータ領域(プログラムの実行の際に使用するデータ)に分けられる。また、その他に読み込み専用データ領域や、共有ライブラリの実行のために使用するシンボル領域などがあることもある。 Generally, a program and a shared library are divided into a text area (program body to be executed) and a data area (data used when executing the program). In addition, there may be a read-only data area and a symbol area used for executing the shared library.
 プログラムや共有ライブラリをメモリに読み込むとき、例えば、テキスト領域は読み込み属性と実行属性を設定し、データ領域は読み込み属性と書き出し属性を設定する。つまり、データ領域の値は書き換え可能であるのに対して、テキスト領域の値は書き換えることはできない。しかしながら、テキスト領域は読み込み専用なので、あるプログラムが実行されている最中でも同じ共有ライブラリのテキスト領域を別のプログラムと共有することができる。 When reading a program or shared library into memory, for example, the text area sets read and execute attributes, and the data area sets read and write attributes. That is, the value in the data area can be rewritten, while the value in the text area cannot be rewritten. However, since the text area is read-only, the text area of the same shared library can be shared with another program even while a certain program is being executed.
 プログラムの実行中には多数のメモリアクセスが行われる。メモリアクセスの際にプログラム中で用いられるメモリアドレスは、仮想メモリアドレス(又は仮想アドレス)と呼ばれる。実際にハードウェアのメモリにアクセスが行われるときには、プログラムが指定した仮想メモリアドレスから、実際に搭載されているメモリの固定的な物理メモリアドレス(又は物理アドレス)に変換される。このアドレス変換作業は、MMU(Memory Management Unit)と呼ばれるハードウェアによって高速に行われている。 A large number of memory accesses are performed during program execution. A memory address used in a program at the time of memory access is called a virtual memory address (or virtual address). When the hardware memory is actually accessed, the virtual memory address designated by the program is converted into a fixed physical memory address (or physical address) of the actually mounted memory. This address conversion work is performed at high speed by hardware called MMU (Memory Management Unit).
 このアドレス変換を効率よくするために、MMUではメモリをブロックごとに分けて管理している。ある仮想メモリアドレスは、仮想ブロックアドレスとブロック内オフセットに分けられる。同様にある物理メモリアドレスも物理ブロックアドレスとブロック内オフセットに分けられる。ブロック内オフセットは、仮想アドレスのブロック内オフセットをそのまま物理アドレスのブロック内オフセットとして用い、仮想ブロックアドレスを物理ブロックアドレスに変換する。 In order to make this address translation efficient, the MMU manages the memory separately for each block. A certain virtual memory address is divided into a virtual block address and an intra-block offset. Similarly, a certain physical memory address is divided into a physical block address and an intra-block offset. The intra-block offset uses the intra-block offset of the virtual address as it is as the intra-block offset of the physical address, and converts the virtual block address into a physical block address.
 計算機システム全体で1つの仮想記憶域が存在し、その仮想記憶域を区画に分けて使用する方式を、単一仮想記憶方式と呼ぶ。これに対して、プログラム毎に独立の仮想記憶を割り当てる方式を多重仮想記憶方式と呼ぶ。多重仮想記憶方式では、プログラム相互間で記憶保護やセキュリティを保つことができる。他方、記憶保護とは裏腹の関係であるが、ライブラリやデータを共有したい場合がある。このような場合、共有されるライブラリなどは共有メモリ上で同一のアドレスとなるようにマッピングが行われる。 A method in which one virtual storage area exists in the entire computer system and the virtual storage area is divided into partitions and used is called a single virtual storage system. On the other hand, a method of assigning independent virtual memory for each program is called a multiple virtual memory method. In the multiple virtual storage system, storage protection and security can be maintained between programs. On the other hand, there is a case where you want to share a library or data, though it is contrary to memory protection. In such a case, the shared library is mapped so as to have the same address on the shared memory.
 すなわち、共有ライブラリを複数のプログラムで共有する場合、共有メモリ上にロードされた1つの共有ライブラリをプログラムのそれぞれの仮想アドレスにマップする作業を行う(この処理をリンクとも呼ぶ)。共有ライブラリは、各プログラムの任意の仮想アドレスに配置できるように作成されているので、同じ共有ライブラリでもプログラムごとに配置する仮想アドレスを変えることができる。また、同じプログラムであっても、実行の度に異なる仮想アドレスに共有ライブラリを配置することもできる。 That is, when a shared library is shared by a plurality of programs, one shared library loaded on the shared memory is mapped to each virtual address of the program (this process is also called a link). Since the shared library is created so that it can be arranged at an arbitrary virtual address of each program, the virtual address arranged for each program can be changed even in the same shared library. Even in the same program, a shared library can be arranged at a different virtual address each time it is executed.
 共有ライブラリのテキスト領域を共有メモリに配置する際には、その共有ライブラリのテキスト領域の先頭アドレスがメモリブロックの先頭アドレスに一致するように配置している(例えば特許文献1の図8参照)。また、共有ライブラリのデータ領域は、テキスト領域と保護属性を変える必要があるために、テキスト領域を配置するメモリブロックとは別のメモリブロックに配置する。このとき、ファイル構成の都合上、データ領域の先頭アドレスが、メモリブロックの先頭アドレスからテキスト領域のサイズに等しいオフセット分だけずらした位置から始まる領域に配置している(例えば非特許文献1参照)。 When arranging the text area of the shared library in the shared memory, the text library is arranged so that the head address of the text area of the shared library matches the head address of the memory block (for example, see FIG. 8 of Patent Document 1). In addition, since the data area of the shared library needs to be changed from the text area and the protection attribute, the data area is arranged in a memory block different from the memory block in which the text area is arranged. At this time, for the convenience of the file configuration, the start address of the data area is arranged in an area starting from a position shifted from the start address of the memory block by an offset equal to the size of the text area (for example, see Non-Patent Document 1). .
特開平6-332675号公報JP-A-6-332675
 共有ライブラリのテキスト領域のサイズは、必ずしもメモリブロックサイズと同じではない。このため、メモリブロック内で使い切れない領域の問題が発生する。この問題はメモリの内部フラグメンテーションと呼ばれている。例えば、2つの共有ライブラリAとBがあり、それぞれのテキスト領域をaとb、データ領域をa’とb’とする。また、メモリブロックの大きさを4キロバイト、共有ライブラリAとBのテキスト領域およびデータ領域のサイズを4キロバイト以下とすると、これら2つの共有ライブラリAとBを共有メモリに配置すると、例えば図8に示すようになる。図8において、メモリブロック内のハッチングを施していない領域と、データ領域a’とb’の前方に位置するオフセット領域とが未使用領域になる。 The size of the text area of the shared library is not necessarily the same as the memory block size. For this reason, the problem of an area that cannot be used in the memory block occurs. This problem is called internal memory fragmentation. For example, there are two shared libraries A and B, where the text areas are a and b, and the data areas are a 'and b'. Further, if the size of the memory block is 4 kilobytes and the size of the text area and data area of the shared libraries A and B is 4 kilobytes or less, if these two shared libraries A and B are arranged in the shared memory, for example, FIG. As shown. In FIG. 8, an unhatched area in the memory block and an offset area located in front of the data areas a 'and b' are unused areas.
 近年、メモリ搭載量の増加と効率的なメモリ管理の必要性にともなって、メモリブロックのサイズを変更することが可能な計算機システムが実用化されている。例えば、ブロックサイズとして、4キロバイト、16キロバイト、256キロバイト、1メガバイト、4メガバイト、16メガバイト、64メガバイト、256メガバイトの9種類のうちの任意のサイズを指定することができる計算機システムがある。 In recent years, a computer system capable of changing the size of a memory block has been put into practical use in accordance with the increase in the amount of memory mounted and the necessity of efficient memory management. For example, there is a computer system that can specify any size among nine types of block sizes, 4 kilobytes, 16 kilobytes, 256 kilobytes, 1 megabyte, 4 megabytes, 16 megabytes, 64 megabytes, and 256 megabytes.
 しかしながら、ブロックサイズが拡大していてもその分だけ共有ライブラリのファイルサイズが大きくなるとは限らない。このため、共有ライブラリのテキスト領域の先頭をメモリブロックのブロック境界に合わせて配置する方法では、ブロックサイズを大きくすればするほど、メモリの内部フラグメンテーションが大きくなってしまうことになる。その結果、メモリブロック内に、より大きい未使用領域ができてしまい、メモリを使い切れない状況が発生する。図8中、データ領域a’とb’を配置しているメモリブロックに生じる未使用領域は、記憶保護およびファイル構成上、致し方ない面があるが、テキスト領域aとbを配置しているメモリブロックに生じる未使用領域は削減の余地がある。 However, even if the block size is increased, the file size of the shared library is not necessarily increased accordingly. For this reason, in the method of arranging the head of the text area of the shared library in accordance with the block boundary of the memory block, the internal fragmentation of the memory increases as the block size increases. As a result, a larger unused area is created in the memory block, resulting in a situation where the memory cannot be used up. In FIG. 8, the unused area generated in the memory block in which the data areas a ′ and b ′ are arranged has a problem in terms of storage protection and file structure, but the memory in which the text areas a and b are arranged. The unused area generated in the block has room for reduction.
 以上、共有ライブラリのテキスト領域(これはファイルの読み込み専用データの一種である)を共有メモリに配置する際の課題について説明した。しかし、この課題は、共有ライブラリのテキスト領域を共有メモリに配置する場合だけに限られず、一般的にファイルの読み込み専用データを共有メモリに配置する際に生じる。 So far, we have described the issues in placing the shared library text area (this is a type of read-only data for files) in shared memory. However, this problem is not limited to the case where the text area of the shared library is arranged in the shared memory, and generally occurs when the read-only data of the file is arranged in the shared memory.
 本発明の目的は、上述した課題、すなわち、ファイルの読み込み専用データを共有メモリにロードする際にメモリの内部フラグメンテーションが大きくなる、という課題を解決する計算機システムを提供することにある。 An object of the present invention is to provide a computer system that solves the above-described problem, that is, the problem that the internal fragmentation of a memory becomes large when loading read-only data of a file into a shared memory.
 本発明の計算機システムは、1以上のプログラムにより共通に利用される読み込み専用データを含むファイルを複数記憶する外部記憶装置と、前記1以上のプログラムで共通に利用される共有メモリ部を含む主記憶装置と、前記外部記憶装置および前記主記憶装置に接続されたデータ処理装置とから構成される計算機システムにおいて、前記共有メモリ部の同じメモリブロックに複数の前記ファイルの読み込み専用データをロードするプログラム実行部を備える。 The computer system of the present invention includes an external storage device that stores a plurality of files including read-only data that is commonly used by one or more programs, and a main memory that includes a shared memory unit that is commonly used by the one or more programs. Execution of a program for loading read-only data of a plurality of files into the same memory block of the shared memory unit in a computer system comprising a device and a data processing device connected to the external storage device and the main storage device A part.
 本発明によれば、ファイルの読み込み専用データを共有メモリにロードする際に生じるメモリの内部フラグメンテーションを小さく抑えることができる。 According to the present invention, the internal fragmentation of the memory that occurs when loading the read-only data of the file into the shared memory can be reduced.
本発明の第1の実施の形態に係る計算機システムのブロック図である。It is a block diagram of a computer system concerning a 1st embodiment of the present invention. 本発明の第1の実施の形態に係る計算機システムにおけるプログラムの実行の動作を示したフローチャートである。It is the flowchart which showed the operation | movement of the execution of the program in the computer system which concerns on the 1st Embodiment of this invention. 本発明の実施の形態における共有ライブラリのマッピングの動作を示したフローチャートである。It is the flowchart which showed the operation | movement of the mapping of the shared library in embodiment of this invention. 本発明の第2の実施の形態に係る計算機システムのブロック図である。It is a block diagram of a computer system concerning a 2nd embodiment of the present invention. 共有メモリ管理テーブル部の1エントリの構造を示す図である。It is a figure which shows the structure of 1 entry of a shared memory management table part. 共有ライブラリ管理テーブル部の1エントリの構造を示す図である。It is a figure which shows the structure of 1 entry of a shared library management table part. マッピングテーブル部の1エントリの構造を示す図である。It is a figure which shows the structure of 1 entry of a mapping table part. 特許文献1において共有ライブラリをメモリブロックに配置する方法の説明図である。10 is an explanatory diagram of a method for arranging a shared library in a memory block in Patent Document 1. FIG. 共有ライブラリをメモリブロックに配置する本発明による方法の説明図である。FIG. 5 is an illustration of a method according to the invention for placing a shared library in a memory block. 主記憶装置の物理ブロックアドレスの割り当て例を示す図である。It is a figure which shows the example of allocation of the physical block address of a main memory. 第1の実行プログラムのマッピングテーブル部のある時点の状態を示す図である。It is a figure which shows the state of a certain time of the mapping table part of a 1st execution program. 第1の実行プログラムのマッピングテーブル部の別の時点の内容例を示す図である。It is a figure which shows the example of the content at another time of the mapping table part of a 1st execution program. 第2の実行プログラムのマッピングテーブル部のある時点の内容例を示す図である。It is a figure which shows the example of the content at a certain time of the mapping table part of a 2nd execution program. 第2の実行プログラムのマッピングテーブル部の別の時点の内容例を示す図である。It is a figure which shows the example of the content at another time of the mapping table part of a 2nd execution program. 共有メモリ管理テーブル部のある時点の内容例を示す図である。It is a figure which shows the example of the content of a certain time of a shared memory management table part. 共有メモリ管理テーブル部の別の時点の内容例を示す図である。It is a figure which shows the example of the content of another time of a shared memory management table part. 共有メモリ管理テーブル部の別の時点の内容例を示す図である。It is a figure which shows the example of the content of another time of a shared memory management table part. 共有メモリ管理テーブル部の別の時点の内容例を示す図である。It is a figure which shows the example of the content of another time of a shared memory management table part. 共有ライブラリ管理テーブル部の時点の内容例を示す図である。It is a figure which shows the example of the content at the time of a shared library management table part. 共有ライブラリ管理テーブル部の別の時点の内容例を示す図である。It is a figure which shows the example of the content of another time of a shared library management table part. 共有ライブラリ管理テーブル部の別の時点の内容例を示す図である。It is a figure which shows the example of the content of another time of a shared library management table part. 共有ライブラリ管理テーブル部の別の時点の内容例を示す図である。It is a figure which shows the example of the content of another time of a shared library management table part. 本発明の第3の実施の形態に係る計算機システムのブロック図である。It is a block diagram of the computer system which concerns on the 3rd Embodiment of this invention.
 次に、本発明の実施の形態について図面を参照して詳細に説明する。 Next, embodiments of the present invention will be described in detail with reference to the drawings.
 図1を参照すると、本発明の第1の実施の形態に係る計算機システム100は、少なくとも主記憶装置110と、外部記憶装置120と、プログラム制御により動作するデータ処理装置130とによって構成される。 Referring to FIG. 1, the computer system 100 according to the first embodiment of the present invention includes at least a main storage device 110, an external storage device 120, and a data processing device 130 that operates under program control.
 主記憶装置110は、共有メモリ部111を含んで構成される。共有メモリ部111は、プログラム(応用プログラム等)間で共有されるメモリであり、プログラムの仮想記憶のブロックと同じ大きさのブロックに分けられて管理される。本実施の形態の場合、ブロックサイズは可変であり、予め定められた複数のサイズの中から任意のサイズを指定することができるようになっている。本実施の形態の場合、予め定められた複数のサイズの最小値は4キロバイト(4,096バイト)であり、残りのサイズは4キロバイトの2n(nは1以上の正の整数)倍のサイズになっている。なお、残りのブロックのサイズを最小サイズの2n倍にしている理由は、次の通りである。後述するように、共有ライブラリ1211はその先頭アドレスが最小サイズで定まるアドレス境界に一致するようにロードされる。このため、若し、残りのブロックのサイズが最小サイズの2n倍でなければ、当該ブロックの先頭アドレスは最小サイズで定まるアドレス境界に一致しないケースが発生する。そうすると、当該ブロックに最初の共有ライブラリをロードした際、ブロックの先頭部分に空き領域が生じてしまうからである。 The main storage device 110 includes a shared memory unit 111. The shared memory unit 111 is a memory shared between programs (application programs and the like), and is managed by being divided into blocks having the same size as the virtual storage block of the program. In the case of the present embodiment, the block size is variable, and an arbitrary size can be designated from a plurality of predetermined sizes. In the case of this embodiment, the minimum value of a plurality of predetermined sizes is 4 kilobytes (4,096 bytes), and the remaining size is 2 n times (n is a positive integer of 1 or more) times 4 kilobytes. It is a size. The reason why the remaining block size is 2 n times the minimum size is as follows. As will be described later, the shared library 1211 is loaded so that its head address coincides with an address boundary determined by the minimum size. For this reason, if the size of the remaining block is not 2 n times the minimum size, a case may occur where the head address of the block does not coincide with the address boundary determined by the minimum size. This is because when the first shared library is loaded into the block, an empty area is generated at the beginning of the block.
 共有メモリ部111の各ブロックは、複数のプログラムで共有することが可能である。共有メモリ部111のブロックには、データ処理装置130によって共有ライブラリのテキスト領域が読み込まれる。共有メモリ部111のブロックに読み込まれた共有ライブラリのテキスト領域は、プログラムから呼び出されて使用される。 Each block of the shared memory unit 111 can be shared by a plurality of programs. In the block of the shared memory unit 111, the text area of the shared library is read by the data processing device 130. The text area of the shared library read into the block of the shared memory unit 111 is called from the program and used.
 以下では、特に明記しない限り、単に共有ライブラリと記載したときは、共有ライブラリのテキスト領域(メモリには読み込み及び実行属性を設定する)のことを指すものとする。また、共有ライブラリのデータ領域のメモリへのロードに関しては、従来と同じ方法で行われるものとする。さらに、共有ライブラリのテキスト領域を共有メモリ部111にロードし、このロードした共有ライブラリ中のライブラリ関数のうちプログラムの実行に必要なライブラリ関数をプログラムに動的にリンクして呼び出し可能とする方式は、ELF(Executable and Linking Format)フォーマット等の標準方式に従うものとする。 In the following, unless otherwise specified, simply describing a shared library refers to the text area of the shared library (loading and execution attributes are set in the memory). In addition, it is assumed that loading of the data area of the shared library into the memory is performed in the same manner as in the past. Further, a method for loading a text area of a shared library into the shared memory unit 111 and dynamically linking and calling a library function necessary for program execution among the library functions in the loaded shared library is as follows: , And comply with standard systems such as ELF (Executable Linking Format) format.
 外部記憶装置120は、ファイルシステム部121を含んで構成される。ファイルシステム部121は、データ処理装置130の実行に必要な実行ファイルや共有ライブラリやその他のファイルを保持している。図1では、共有ライブラリのみ参照符号1211を付与して図示している。共有ライブラリ1211は、1以上のプログラムにより共通に利用される1以上のライブラリ関数を含んでいる。本実施の形態では、外部記憶装置120はファイルを読み込む用途で使用しているが、外部記憶装置120の使用方法はそれに限られるわけではない。 The external storage device 120 includes a file system unit 121. The file system unit 121 holds an execution file, a shared library, and other files necessary for the execution of the data processing device 130. In FIG. 1, only the shared library is shown with reference numeral 1211. The shared library 1211 includes one or more library functions that are commonly used by one or more programs. In the present embodiment, the external storage device 120 is used for reading a file, but the method of using the external storage device 120 is not limited thereto.
 データ処理装置130は、共有メモリ管理部131と、共有メモリ管理テーブル部132と、プログラム実行部133と、共有ライブラリ管理テーブル部134と、マッピングテーブル部135と、マッピングアドレス決定部136とを含んで構成される。 The data processing device 130 includes a shared memory management unit 131, a shared memory management table unit 132, a program execution unit 133, a shared library management table unit 134, a mapping table unit 135, and a mapping address determination unit 136. Composed.
 共有メモリ管理テーブル部132は、共有メモリ部111の使用状況を管理するテーブルである。 The shared memory management table unit 132 is a table for managing the usage status of the shared memory unit 111.
 図5は共有メモリ管理テーブル部132の1エントリの構造を示したものであり、共有メモリブロックアドレス1321と先頭物理アドレス1322と空きサイズ1323とによって構成される。共有メモリ管理テーブル部132のエントリには、これらの属性の他に、共有メモリ部111のアクセスの読み/書き/実行などのアクセス制限を表わす属性や、その他の制御のための属性が含まれていてもよい。 FIG. 5 shows the structure of one entry of the shared memory management table unit 132, which is composed of a shared memory block address 1321, a head physical address 1322, and a free size 1323. In addition to these attributes, the entry of the shared memory management table unit 132 includes attributes representing access restrictions such as read / write / execution of access to the shared memory unit 111 and other attributes for control. May be.
 共有メモリブロックアドレス1321は、共有メモリ部111をブロックサイズで管理する際の番号(メモリブロック番号)である。 The shared memory block address 1321 is a number (memory block number) used when managing the shared memory unit 111 in block size.
 先頭物理アドレス1322は、共有メモリ部111の当該ブロックの先頭物理アドレスである。 The start physical address 1322 is the start physical address of the block of the shared memory unit 111.
 空きサイズ1323は、共有メモリ部111の当該ブロックにおける未使用のメモリサイズを示している。空きサイズ1323の初期値は、ブロックサイズであり、新たに共有ライブラリ1211が当該ブロックにロードされる度に、その共有ライブラリ1211のサイズに見合った量だけ減算される。 The empty size 1323 indicates an unused memory size in the block of the shared memory unit 111. The initial value of the empty size 1323 is a block size, and every time a new shared library 1211 is loaded into the block, an amount corresponding to the size of the shared library 1211 is subtracted.
 具体的には、共有ライブラリ1211のテキスト領域のロードの場合、テキスト領域のサイズをL、最小ブロックサイズ(本実施の形態の場合は4キロバイト)をSとした場合、S×fup(L/S)だけ減算する。ここで、fupは小数点以下を切り上げる関数である。例えば、L=1KB、S=4KBであれば、S×fup(L/S)=4×1=4KBとなる。このような管理を行っておくことにより、当該ブロックに別の共有ライブラリ1211をロードする場合の先頭アドレスは、必ず最小ブロックサイズで定まるアドレス境界に一致する。このため、若しブロックサイズが最小の4KBに変更されたとしても、共有ライブラリ1211の先頭アドレスは常にブロック境界に一致する。 Specifically, in the case of loading the text area of the shared library 1211, when the size of the text area is L and the minimum block size (4 kilobytes in the present embodiment) is S, S × f up (L / Subtract only S). Here, f up is a function that rounds up after the decimal point. For example, if L = 1 KB and S = 4 KB, S × f up (L / S) = 4 × 1 = 4 KB. By performing such management, the head address when another shared library 1211 is loaded into the block always matches the address boundary determined by the minimum block size. For this reason, even if the block size is changed to the minimum 4 KB, the head address of the shared library 1211 always matches the block boundary.
 これにより、例えば計算機システム100がオンデマンドページング方式を採用している場合に、効率のよいページングが可能になる。その理由は以下の通りである。オンデマンドページング方式は、該当アドレスのメモリ内容が必要となった時点で、物理ページ(物理ブロック)を論理ページ(論理ブロック)に割り当てる方式である。オンデマンドページング方式では、ページへ実際にアクセスされない限り、ページがメモリに読み込まれることがないので、メモリの使用量を低く抑えることができる。ここで、計算機システム100のブロックのサイズが最小ブロックサイズの4KBのとき、ページのサイズも4KBになる。つまり、4KB単位でページがメモリに読み込まれる。従って、共有ライブラリ1211の先頭アドレスが常に4KB境界に一致していると、4KB容量以下の共有ライブラリ1211は1ページに納まるため、1ページ分のページング処理でメモリに読み込むことができる。 Thus, for example, when the computer system 100 adopts the on-demand paging method, efficient paging becomes possible. The reason is as follows. The on-demand paging method is a method in which a physical page (physical block) is allocated to a logical page (logical block) at the time when the memory contents of the corresponding address are required. In the on-demand paging method, the page is not read into the memory unless the page is actually accessed, so that the memory usage can be kept low. Here, when the block size of the computer system 100 is the minimum block size of 4 KB, the page size is also 4 KB. That is, pages are read into the memory in units of 4 KB. Therefore, if the top address of the shared library 1211 always coincides with the 4 KB boundary, the shared library 1211 having a capacity of 4 KB or less can be accommodated in one page, and can be read into the memory by paging processing for one page.
 なお、共有メモリ管理テーブル部132の構造は、上記で説明した以外にも様々な管理方式が考えられる。例えば、共有メモリブロック毎ではなく、空き領域ごとに管理する方式なども考えられる。これは、ある共有ライブラリ1211がどのプログラムからもリンクされなくなったら、当該共有ライブラリ1211がロードされていたメモリを解放するといった用途の場合に便利である。 Note that the shared memory management table unit 132 may have various management methods other than those described above. For example, a method of managing not every shared memory block but every free area is also conceivable. This is convenient for the purpose of releasing the memory in which the shared library 1211 is loaded when a certain shared library 1211 is not linked from any program.
 共有メモリ管理部131は、共有メモリ管理テーブル部132を参照したり書き換えたりして、プログラムにマップされる共有メモリ部111の物理アドレスや残り容量を管理している。 The shared memory management unit 131 refers to or rewrites the shared memory management table unit 132 to manage the physical address and remaining capacity of the shared memory unit 111 mapped to the program.
 共有ライブラリ管理テーブル部134は、共有ライブラリ1211の使用状況や共有メモリ部111へのロード状況などを管理するテーブルである。 The shared library management table unit 134 is a table for managing the usage status of the shared library 1211 and the loading status to the shared memory unit 111.
 図6は共有ライブラリ管理テーブル部134の1エントリの構造を示したものであり、共有ライブラリ名1341と、共有メモリブロックアドレス1342と、物理アドレス1343とによって構成される。共有ライブラリ管理テーブル部134のエントリには、これらの属性の他に、共有ライブラリ1211のアクセス制限を表わす属性や、その他の制御のための属性が含まれていてもよい。 FIG. 6 shows the structure of one entry of the shared library management table unit 134, which is composed of a shared library name 1341, a shared memory block address 1342, and a physical address 1343. In addition to these attributes, the entry of the shared library management table unit 134 may include an attribute representing access restriction of the shared library 1211 and other attributes for control.
 共有ライブラリ名1341は、ファイルシステム部121に含まれている共有ライブラリ1211のファイル名である。 The shared library name 1341 is the file name of the shared library 1211 included in the file system unit 121.
 共有メモリブロックアドレス1342は、当該共有ライブラリ1211がロードされている共有メモリ部111の共有メモリブロックアドレスである。 The shared memory block address 1342 is a shared memory block address of the shared memory unit 111 in which the shared library 1211 is loaded.
 物理アドレス1343は、当該共有ライブラリ1211がロードされている物理アドレスであり、共有メモリブロックアドレス1342で示される共有メモリ部111のブロックの中の物理アドレスである。 The physical address 1343 is a physical address at which the shared library 1211 is loaded, and is a physical address in the block of the shared memory unit 111 indicated by the shared memory block address 1342.
 プログラム実行部133は、プログラムを実行する際に必要な共有ライブラリ1211を共有メモリ部111にロードしてマッピングしたのちにプログラムを実行する。プログラム実行部133は、共有ライブラリ1211が既に共有メモリ部111にロードされているか否かの判断をしたり、共有メモリ部111にロードした共有ライブラリ1211の情報を得るために、共有ライブラリ管理テーブル部134を参照したり書き換えたりする。プログラム実行部133は、共有メモリ部111の1つのブロックに複数の共有ライブラリ1211を積極的にロードすることにより、メモリの内部フラグメンテーションの削減を図っている。 The program execution unit 133 loads the shared library 1211 necessary for executing the program to the shared memory unit 111 and maps it, and then executes the program. The program execution unit 133 determines whether or not the shared library 1211 is already loaded in the shared memory unit 111, and obtains information on the shared library 1211 loaded in the shared memory unit 111. 134 is referred to or rewritten. The program execution unit 133 attempts to reduce internal fragmentation of the memory by actively loading a plurality of shared libraries 1211 into one block of the shared memory unit 111.
 マッピングテーブル部135は、プログラムの仮想メモリアドレスと主記憶装置110の物理メモリアドレスの対応を記したものである。本実施の形態の計算機システム100は、個々のプログラムに仮想空間を独立に与える多重仮想記憶管理方式を採用しているため、マッピングテーブル部135は、プログラムごとに存在する。プログラムから指示されたメモリアクセスは、そのプログラムに対応するマッピングテーブル部135を仮想アドレスでもって検索して得られた物理アドレスを用いて主記憶装置110にアクセスする。なお、本発明を適用する計算機システムは、多重仮想記憶管理方式を採用する計算機システムに限定されず、単一仮想記憶管理方式を採用している計算機システムに対しても適用可能である。 The mapping table part 135 describes the correspondence between the virtual memory address of the program and the physical memory address of the main storage device 110. Since the computer system 100 according to the present embodiment employs a multiple virtual storage management system that provides virtual space independently to each program, the mapping table unit 135 exists for each program. In the memory access instructed by the program, the main storage device 110 is accessed using the physical address obtained by searching the mapping table unit 135 corresponding to the program with the virtual address. A computer system to which the present invention is applied is not limited to a computer system that employs a multiple virtual storage management method, and can also be applied to a computer system that employs a single virtual storage management method.
 図7はマッピングテーブル部135の1エントリを示したものであり、仮想ブロックアドレス1351と、物理ブロックアドレス1352とよって構成されている。マッピングテーブル部135のエントリには、これらの属性の他に、メモリアクセスの読み/書き/実行などのアクセス制限を表わす属性や、その他の制御のための属性が含まれていてもよい。 FIG. 7 shows one entry of the mapping table unit 135, which is composed of a virtual block address 1351 and a physical block address 1352. In addition to these attributes, the entry of the mapping table unit 135 may include attributes representing access restrictions such as reading / writing / execution of memory access and other attributes for control.
 仮想ブロックアドレス1351は、プログラム毎に割り当てられている仮想メモリアドレスのブロック番号である。全てのプログラムが同じサイズを持つことができるため、例えば32ビットのアドレス空間の場合は、全てのプログラムが1,048,576エントリ相当の情報を保持する。 The virtual block address 1351 is a block number of a virtual memory address assigned for each program. Since all programs can have the same size, for example, in the case of a 32-bit address space, all programs hold information corresponding to 1,048,576 entries.
 物理ブロックアドレス1352は、プログラムが実際にロードされている物理メモリアドレスのブロック番号である。複数のプログラムのマッピングテーブル部135の同一あるいは異なる仮想ブロックアドレスに対応付けて、同じ物理ブロックアドレスが書かれると、これら複数のプログラムで当該物理ブロックを共有する状態となる。このため、当該物理ブロックに共有ライブラリ1211のテキスト領域を格納しておくと、共有ライブラリ1211のテキスト領域が複数のプログラムで共有されることになる。 The physical block address 1352 is a block number of a physical memory address where the program is actually loaded. When the same physical block address is written in association with the same or different virtual block address in the mapping table unit 135 of a plurality of programs, the plurality of programs are in a state of sharing the physical block. For this reason, if the text area of the shared library 1211 is stored in the physical block, the text area of the shared library 1211 is shared by a plurality of programs.
 マッピングアドレス決定部136は、マッピングテーブル部135を参照しながら、プログラムの実行に必要な共有ライブラリ1211をロードしてある共有メモリ部111のブロックを、プログラムにマップするための仮想メモリアドレスを決定する。更に、マッピングアドレス決定部136は、共有メモリ部111の物理ブロックアドレス1352と、決定された仮想ブロックアドレス1352とをマッピングテーブル部135に通知して、マッピングテーブル部135を更新する。 The mapping address determination unit 136 refers to the mapping table unit 135 to determine a virtual memory address for mapping the block of the shared memory unit 111 loaded with the shared library 1211 necessary for program execution to the program. . Further, the mapping address determination unit 136 notifies the mapping table unit 135 of the physical block address 1352 of the shared memory unit 111 and the determined virtual block address 1352 to update the mapping table unit 135.
 マッピングアドレス決定部136は、共有ライブラリ1211をプログラムの仮想アドレスにマッピングするとき、既に当該共有ライブラリ1211を含む共有メモリ部111のブロックがあった場合は、当該ブロックをマップし、無かった場合は当該共有ライブラリ1211を配置するのに充分空きのある共有メモリ部111のブロックを確保して当該共有ライブラリ1211を読み込み、そして、当該ブロックをプログラムの空いている仮想アドレスにマップする。 When mapping the shared library 1211 to the virtual address of the program, the mapping address determination unit 136 maps the block if there is already a block of the shared memory unit 111 including the shared library 1211, and otherwise maps the block. A block of the shared memory unit 111 that is sufficiently free to place the shared library 1211 is secured, the shared library 1211 is read, and the block is mapped to a free virtual address of the program.
 図2は本実施の形態に係る計算機システム100におけるプログラムの実行の動作を示したフローチャートである。ある実行プログラムの実行が指示されると、先ずプログラム実行部133が実行プログラムのファイルを検査して、必要な共有ライブラリ1211をその実行プログラムにマップする(ステップS10)。その後、プログラム実行部133は、実行プログラムを実行する(ステップS20)。 FIG. 2 is a flowchart showing the program execution operation in the computer system 100 according to the present embodiment. When the execution of a certain execution program is instructed, the program execution unit 133 first checks the file of the execution program and maps the necessary shared library 1211 to the execution program (step S10). Thereafter, the program execution unit 133 executes the execution program (step S20).
 図3は図2のステップS10の詳細、つまり本実施の形態におけるプログラム実行前の共有ライブラリ1211のマッピングの動作を示したフローチャートである。プログラムの実行が指示されると、プログラム実行部133は、実行プログラムの実行に必要な各共有ライブラリ1211に対して、図3の処理を行う。以下、図3を参照しながら本実施の形態における共有ライブラリ1211のマッピングの動作を説明する。 FIG. 3 is a flowchart showing the details of step S10 of FIG. 2, that is, the mapping operation of the shared library 1211 before executing the program in the present embodiment. When the execution of the program is instructed, the program execution unit 133 performs the process of FIG. 3 for each shared library 1211 necessary for executing the execution program. Hereinafter, the mapping operation of the shared library 1211 in the present embodiment will be described with reference to FIG.
 まず、プログラム実行部133は、共有ライブラリ管理テーブル部134を検索して、当該共有ライブラリ1211が既に共有メモリ部111にロードされているか否かの確認を行う(ステップS100)。 First, the program execution unit 133 searches the shared library management table unit 134 to check whether or not the shared library 1211 is already loaded in the shared memory unit 111 (step S100).
 当該共有ライブラリ1211が共有メモリ部111にロードされていなかった場合(ステップS100でNo)、当該共有ライブラリ1211がロードできるだけの十分な空きがある共有メモリ部111のブロックを共有メモリ管理部1131から割り当ててもらって(ステップS101)、この割り当てられた共有メモリ部11のブロックの空いている箇所にロードする(ステップS102)。共有ライブラリ1211のテキスト領域をロードする際には、テキスト領域の先頭の物理アドレスが、最小ブロックサイズで定まるアドレス境界に一致するように、共有ライブラリ1211のテキスト領域をブロックの空いている箇所にロードする。そして、プログラム実行部133は、マッピングアドレス決定部136により、実行プログラムの空いている仮想メモリアドレスを割り当て(ステップS103)、当該仮想メモリアドレスに当該共有メモリ部111の前記共有ライブラリ1211をロードしたブロックをマップする(ステップS104)。 If the shared library 1211 has not been loaded into the shared memory unit 111 (No in step S100), the shared memory management unit 1131 allocates a block of the shared memory unit 111 that has enough free space for the shared library 1211 to be loaded. Then, it is loaded (step S101) and loaded into a vacant part of the block of the allocated shared memory unit 11 (step S102). When the text area of the shared library 1211 is loaded, the text area of the shared library 1211 is loaded into an empty block so that the physical address at the head of the text area matches the address boundary determined by the minimum block size. To do. Then, the program execution unit 133 assigns a free virtual memory address of the execution program by the mapping address determination unit 136 (step S103) and loads the shared library 1211 of the shared memory unit 111 to the virtual memory address. Is mapped (step S104).
 プログラム実行部133は、必要な共有ライブラリ1211が共有メモリ部111にロードされている場合(ステップS100でYes)、実行プログラムの空いている仮想メモリアドレスをマッピングアドレス決定部136により割り当て(ステップS103)、当該仮想メモリアドレスに共有メモリ部11の前記共有ライブラリ1211がロードされていたブロックをマップする(ステップS104)。 When the necessary shared library 1211 is loaded in the shared memory unit 111 (Yes in step S100), the program execution unit 133 assigns a free virtual memory address of the execution program by the mapping address determination unit 136 (step S103). Then, the block in which the shared library 1211 of the shared memory unit 11 has been loaded is mapped to the virtual memory address (step S104).
 実行プログラムが必要としている全ての共有ライブラリを含む共有メモリをマップし終わったら、プログラム実行部133は実行プログラムの実行を開始する。 When the shared memory including all the shared libraries required by the execution program is mapped, the program execution unit 133 starts executing the execution program.
 なお、ある共有ライブラリ1211のマッピングを、実行プログラムの起動時ではなく実際に実行プログラムが当該共有ライブラリ1211中のライブラリ関数に最初にアクセスするときまで遅らせることも可能であるが、この場合でも処理の内容は同様である。 Note that the mapping of a certain shared library 1211 can be delayed until the execution program actually accesses the library function in the shared library 1211 for the first time, not when the execution program is started. The contents are the same.
 次に、本発明の第2の実施の形態について、図面を参照して詳細に説明する。 Next, a second embodiment of the present invention will be described in detail with reference to the drawings.
 図4を参照すると、第2の実施の形態に係る計算機システム100は、不揮発性記憶部112及び揮発性記憶部113で構成される主記憶装置110がCPU140にバス160を通じて接続されている。CPU140は、MMU141を有する。CPU140は、図1の第1の実施の形態のデータ処理装置130に相当する。 Referring to FIG. 4, in the computer system 100 according to the second embodiment, a main storage device 110 composed of a nonvolatile storage unit 112 and a volatile storage unit 113 is connected to a CPU 140 through a bus 160. The CPU 140 has an MMU 141. The CPU 140 corresponds to the data processing device 130 of the first embodiment in FIG.
 不揮発性記憶部112には、OS150及び複数のプログラム(図示せず)が予め記憶されている。また、マッピングアドレス決定部136、共有メモリ管理部131及びプログラム実行部133は、OS150の一機能として実装されている。 The nonvolatile storage unit 112 stores an OS 150 and a plurality of programs (not shown) in advance. Further, the mapping address determination unit 136, the shared memory management unit 131, and the program execution unit 133 are implemented as a function of the OS 150.
 揮発性記憶部113には、共有メモリ部111、マッピングテーブル部135、共有メモリ管理テーブル部132及び共有ライブラリ管理テーブル部134が確保されている。 In the volatile storage unit 113, a shared memory unit 111, a mapping table unit 135, a shared memory management table unit 132, and a shared library management table unit 134 are secured.
 図1に示した第1の実施の形態では、データ処理装置130が、共有メモリ管理部131、共有メモリ管理テーブル部132、プログラム実行部133、共有ライブラリ管理テーブル部134、マッピングテーブル部135およびマッピングアドレス決定部136をハードウェア的に備えているものとした。これに対して本実施の形態では、共有メモリ管理部131、プログラム実行部133およびマッピングアドレス決定部136は、CPU140とその上で実行されるOS150とによって実現している。また、共有メモリ管理テーブル部132、共有ライブラリ管理テーブル部134およびマッピングテーブル部135は、OS150から参照更新されるテーブル類として主記憶装置110に格納されている。このように、共有メモリ管理部131、プログラム実行部133およびマッピングアドレス決定部136は、ハードウェア的に実現することができると共にソフトウェア的に実現することが可能である。 In the first embodiment shown in FIG. 1, the data processing apparatus 130 includes a shared memory management unit 131, a shared memory management table unit 132, a program execution unit 133, a shared library management table unit 134, a mapping table unit 135, and a mapping It is assumed that the address determination unit 136 is provided in hardware. On the other hand, in the present embodiment, the shared memory management unit 131, the program execution unit 133, and the mapping address determination unit 136 are realized by the CPU 140 and the OS 150 executed thereon. The shared memory management table unit 132, the shared library management table unit 134, and the mapping table unit 135 are stored in the main storage device 110 as tables that are referenced and updated from the OS 150. As described above, the shared memory management unit 131, the program execution unit 133, and the mapping address determination unit 136 can be realized in hardware and can be realized in software.
 図10に主記憶装置110の物理ブロックアドレスの割り当て例を示す。図10に示されるように、不揮発性記憶部112には、物理ブロックアドレス0x11~0x19が割り当てられており、共有メモリ部111には、物理ブロックアドレス0x111~0x119が割り当てられている。図10では本実施の形態を簡単に説明するために極めてサイズを小さくしており、実際の記憶媒体には沢山の物理ブロックアドレスが割り当てられる。 FIG. 10 shows an example of physical block address allocation of the main storage device 110. As shown in FIG. 10, physical block addresses 0x11 to 0x19 are assigned to the nonvolatile storage unit 112, and physical block addresses 0x111 to 0x119 are assigned to the shared memory unit 111. In FIG. 10, the size is extremely small in order to easily explain the present embodiment, and many physical block addresses are assigned to the actual storage medium.
 本実施の形態では、指定により選択されたメモリブロックサイズは1メガバイト(16進数で0x100000)とし、最小ブロックサイズは4キロバイト(16進数で0x1000)とする。 In this embodiment, the memory block size selected by designation is 1 megabyte (hexadecimal 0x100000), and the minimum block size is 4 kilobytes (hexadecimal 0x1000).
 図11に、第1の実行プログラム(大きさは1メガバイト)の初期状態のマッピングテーブル部135の内容の具体的な例を示す。図11は説明を容易にするために極端にエントリ数を減らしているが、実際には沢山のエントリが存在する。図11に示されるように、初期状態では、第1の実行プログラムの仮想ブロックアドレス0x1000のブロックに対して、不揮発性記憶部111に記憶された第1の実行プログラムを記憶するブロックの物理ブロックアドレス0x12が書かれている。 FIG. 11 shows a specific example of the contents of the mapping table unit 135 in the initial state of the first execution program (size is 1 megabyte). Although the number of entries is extremely reduced in FIG. 11 for ease of explanation, there are actually many entries. As shown in FIG. 11, in the initial state, the physical block address of the block that stores the first execution program stored in the nonvolatile storage unit 111 for the block of the virtual block address 0x1000 of the first execution program 0x12 is written.
 図13に、第2の実行プログラム(大きさは2メガバイト)の初期状態のマッピングテーブル部135の内容の具体的な例を示す。図13は説明を容易にするために極端にエントリ数を減らしているが、実際には沢山のエントリが存在する。図13に示されるように、初期状態では、第2の実行プログラムの仮想ブロックアドレス0x1000、0x1001のブロックに対して、不揮発性記憶部111に記憶された第2の実行プログラムを記憶するブロックの物理ブロックアドレス0x13、0x14が書かれている。 FIG. 13 shows a specific example of the contents of the mapping table unit 135 in the initial state of the second execution program (size is 2 megabytes). Although the number of entries is extremely reduced in FIG. 13 for ease of explanation, there are actually many entries. As shown in FIG. 13, in the initial state, the physical block of the block that stores the second execution program stored in the nonvolatile storage unit 111 for the block of the virtual block addresses 0x1000 and 0x1001 of the second execution program. Block addresses 0x13 and 0x14 are written.
 図15に、共有メモリ管理テーブル部132の初期状態の具体的な内容を示す。図15は説明を容易にするために極端にエントリ数を減らしているが、実際には沢山のエントリが存在する。図15に示されるように、初期状態では各共有メモリブロックには共有ライブラリはロードされておらず、全て空き領域となっている。 FIG. 15 shows the specific contents of the initial state of the shared memory management table unit 132. Although the number of entries is extremely reduced in FIG. 15 for ease of explanation, there are actually many entries. As shown in FIG. 15, in the initial state, the shared library is not loaded in each shared memory block, and all are free areas.
 図19に、共有ライブラリ管理テーブル部134の初期状態の具体的な内容を示す。図19は説明を容易にするために極端にエントリ数を減らしているが、実際には沢山のエントリが存在する。図19に示されるように、初期状態では共有ライブラリ管理テーブル部134の全てのエントリはNULLになる。すなわち、初期状態では共有ライブラリ1211は共有メモリ部111に1つもロードされていない。 FIG. 19 shows specific contents of the initial state of the shared library management table unit 134. Although the number of entries is extremely reduced in FIG. 19 for ease of explanation, there are actually many entries. As shown in FIG. 19, in the initial state, all entries in the shared library management table unit 134 are NULL. That is, in the initial state, no shared library 1211 is loaded in the shared memory unit 111.
 今、第1の実行プログラムの必要とする共有ライブラリを以下の2つとする。
(1)共有ライブラリ/lib/libc.so(テキスト領域は1キロバイト)(以下、共有ライブラリcと記す)
(2)共有ライブラリ/lib/libm.so(テキスト領域は8キロバイト)(以下、共有ライブラリmと記す)。
Now, the following two shared libraries are required by the first execution program.
(1) Shared library / lib / libc. so (text area is 1 kilobyte) (hereinafter referred to as shared library c)
(2) Shared library / lib / libm. so (text area is 8 kilobytes) (hereinafter referred to as shared library m).
 また、第2の実行プログラムの必要とする共有ライブラリを以下の2つとする。
(1)共有ライブラリm。
(2)共有ライブラリ/lib/libj.so(テキスト領域は16キロバイト)(以下、共有ライブラリjと記す)。
The following two shared libraries are required by the second execution program.
(1) Shared library m.
(2) Shared library / lib / libj. so (text area is 16 kilobytes) (hereinafter referred to as shared library j).
 つまり、第1のプログラムと第2のプログラムとは、同じ共有ライブラリmを必要としている。また、第1のプログラムは、第2のプログラムが必要とする共有ライブラリjは必要とせず、第2のプログラムは、第1のプログラムが必要とする共有ライブラリcは必要としていない。 That is, the first program and the second program require the same shared library m. Further, the first program does not require the shared library j required by the second program, and the second program does not require the shared library c required by the first program.
 このような仮定の下で、次のような4つの具体的な一連の共有ライブラリマッピング処理が行われたときの動作に関して説明する。 動作 Under such assumptions, the operation when the following four specific series of shared library mapping processes are performed will be described.
(1)第1の実行プログラムの共有ライブラリcのマッピング
(2)第1の実行プログラムの別の共有ライブラリmのマッピング
(3)第2の実行プログラムの共有ライブラリmのマッピング
(4)第2の実行プログラムの別の共有ライブラリjのマッピング
(1) Mapping of the shared library c of the first execution program (2) Mapping of another shared library m of the first execution program (3) Mapping of the shared library m of the second execution program (4) Second Mapping of another shared library j of the executable program
 先ず、第1の実行プログラムが共有ライブラリcをマッピングするときの流れを説明する。 First, the flow when the first execution program maps the shared library c will be described.
 第1の実行プログラムは1メガバイトの大きさで、物理メモリブロックの0x12にロードされており、それに対応する仮想ブロックアドレスは0x1000を使用している。1メガバイトなので、物理メモリブロックは1つのみを使用している。この場合、第1の実行プログラムのマッピングテーブル部135は図11のようになっている。 The first execution program has a size of 1 megabyte and is loaded into the physical memory block 0x12, and the corresponding virtual block address uses 0x1000. Since it is 1 megabyte, only one physical memory block is used. In this case, the mapping table unit 135 of the first execution program is as shown in FIG.
 プログラム実行部133は、共有ライブラリ管理テーブル部134の各エントリを検索して、共有ライブラリcがいずれかの共有メモリブロックに含まれているかを検索する。 The program execution unit 133 searches each entry in the shared library management table unit 134 to search whether the shared library c is included in any shared memory block.
 このときの共有ライブラリ管理テーブル部134は図19の状態なので、共有ライブラリcは共有メモリ部111には未だロードされていないことが分かる。そこで、プログラム実行部133は、共有メモリ管理部131に対して、共有ライブラリcのテキスト領域のサイズ1キロバイトを通知して、共有メモリ部111のブロックを要求する。共有メモリ管理部131は、共有メモリ管理テーブル部132を参照すると、図15の状態なので、1キロバイトの空きのある共有メモリブロックに関する情報として、例えば共有メモリブロックアドレス0と、先頭アドレス0x11100000とをプログラム実行部133に返す。 Since the shared library management table unit 134 at this time is in the state shown in FIG. 19, it can be seen that the shared library c is not yet loaded in the shared memory unit 111. Therefore, the program execution unit 133 notifies the shared memory management unit 131 of the size of 1 kilobyte of the text area of the shared library c and requests a block of the shared memory unit 111. Since the shared memory management unit 131 refers to the shared memory management table unit 132 and is in the state shown in FIG. 15, for example, a shared memory block address 0 and a head address 0x11100000 are programmed as information related to a shared memory block having a free space of 1 kilobyte. Return to the execution unit 133.
 プログラム実行部133は、共有ライブラリcをファイルシステム部121から共有メモリ部111に読み込むように指示を出し、共有ライブラリcを共有メモリ部111のブロックアドレス0のブロックの物理アドレス0x11100000から始まる1キロバイトの領域にロードする。プログラム実行部133は、このロードが完了すると、共有ライブラリ管理テーブル部134に「共有ライブラリ名/lib/libc.so」、「共有メモリブロックアドレス0」、「物理アドレス0x11100000」を登録する。これにより、共有ライブラリ管理テーブル部134は、図19の状態から図20の状態になる。 The program execution unit 133 issues an instruction to read the shared library c from the file system unit 121 to the shared memory unit 111, and the shared library c is 1 kilobyte starting from the physical address 0x11100000 of the block at the block address 0 of the shared memory unit 111. Load into region. When the loading is completed, the program execution unit 133 registers “shared library name / lib / libc.so”, “shared memory block address 0”, and “physical address 0x11100000” in the shared library management table unit 134. As a result, the shared library management table unit 134 changes from the state of FIG. 19 to the state of FIG.
 また、プログラム実行部133は、共有ライブラリcのテキスト領域のサイズは1キロバイトであるが、最小ブロックサイズが4キロバイトなので、共有メモリ管理部131を通じて、共有メモリブロックアドレス0のブロックの空きサイズを4キロバイトだけ減らすべく共有メモリ管理テーブル部132を更新する。これにより、共有メモリ管理テーブル部132は、図15の状態から図16の状態になる。 In addition, the program execution unit 133 sets the size of the text area of the shared library c to 1 kilobyte, but the minimum block size is 4 kilobytes. The shared memory management table unit 132 is updated to reduce only kilobytes. As a result, the shared memory management table unit 132 changes from the state of FIG. 15 to the state of FIG.
 さらに、マッピングアドレス決定部136は、第1のプログラムの仮想メモリブロックの空き領域を探索する。今、0x1001を得たとすると、マッピングアドレス決定部136は、第1のプログラムのマッピングテーブル部135に「仮想ブロックアドレス0x1001」、「物理ブロックアドレス0x111」を登録する。これにより、第1のプログラムのマッピングテーブル部135は、図11の状態から図12の状態になる。 Further, the mapping address determination unit 136 searches for an empty area of the virtual memory block of the first program. Assuming that 0x1001 is obtained, the mapping address determination unit 136 registers “virtual block address 0x1001” and “physical block address 0x111” in the mapping table unit 135 of the first program. As a result, the mapping table unit 135 of the first program changes from the state of FIG. 11 to the state of FIG.
 プログラム実行部133は、共有ライブラリcのデータ領域について、従来と同様の方法により共有メモリ以外のメモリの空きブロックにロードし、そのブロックを第1のプログラムの仮想メモリブロックにマップする。 The program execution unit 133 loads the data area of the shared library c into an empty block of a memory other than the shared memory by a method similar to the conventional method, and maps the block to a virtual memory block of the first program.
 プログラム実行部133は、共有ライブラリcを第1の実行プログラムから呼び出すために必要な情報として、「共有ライブラリ名/lib/libm.so」、「仮想アドレス0x100100000」を保持する。共有ライブラリcが複数のライブラリ関数を含む場合、実際に呼び出されるのは共有ライブラリc中のライブラリ関数である。動的リンクを実現する具体的な処理は、ELFなどの標準のフォーマットに従う。 The program execution unit 133 holds “shared library name / lib / libm.so” and “virtual address 0x100100000” as information necessary for calling the shared library c from the first execution program. When the shared library c includes a plurality of library functions, what is actually called is a library function in the shared library c. Specific processing for realizing dynamic linking follows a standard format such as ELF.
 上述のようにして共有ライブラリcをリンクした状態で、さらに第1の実行プログラムが別の共有ライブラリmをリンクする際の動作を説明する。 The operation when the first execution program links another shared library m with the shared library c linked as described above will be described.
 プログラム実行部133は、共有ライブラリ管理テーブル部134の各エントリを検索して、共有ライブラリmがいずれかの共有メモリブロックに含まれているかを検索する。このときの共有ライブラリ管理テーブル部134は図20の状態なので、共有ライブラリmは共有メモリ部111にロードされていないことが分かる。 The program execution unit 133 searches each entry of the shared library management table unit 134 to search whether the shared library m is included in any shared memory block. Since the shared library management table unit 134 at this time is in the state shown in FIG. 20, it can be seen that the shared library m is not loaded in the shared memory unit 111.
 そこで、プログラム実行部133は、共有メモリ管理部131に対して、共有ライブラリmのテキスト領域のサイズ8キロバイトを通知して、共有メモリ部111のブロックを要求する。共有メモリ管理部131は、共有メモリ管理テーブル部132を参照すると、図16の状態なので、8キロバイト以上の空きのある共有メモリブロックに関する情報として、例えば共有メモリブロック番号0と、先頭アドレス0x11101000とをプログラム実行部133に返す。 Therefore, the program execution unit 133 notifies the shared memory management unit 131 of the size of the text area of the shared library m, 8 kilobytes, and requests a block of the shared memory unit 111. When the shared memory management unit 131 refers to the shared memory management table unit 132 and is in the state of FIG. 16, for example, the shared memory block number 0 and the head address 0x11101000 are used as information related to a shared memory block having a free space of 8 kilobytes or more. It returns to the program execution unit 133.
 プログラム実行部133は、共有ライブラリmをファイルシステム部121から共有メモリ部111に読み込むように指示を出し、共有ライブラリmを共有メモリブロックアドレス0のブロックの物理アドレス0x11101000から始まる8キロバイトの領域にロードする。 The program execution unit 133 issues an instruction to read the shared library m from the file system unit 121 to the shared memory unit 111, and loads the shared library m into an 8 kilobyte area starting from the physical address 0x11101000 of the block of the shared memory block address 0 To do.
 プログラム実行部133は、このロードが完了すると、共有ライブラリ管理テーブル部134に「共有ライブラリ名/lib/libm.so」、「共有メモリブロックアドレス0」、「物理アドレス0x11101000」を登録する。これにより、共有ライブラリ管理テーブル部134は、図20の状態から図21の状態になる。 When this loading is completed, the program execution unit 133 registers “shared library name / lib / libm.so”, “shared memory block address 0”, and “physical address 0x11101000” in the shared library management table unit 134. As a result, the shared library management table unit 134 changes from the state of FIG. 20 to the state of FIG.
 また、プログラム実行部133は、共有ライブラリmのテキスト領域のサイズは8キロバイト、最小ブロックサイズが4キロバイトなので、共有メモリ管理部131を通じて、共有メモリブロック番号0の空きサイズを8キロバイトだけ減らすべく共有メモリ管理テーブル部132を更新する。これにより、共有メモリ管理テーブル部132は、図16の状態から図17の状態になる。 In addition, since the size of the text area of the shared library m is 8 kilobytes and the minimum block size is 4 kilobytes, the program execution unit 133 is shared through the shared memory management unit 131 to reduce the free size of the shared memory block number 0 by 8 kilobytes. The memory management table unit 132 is updated. As a result, the shared memory management table unit 132 changes from the state of FIG. 16 to the state of FIG.
 共有メモリブロックアドレス0のブロックは、既に第1の実行プログラムにマッピングされているので、あらためてマッピングアドレス決定部136が第1の実行プログラムのマッピングテーブル部135にマッピング処理を行う必要はない。つまり、第1のプログラムのマッピングテーブル部135は、図12の状態のままである。 Since the block having the shared memory block address 0 is already mapped to the first execution program, the mapping address determination unit 136 does not need to perform mapping processing on the mapping table unit 135 of the first execution program again. That is, the mapping table section 135 of the first program remains in the state shown in FIG.
 プログラム実行部133は、共有ライブラリmのデータ領域について、従来と同様の方法により共有メモリ以外のメモリの空きブロックにロードし、そのブロックを第1のプログラムの仮想メモリブロックにマップする。 The program execution unit 133 loads the data area of the shared library m into an empty block of a memory other than the shared memory by a method similar to the conventional method, and maps the block to a virtual memory block of the first program.
 ブロック内オフセットが0x1000なので、プログラム実行部133は、共有ライブラリmを第1の実行プログラムから呼び出すために必要な情報として、「共有ライブラリ名/lib/libm.so」、「仮想アドレス0x100101000」の情報を第1の実行プログラムのデータ領域(図示しない)に保持する。 Since the in-block offset is 0x1000, the program execution unit 133 has information of “shared library name / lib / libm.so” and “virtual address 0x100101000” as information necessary for calling the shared library m from the first execution program. Are stored in the data area (not shown) of the first execution program.
 このように、共有メモリ部11のブロックに空きがある場合、複数の共有ライブラリのテキスト領域で1つの共有メモリブロックを共有するため、メモリの内部フラグメンテーションを小さくできる。 As described above, when there is an empty block in the shared memory unit 11, one shared memory block is shared by the text areas of a plurality of shared libraries, so that the internal fragmentation of the memory can be reduced.
 上述のようにして第1の実行プログラムが共有ライブラリcと共有ライブラリmをリンクした状態で、さらに第2の実行プログラムが共有ライブラリmをマッピングする処理を次に説明する。 A process in which the second execution program maps the shared library m with the first execution program linked to the shared library c and the shared library m as described above will be described next.
 第2の実行プログラムの本体は2メガバイトの大きさで、物理メモリブロックの0x13~0x14にロードされている。また、仮想ブロックアドレスは0x1000~0x1001を使用している。2メガバイトなので、物理メモリブロックは2つ使用している。この場合、第2の実行プログラムのマッピングテーブル部135は図13のようになっている。 The main body of the second execution program has a size of 2 megabytes and is loaded into physical memory blocks 0x13 to 0x14. Further, 0x1000 to 0x1001 are used as virtual block addresses. Since it is 2 megabytes, two physical memory blocks are used. In this case, the mapping table unit 135 of the second execution program is as shown in FIG.
 プログラム実行部133は、共有ライブラリ管理テーブル部134の各エントリを検索して、共有ライブラリmがいずれかの共有メモリブロックに含まれているかを検索する。このときの共有ライブラリ管理テーブル部134は図21の状態なので、共有ライブラリmは既に物理ブロックアドレス0x111の共有メモリブロックアドレス0のブロックにロードされていることが分かる。 The program execution unit 133 searches each entry of the shared library management table unit 134 to search whether the shared library m is included in any shared memory block. Since the shared library management table unit 134 at this time is in the state shown in FIG. 21, it can be seen that the shared library m is already loaded in the block of the shared memory block address 0 of the physical block address 0x111.
 マッピングアドレス決定部136は、第2の実行プログラムの仮想メモリブロックの空き領域を探し、0x1002を得たとする。マッピングアドレス決定部136は、第2の実行プログラムのマッピングテーブル部135に「仮想ブロックアドレス0x1002」、「物理ブロックアドレス0x111」を登録する。これにより、第2の実行プログラムのマッピングテーブル部135は、図13の状態から図14の状態になる。 Suppose that the mapping address determination unit 136 searches for a free area in the virtual memory block of the second execution program and obtains 0x1002. The mapping address determination unit 136 registers “virtual block address 0x1002” and “physical block address 0x111” in the mapping table unit 135 of the second execution program. As a result, the mapping table unit 135 of the second execution program changes from the state of FIG. 13 to the state of FIG.
 ブロック内オフセットが0x1000なので、プログラム実行部133は、共有ライブラリmを第2の実行プログラムから呼び出すために必要な情報として、「共有ライブラリ名/lib/libm.so」、「仮想アドレス0x100201000」の情報を第2の実行プログラムのデータ領域(図示しない)に保持する。 Since the in-block offset is 0x1000, the program execution unit 133 has information of “shared library name / lib / libm.so” and “virtual address 0x100201000” as information necessary for calling the shared library m from the second execution program. Are stored in the data area (not shown) of the second execution program.
 このとき、共有メモリブロックアドレス0のブロックには、共有ライブラリcと共有ライブラリmの両方がロードされている。第2のプログラムは、共有ライブラリcをリンクする必要はないのだが、結果として第2のプログラムのアドレス空間からは読むことはできる。しかしながら読み込み専用でマッピングしているので、共有ライブラリcを共有していても特に問題にはならない。 At this time, both the shared library c and the shared library m are loaded in the block of the shared memory block address 0. The second program does not need to link the shared library c, but can be read from the address space of the second program as a result. However, since mapping is performed in a read-only manner, there is no particular problem even if the shared library c is shared.
 次に、第2の実行プログラムの更に別の共有ライブラリjのマッピングの処理を説明する。 Next, another mapping process of the shared library j of the second execution program will be described.
 プログラム実行部133は、共有ライブラリ管理テーブル部134の各エントリを検索して、共有ライブラリjがいずれかの共有メモリブロックに含まれているかを検索する。このときの共有ライブラリ管理テーブル部134は図21の状態なので、共有ライブラリjは共有メモリ部111にロードされていないことが分かる。 The program execution unit 133 searches each entry in the shared library management table unit 134 to search whether the shared library j is included in any shared memory block. Since the shared library management table unit 134 at this time is in the state shown in FIG. 21, it can be seen that the shared library j is not loaded in the shared memory unit 111.
 そこで、プログラム実行部133は、共有メモリ管理部131に対して、共有ライブラリjのテキスト領域のサイズ16キロバイトを通知して、共有メモリ部111のブロックを要求する。共有メモリ管理部131は、共有メモリ管理テーブル部132を参照すると、図17の状態なので、16キロバイト以上の空きのある共有メモリブロックに関する情報として、例えば共有メモリブロックアドレス0と、先頭アドレス0x11103000とをプログラム実行部133に返す。 Therefore, the program execution unit 133 notifies the shared memory management unit 131 of the size of the text area of the shared library j, which is 16 kilobytes, and requests a block of the shared memory unit 111. When the shared memory management unit 131 refers to the shared memory management table unit 132, the shared memory management table unit 132 is in the state of FIG. It returns to the program execution unit 133.
 プログラム実行部133は、共有ライブラリjをファイルシステム部121から共有メモリ部111に読み込むように指示を出し、共有ライブラリjを共有メモリブロックアドレス0のブロックにおける物理アドレス0x11103000から始まる16キロバイトの領域にロードする。 The program execution unit 133 issues an instruction to read the shared library j from the file system unit 121 to the shared memory unit 111, and loads the shared library j into a 16-kilobyte area starting from the physical address 0x1113000 in the block of the shared memory block address 0 To do.
 プログラム実行部133は、このロードが完了すると、共有ライブラリ管理テーブル部134に「共有ライブラリ名/lib/libj.so」、「共有メモリブロックアドレス0」、「物理アドレス0x11103000」を登録する。これにより、共有ライブラリ管理テーブル部134は、図21の状態から図22の状態になる。 When this loading is completed, the program execution unit 133 registers “shared library name / lib / libj.so”, “shared memory block address 0”, and “physical address 0x11103000” in the shared library management table unit 134. As a result, the shared library management table unit 134 changes from the state of FIG. 21 to the state of FIG.
 また、プログラム実行部133は、共有ライブラリjのテキスト領域のサイズは16キロバイト、最小ブロックサイズが4キロバイトなので、共有メモリ管理部131を通じて、共有メモリブロック番号0の空きサイズを16キロバイトだけ減らすべく共有メモリ管理テーブル部132を更新する。これにより、共有メモリ管理テーブル部132は、図17の状態から図18の状態になる。 In addition, since the size of the text area of the shared library j is 16 kilobytes and the minimum block size is 4 kilobytes, the program execution unit 133 is shared through the shared memory management unit 131 to reduce the free size of the shared memory block number 0 by 16 kilobytes. The memory management table unit 132 is updated. As a result, the shared memory management table unit 132 changes from the state of FIG. 17 to the state of FIG.
 共有メモリブロックアドレス0のブロックは、既に第2の実行プログラムにマッピングされているので、あらためてマッピングアドレス決定部136が第2の実行プログラムのマッピングテーブル部135にマッピング処理を行う必要はない。つまり、第2のプログラムのマッピングテーブル部135は、図14の状態のままである。 Since the block having the shared memory block address 0 has already been mapped to the second execution program, the mapping address determination unit 136 does not need to perform the mapping process on the mapping table unit 135 of the second execution program again. That is, the mapping table part 135 of the second program remains in the state shown in FIG.
 プログラム実行部133は、共有ライブラリjのデータ領域について、従来と同様の方法により共有メモリ以外のメモリの空きブロックにロードし、そのブロックを第2のプログラムの仮想メモリブロックにマップする。 The program execution unit 133 loads the data area of the shared library j into an empty block of a memory other than the shared memory by a method similar to the conventional method, and maps the block to a virtual memory block of the second program.
 ブロック内オフセットが0x3000なので、プログラム実行部133は、共有ライブラリjを第2の実行プログラムから呼び出すために必要な情報として、「共有ライブラリ名/lib/libj.so」、「仮想アドレス0x100203000」の情報を保持する。 Since the intra-block offset is 0x3000, the program execution unit 133 includes information on “shared library name / lib / libj.so” and “virtual address 0x100203000” as information necessary for calling the shared library j from the second execution program. Hold.
 このとき、共有メモリブロックアドレス0のブロックには、共有ライブラリcと共有ライブラリmと共有ライブラリjの3つがロードされている。第1のプログラムは、共有ライブラリjをリンクする必要はないのだが、結果として第1のプログラムのアドレス空間からは読むことはできる。しかしながら、読み込み専用でマッピングしているので、共有ライブラリjを共有していても特に問題にはならない。 At this time, the shared memory block address 0 is loaded with the shared library c, the shared library m, and the shared library j. The first program does not need to link the shared library j, but as a result can be read from the address space of the first program. However, since the mapping is performed only for reading, there is no particular problem even if the shared library j is shared.
 そして、第2の実行プログラムの共有ライブラリマッピング処理が終了して、第2の実行プログラムの実行が始まる。 Then, the shared library mapping process of the second execution program ends, and the execution of the second execution program starts.
 このように、第1および第2の実施の形態によれば、共有ライブラリを共有メモリにロードする際に生じるメモリの内部フラグメンテーションを小さく抑えることができる。 Thus, according to the first and second embodiments, the internal fragmentation of the memory that occurs when the shared library is loaded into the shared memory can be kept small.
 その第1の理由は、1つの共有メモリブロックを複数の共有ライブラリのテキスト領域で共有しているからである。 The first reason is that one shared memory block is shared by multiple shared library text areas.
 また第2の理由は、1つの共有メモリブロックを複数の実行プログラムのテキスト領域で共有するときに、当該実行プログラムで不必要な共有ライブラリのテキスト領域が含まれていても、複数の実行プログラム間で共有を行うからである。つまり、或るプログラムで利用する共有ライブラリのテキスト領域を新たにロードする際、そのプログラムが利用しない共有ライブラリのテキスト領域が既にロードされている共有メモリブロックであっても、空き領域がある限り、ロード先の共有メモリブロックとして選択するアルゴリズムを採用しているためである。 The second reason is that when one shared memory block is shared by the text areas of a plurality of execution programs, even if a text area of a shared library which is unnecessary for the execution program is included, Because sharing is done. That is, when a shared library text area used by a program is newly loaded, even if the shared library text area not used by the program is already loaded, as long as there is a free area, This is because an algorithm for selecting as a load destination shared memory block is employed.
 例えば、従来は図8のようにロードされていた2つの共有ライブラリAとBは、本発明の手法を用いることで図9のようにロードされるようになる。図9は、最小ブロックサイズを2キロバイトにした場合の例である。 For example, the two shared libraries A and B that are conventionally loaded as shown in FIG. 8 are loaded as shown in FIG. 9 by using the method of the present invention. FIG. 9 shows an example when the minimum block size is 2 kilobytes.
 以上の第1および第2の実施の形態では、プログラム実行部133は、共有ライブラリ1211のテキスト領域をロードする先頭の物理アドレスが、ブロックのサイズの最小値(第1および第2の実施の形態では4KB)で定まるアドレス境界に一致するように、共有ライブラリ1211のテキスト領域を共有メモリ部111のメモリブロックにロードした。しかし、本発明の第3の実施の形態として、プログラム実行部133は、共有ライブラリ1211のテキスト領域をロードする先頭の物理アドレスが、ブロックのサイズの最小値よりも小さいサイズで定まるアドレス境界に一致するように、共有ライブラリ1211のテキスト領域を共有メモリ部111のメモリブロックにロードするようにしてもよい。このような第3の実施の形態によれば、共有ライブラリのテキスト領域を共有メモリにロードする際に生じるメモリの内部フラグメンテーションをより小さく抑えることができる。 In the first and second embodiments described above, the program execution unit 133 determines that the top physical address for loading the text area of the shared library 1211 is the minimum block size (first and second embodiments). In this case, the text area of the shared library 1211 is loaded into the memory block of the shared memory unit 111 so as to coincide with the address boundary determined by 4 KB). However, as a third embodiment of the present invention, the program execution unit 133 matches the address boundary determined by the size of the head physical address for loading the text area of the shared library 1211 smaller than the minimum block size. As described above, the text area of the shared library 1211 may be loaded into the memory block of the shared memory unit 111. According to the third embodiment, the internal fragmentation of the memory that occurs when the text area of the shared library is loaded into the shared memory can be further reduced.
 以上の各実施の形態では、共有ライブラリのテキスト領域を共有メモリに配置する場合を取り上げたが、共有ライブラリのテキスト領域以外の読み込み専用データ、例えば読み込み専用データファイルのデータを共有メモリに配置する場合についても本発明は適用可能である。 In each of the above embodiments, the case where the text area of the shared library is arranged in the shared memory has been taken up. However, when read-only data other than the text area of the shared library, for example, the data of the read-only data file is arranged in the shared memory. The present invention is also applicable to.
[第3の実施の形態]
 次に、本発明の第3の実施の形態を図23を参照して説明する。図23は、本実施の形態における計算機システムの構成を示すブロック図である。なお、本実施の形態は、上述した計算機システムの概略を説明する。
[Third Embodiment]
Next, a third embodiment of the present invention will be described with reference to FIG. FIG. 23 is a block diagram illustrating a configuration of a computer system according to the present embodiment. In the present embodiment, an outline of the above-described computer system will be described.
 図23に示すように、本実施の形態における計算機システムは、1以上のプログラムにより共通に利用される読み込み専用データを含むファイル1を複数記憶する外部記憶装置2と、上記1以上のプログラムで共通に利用される共有メモリ部3を含む主記憶装置4と、外部記憶装置2および主記憶装置4に接続されたデータ処理装置5とから構成される計算機システムにおいて、共有メモリ部3の同じメモリブロックに複数のファイル1の読み込み専用データをロードするプログラム実行部6を備えている。 As shown in FIG. 23, the computer system according to the present embodiment is common to the external storage device 2 that stores a plurality of files 1 including read-only data commonly used by one or more programs and the one or more programs. The same memory block of the shared memory unit 3 in a computer system composed of the main storage device 4 including the shared memory unit 3 used for the memory, the external storage device 2 and the data processing device 5 connected to the main storage device 4 Are provided with a program execution unit 6 for loading read-only data of a plurality of files 1.
 そして、上記計算機システムでは、プログラム実行部6は、ファイル1の読み込み専用データをロードする先頭の物理アドレスが、所定サイズで定まるアドレス境界に一致するように、ファイル1の読み込み専用データを共有メモリ部3のメモリブロックにロードする、という構成を採る。 In the computer system, the program execution unit 6 transfers the read-only data of the file 1 to the shared memory unit so that the leading physical address for loading the read-only data of the file 1 matches the address boundary determined by a predetermined size. 3 is loaded into the memory block.
 また、上記計算機システムでは、上記所定サイズとして、記憶空間の管理単位であるブロックのサイズの最小値を用いる、という構成を採る。 The computer system adopts a configuration in which the minimum value of the block size, which is a storage space management unit, is used as the predetermined size.
 また、上記計算機システムでは、記憶空間の管理単位であるブロックのサイズが可変になっており、ブロックのサイズの最小値をSとするとき、それ以外で可変なブロックのサイズがSの2n(nは正の整数)倍になっている、という構成を採る。 In the computer system, the size of a block, which is a management unit of storage space, is variable. When the minimum value of the block size is S, the variable block size other than that is 2 n (S). The configuration is such that n is a positive integer) times.
 また、上記計算機システムでは、プログラム実行部6は、或るプログラムで利用するファイルの読み込み専用データを共有メモリ部3のメモリブロックに新たにロードする際、そのプログラムが利用しないファイルの読み込み専用データが既にロードされているメモリブロックであっても、空き領域がある限り、ロード先のメモリブロックとして選択する、という構成を採る。 In the computer system, when the program execution unit 6 newly loads read-only data of a file used in a certain program into the memory block of the shared memory unit 3, the read-only data of the file that is not used by the program is stored. A configuration is adopted in which even a memory block that has already been loaded is selected as a load destination memory block as long as there is an empty area.
 また、上記計算機システムでは、共有メモリ部3のメモリブロックの空き状況を管理する共有メモリ管理テーブル部と、共有メモリ部3のメモリブロックに、ファイルの読み込み専用データをロードしたとき、上記所定サイズをS、ロードしたファイルの読み込み専用データのサイズをL、小数点以下を切り上げる関数をfupとするとき、上記共有メモリ管理テーブル部で管理する当該メモリブロックの空きサイズを、S×fup(L/S)だけ減算する共有メモリ管理部とを備える、という構成を採る。 In the computer system, when the read-only data of the file is loaded into the shared memory management table unit for managing the free state of the memory block of the shared memory unit 3 and the memory block of the shared memory unit 3, the predetermined size is set. S, where L is the size of the read-only data of the loaded file and f up is a function for rounding up the decimal point, the free size of the memory block managed by the shared memory management table unit is expressed as S × f up (L / S) A shared memory management unit that subtracts only is adopted.
 また、上記計算機システムでは、ファイル1の読み込み専用データが共有ライブラリのテキスト領域である、という構成を採る。 Also, the above computer system adopts a configuration in which the read-only data of file 1 is the text area of the shared library.
 また、上記計算機システムでは、ファイル1が読み込み専用データファイルである、という構成を採る。 Also, the above computer system adopts a configuration in which file 1 is a read-only data file.
 また、上述した計算機システムが作動することにより実行される、本発明の他の形態である読み込み専用データ管理方法は、1以上のプログラムにより共通に利用される読み込み専用データを含むファイル1を複数記憶する外部記憶装置2と、上記1以上のプログラムで共通に利用される共有メモリ部3を含む主記憶装置4と、外部記憶装置2および主記憶装置4に接続されたデータ処理装置5とから構成される計算機システムにおける読み込み専用データ管理方法であって、共有メモリ部3のメモリブロックにファイル1の読み込み専用データをロードするステップと、上記メモリブロックに空き領域がある場合に、他のファイルの読み込み専用データを上記メモリブロックにロードするステップと、を含む、という構成を採る。 The read-only data management method according to another embodiment of the present invention, which is executed when the above-described computer system operates, stores a plurality of files 1 including read-only data commonly used by one or more programs. And the external storage device 2 including the shared memory unit 3 commonly used in the one or more programs, and the external storage device 2 and the data processing device 5 connected to the main storage device 4. Read-only data management method in the computer system, the step of loading the read-only data of the file 1 into the memory block of the shared memory unit 3, and the reading of another file when there is an empty area in the memory block And a step of loading the dedicated data into the memory block.
 また、上述した計算機システムは、コンピュータに、プログラムが組み込まれることで実現できる。具体的には、本発明の他の形態であるプログラムは、1以上のプログラムにより共通に利用される読み込み専用データを含むファイル1を複数記憶する外部記憶装置2と、上記1以上のプログラムで共通に利用される共有メモリ部3を含む主記憶装置4と、外部記憶装置2および主記憶装置4に接続されたデータ処理装置5とから構成されるコンピュータを、共有メモリ部3の同じメモリブロックに複数のファイル1の読み込み専用データをロードするプログラム実行部6として機能させる、という構成を採る。 The computer system described above can be realized by incorporating a program into a computer. Specifically, a program according to another aspect of the present invention is common to the external storage device 2 that stores a plurality of files 1 including read-only data that is commonly used by one or more programs, and the one or more programs. A computer composed of a main storage device 4 including the shared memory unit 3 used for the above, and an external storage device 2 and a data processing device 5 connected to the main storage device 4 is placed in the same memory block of the shared memory unit 3. A configuration is adopted in which the program execution unit 6 loads the read-only data of the plurality of files 1.
 以上、上記各実施形態を参照して本発明を説明したが、本発明は、上述した実施形態に限定されるものではない。本発明の構成や詳細には、本発明の範囲内で当業者が理解しうる様々な変更をすることができる。 Although the present invention has been described with reference to the above embodiments, the present invention is not limited to the above-described embodiments. Various changes that can be understood by those skilled in the art can be made to the configuration and details of the present invention within the scope of the present invention.
 なお、本発明は、日本国にて2009年3月31日に特許出願された特願2009-84860の特許出願に基づく優先権主張の利益を享受するものであり、当該特許出願に記載された内容は、全て本明細書に含まれるものとする。 The present invention enjoys the benefit of the priority claim based on the patent application of Japanese Patent Application No. 2009-84860 filed on March 31, 2009 in Japan, and is described in the patent application. The contents are all included in this specification.
 本発明によれば、メモリの内部フラグメンテーションが小さいシステムを実現する計算機システムといった用途に適用できる。 According to the present invention, the present invention can be applied to uses such as a computer system that realizes a system with small internal fragmentation of memory.
100…計算機システム
110…主記憶装置
 111…共有メモリ部
120…外部記憶装置
 121…ファイルシステム部
  1211…共有ライブラリ
130…データ処理装置
 131…共有メモリ管理部
 132…共有メモリ管理テーブル部
 133…プログラム実行部
 134…共有ライブラリ管理テーブル部
 135…プログラム対応のマッピングテーブル部
 136…マッピングアドレス決定部
DESCRIPTION OF SYMBOLS 100 ... Computer system 110 ... Main memory 111 ... Shared memory part 120 ... External memory device 121 ... File system part 1211 ... Shared library 130 ... Data processing device 131 ... Shared memory management part 132 ... Shared memory management table part 133 ... Program execution Unit 134 ... shared library management table unit 135 ... mapping table unit corresponding to program 136 ... mapping address determination unit

Claims (11)

  1.  1以上のプログラムにより共通に利用される読み込み専用データを含むファイルを複数記憶する外部記憶装置と、前記1以上のプログラムで共通に利用される共有メモリ部を含む主記憶装置と、前記外部記憶装置および前記主記憶装置に接続されたデータ処理装置とから構成される計算機システムにおいて、
     前記共有メモリ部の同じメモリブロックに複数の前記ファイルの読み込み専用データをロードするプログラム実行部を備えることを特徴とする計算機システム。
    An external storage device that stores a plurality of files including read-only data that is commonly used by one or more programs, a main storage device that includes a shared memory unit that is commonly used by the one or more programs, and the external storage device And a computer system comprising a data processing device connected to the main storage device,
    A computer system comprising a program execution unit that loads read-only data of a plurality of the files into the same memory block of the shared memory unit.
  2.  前記プログラム実行部は、前記ファイルの読み込み専用データをロードする先頭の物理アドレスが、所定サイズで定まるアドレス境界に一致するように、前記ファイルの読み込み専用データを前記共有メモリ部のメモリブロックにロードすることを特徴とする請求項1に記載の計算機システム。 The program execution unit loads the read-only data of the file into the memory block of the shared memory unit so that a leading physical address for loading the read-only data of the file matches an address boundary determined by a predetermined size. The computer system according to claim 1.
  3.  前記所定サイズとして、記憶空間の管理単位であるブロックのサイズの最小値を用いることを特徴とする請求項2に記載の計算機システム。 3. The computer system according to claim 2, wherein a minimum value of a block size which is a storage space management unit is used as the predetermined size.
  4.  記憶空間の管理単位であるブロックのサイズが可変になっており、ブロックのサイズの最小値をSとするとき、それ以外で可変なブロックのサイズがSの2n(nは正の整数)倍になっていることを特徴とする請求項3に記載の計算機システム。 The size of a block, which is a management unit of storage space, is variable, and when the minimum value of the block size is S, the size of the variable block other than that is 2 n (n is a positive integer) times The computer system according to claim 3, wherein:
  5.  前記プログラム実行部は、或るプログラムで利用するファイルの読み込み専用データを前記共有メモリ部のメモリブロックに新たにロードする際、そのプログラムが利用しないファイルの読み込み専用データが既にロードされているメモリブロックであっても、空き領域がある限り、ロード先のメモリブロックとして選択することを特徴とする請求項2乃至4の何れか1項に記載の計算機システム。 When the program execution unit newly loads read-only data of a file used by a certain program into the memory block of the shared memory unit, a memory block in which read-only data of a file not used by the program is already loaded However, the computer system according to any one of claims 2 to 4, wherein, as long as there is a free area, the memory block is selected as a load destination memory block.
  6.  前記共有メモリ部のメモリブロックの空き状況を管理する共有メモリ管理テーブル部と、
     前記共有メモリ部のメモリブロックに、ファイルの読み込み専用データをロードしたとき、前記所定サイズをS、ロードしたファイルの読み込み専用データのサイズをL、小数点以下を切り上げる関数をfupとするとき、前記共有メモリ管理テーブル部で管理する当該メモリブロックの空きサイズを、S×fup(L/S)だけ減算する共有メモリ管理部とを備えることを特徴とする請求項2乃至5の何れか1項に記載の計算機システム。
    A shared memory management table unit for managing the availability of memory blocks in the shared memory unit;
    When the read-only data of the file is loaded into the memory block of the shared memory unit, the predetermined size is S, the size of the read-only data of the loaded file is L, and the function that rounds up the decimal point is f up , 6. The shared memory management unit that subtracts the free size of the memory block managed by the shared memory management table unit by S × f up (L / S). The computer system described in 1.
  7.  前記ファイルの読み込み専用データが共有ライブラリのテキスト領域であることを特徴とする請求項1乃至6の何れか1項に記載の計算機システム。 The computer system according to any one of claims 1 to 6, wherein the read-only data of the file is a text area of a shared library.
  8.  前記ファイルが読み込み専用データファイルであることを特徴とする請求項1乃至6の何れか1項に記載の計算機システム。 The computer system according to any one of claims 1 to 6, wherein the file is a read-only data file.
  9.  1以上のプログラムにより共通に利用される読み込み専用データを含むファイルを複数記憶する外部記憶装置と、前記1以上のプログラムで共通に利用される共有メモリ部を含む主記憶装置と、前記外部記憶装置および前記主記憶装置に接続されたデータ処理装置とから構成される計算機システムにおける読み込み専用データ管理方法であって、
     前記共有メモリ部のメモリブロックに前記ファイルの読み込み専用データをロードするステップと、
     前記メモリブロックに空き領域がある場合に、他のファイルの読み込み専用データを前記メモリブロックにロードするステップと、
    を含むことを特徴とする読み込み専用データ管理方法。
    An external storage device that stores a plurality of files including read-only data that is commonly used by one or more programs, a main storage device that includes a shared memory unit that is commonly used by the one or more programs, and the external storage device And a read-only data management method in a computer system comprising a data processing device connected to the main storage device,
    Loading the file read-only data into the memory block of the shared memory unit;
    Loading the memory block with read-only data of another file if the memory block has free space; and
    A read-only data management method comprising:
  10.  前記ファイルの読み込み専用データをロードする先頭の物理アドレスが、所定サイズで定まるアドレス境界に一致するように、前記ファイルの読み込み専用データを前記共有メモリ部のメモリブロックにロードする
    ことを特徴とする請求項9に記載の計算機システム。
    The read-only data of the file is loaded into the memory block of the shared memory unit so that a leading physical address for loading the read-only data of the file matches an address boundary determined by a predetermined size. Item 10. The computer system according to Item 9.
  11.  1以上のプログラムにより共通に利用される読み込み専用データを含むファイルを複数記憶する外部記憶装置と、前記1以上のプログラムで共通に利用される共有メモリ部を含む主記憶装置と、前記外部記憶装置および前記主記憶装置に接続されたデータ処理装置とから構成されるコンピュータを、前記共有メモリ部の同じメモリブロックに複数の前記ファイルの読み込み専用データをロードするプログラム実行部として機能させるためのプログラム。 An external storage device that stores a plurality of files including read-only data that is commonly used by one or more programs, a main storage device that includes a shared memory unit that is commonly used by the one or more programs, and the external storage device And a program configured to cause a computer including a data processing device connected to the main storage device to function as a program execution unit that loads a plurality of read-only data of the files into the same memory block of the shared memory unit.
PCT/JP2010/000804 2009-03-31 2010-02-10 Calculator system WO2010113380A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
JP2009-084860 2009-03-31
JP2009084860 2009-03-31

Publications (1)

Publication Number Publication Date
WO2010113380A1 true WO2010113380A1 (en) 2010-10-07

Family

ID=42827698

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/JP2010/000804 WO2010113380A1 (en) 2009-03-31 2010-02-10 Calculator system

Country Status (1)

Country Link
WO (1) WO2010113380A1 (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0619717A (en) * 1992-06-30 1994-01-28 Juki Corp Information processor
JPH06332675A (en) * 1993-05-20 1994-12-02 Mitsubishi Electric Corp Shared library management mechanism
JP2008033838A (en) * 2006-07-31 2008-02-14 Sanyo Electric Co Ltd Memory management device and memory management method

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0619717A (en) * 1992-06-30 1994-01-28 Juki Corp Information processor
JPH06332675A (en) * 1993-05-20 1994-12-02 Mitsubishi Electric Corp Shared library management mechanism
JP2008033838A (en) * 2006-07-31 2008-02-14 Sanyo Electric Co Ltd Memory management device and memory management method

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
CARY A. COUTANT ET AL.: "HP-UX Kyoyu Library", UNIX MAGAZINE, vol. 9, no. 4, 1 April 1994 (1994-04-01), pages 129 - 139 *

Similar Documents

Publication Publication Date Title
US20230259452A1 (en) Computing system and method for controlling storage device
JP5255348B2 (en) Memory allocation for crash dump
JP4815346B2 (en) Method for accessing data on a computer device
JP6460497B2 (en) File access method, file access device, and storage device
KR102061079B1 (en) File accessing method and related device
US8176142B2 (en) Shared JAVA jar files
JP5422652B2 (en) Avoiding self-eviction due to dynamic memory allocation in flash memory storage
US10824555B2 (en) Method and system for flash-aware heap memory management wherein responsive to a page fault, mapping a physical page (of a logical segment) that was previously reserved in response to another page fault for another page in the first logical segment
JP2023000085A (en) Memory system and information processing system
US20150220452A1 (en) System, Method and Computer-Readable Medium for Dynamically Mapping a Non-Volatile Memory Store
CN110928803B (en) Memory management method and device
CN116302491A (en) Memory management method, device, computer equipment and storage medium
JPH07152641A (en) Program cache device
US8185693B2 (en) Cache-line aware collection for runtime environments
JP2011186561A (en) Memory management device
CN115712500A (en) Memory release method, memory recovery method, memory release device, memory recovery device, computer equipment and storage medium
WO2024108939A1 (en) Multi-level mapping framework and data operation request processing method and system
EP3690660B1 (en) Cache address mapping method and related device
CN116225693A (en) Metadata management method, device, computer equipment and storage medium
CN113535392B (en) Memory management method and system for realizing support of large memory continuous allocation based on CMA
US20090031100A1 (en) Memory reallocation in a computing environment
WO2010113380A1 (en) Calculator system
JP5891963B2 (en) Address management apparatus and program
JP4792065B2 (en) Data storage method
JP5196249B2 (en) Memory system, method and program for using cache memory

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 10758166

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 10758166

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: JP