Abstract:
A memory allocation system includes a unit for storing the information about the amount of memory required at the time of initializing each executable program in the control information of the file storing the program. The amount required is determined when the program is translated, assembled or compiled and linked. The memory allocation system also includes a unit for reading the information, indicating the amount of memory required at the time of initializing the program stored in the control information of the file, when loading of program is requested. Also included are a unit statically allocates memory commensurate with the amount of memory required at initialization and a unit for dynamically allocating memory when the previously allocated memory is insufficient for executing the program.

Description:
BACKGROUND OF THE INVENTION 
     1. Field of the Invention 
     This invention pertains to a system for statically allocating a memory for use in a computer system capable of efficiently allocating a memory necessary for executing FORTRAN programs, etc. 
     A super computer for high speed program execution using pipeline processing or parallel processing requires that a program and the entire data referred to by the program be stored in its memory during the program execution. An efficient memory allocation technique is therefore sought. 
     2. Description of the Related Art 
     When a user program for scientific or technological calculations is run, if the memory for storing the program and the necessary data are deficient, it is necessary to interrupt the operation of other programs being executed to make additional memory available by swapping out the interrupted program onto an external memory device. 
     However, the volume of data handled by a super computer is generally huge and an overhead caused by the swapping is more severe than that caused by such swapping in a general-purpose computer. Also, since a super computer is expected to provide high speed performance, the overhead caused by the swapping must be avoided in every way possible. 
     A static memory allocation method is effective in preventing the overhead caused by such swapping, whereby the maximum memory volume deemed necessary for executing a program to be run is allocated in advance and the memory is kept allocated until the program execution is ended. 
     Since this method allows programs to be executed with the necessary memory already allocated beforehand, no memory deficiency occurs while the programs are being executed, and the overhead produced by swapping can be avoided. However, since the memory is kept allocated, the memory usage efficiencies are lowered. 
     On the other hand, a dynamic memory allocation method is defined as a method whereby requested memory is allocated only when a memory request is made, thus generally creating no idle portions of memory. Yet, since overhead produced by swapping cannot be avoided when multiple programs are run concurrently, it is not effective to apply this method to a super computer system. 
     FIG. 1 shows an example of the prior art for static memory allocation. 
     Generally, a user specifies the memory volume kept allocated by job control statements 21 using a conventional static memory allocation method. 
     The following is a description of a memory allocation method of the prior art by referring to the steps [1] through [6] shown in FIG. 1. 
     1 A job management section 22 interprets the specification on the volume of memory allocation described in the job control statement 21. 
     2 The job management section 22 notifies a memory management section 15 of the interpreted volume of memory allocation. 
     3 The memory management section 15 allocates the specified volume of memory 23. 
     4 The memory management section 15 notifies the job management section 22 of the completion of allocating the memory 23. 
     5 The job management section 22 calls up a loader 14 when the environment for executing the job is complete. 
     6 The loader 14 loads an executable program 13 into the memory 23. 
     After the loading, the program is initialized and the program execution begins. 
     A user needs to precisely estimate the memory volume necessary for program execution for an efficient memory allocation, when he utilizes the conventional static memory allocation method. 
     However, it is difficult to correctly estimate the memory volume necessary for the program execution. Because the precise estimation is difficult, in order to avoid abnormally terminating a program execution because of a memory deficiency, the user often specifies a memory volume larger than necessary. Therefore, less of the memory allocated for the program is actually used and the memory usage efficiency tends to be lowered. 
     FIG. 2 shows an example of a time series change in the memory volume allocated for a program using the conventional static memory allocation. 
     In FIG. 2, the part with slashes indicates the actually used memory volume. However, the memory volume specified by a user is kept allocated to the program from where the program execution is requested until the program execution is completed irrespective of the actually used volume. This causes an increase in the volume of idle memory, which could have been allocated for other programs running concurrently, resulting in a decrease in the number of jobs which can be executed simultaneously. 
     SUMMARY OF THE INVENTION 
     This invention aims at reducing the users&#39; workloads where estimating the memory volume necessary for program execution and preventing memory wastage by unnecessary memory allocation. 
     This invention pertains to a system for statically allocating a memory for use in a computer system capable of efficiently allocating a memory necessary for executing FORTRAN programs, etc. 
     This invention configures a system made up of a unit for storing information on a memory volume necessary for initializing an execution format program in the management information section of the file for storing the program by obtaining the necessary memory volume when the program is translated, assembled or compiled, a unit for reading the information about the memory volume required at the time of initializing the program stored in the management information section of the file, when the execution format program is loaded, a unit for statically allocating a memory commensurate with the read memory volume; and a unit for dynamically allocating a memory, when the memory is deficient for the program execution. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     FIG. 1 is a block diagram of an example of the prior art for static memory allocation; 
     FIG. 2 is a diagram of an exemplary state of memory allocation according to the prior art; 
     FIG. 3 is a block diagram of a principle of this invention; 
     FIG. 4 is a block diagram of an embodiment of the present invention; 
     FIG. 5 is a diagram of an exemplary state of memory allocation in the embodiment of this invention; 
     FIG. 6 is a flowchart illustrating the operation of a linkage editor; 
     FIG. 7 is a flowchart illustrating the operation of a loader; and 
     FIGS. 8A and 8B are flowcharts illustrating the operation of a program executor. 
    
    
     DESCRIPTION OF THE PREFERRED EMBODIMENT 
     FIG. 3 is a block diagram designating a principle of the present invention. 
     In FIG. 3, 10 is an object program previously translated from a source program into a machine language command level, 11 is an linkage editor for creating an executable program by compiling and linking a program, 12 is a management information section for storing management information on an executable program, 13 is an executable program, 14 is a loader for loading an executable program into a memory, 15 is a memory management section for allocating a memory in response to a memory allocation request by controlling an actual memory not being used, and 16 is a program executor for executing an executable program. 
     This invention assumes that the information management section 12 of a file storing the executable program 13 has storage spaces for the amount of memory required at a program initialization. 
     In a processing step P1, while a compiler and the linkage editor 11 translates, assembles or and links a program, the management information section 12 stores the information about an amount of memory necessary for initializing the program, which takes account of the amount of memory to be used by the program. 
     In a processing step P2, the loader 14 reads the information on the amount of memory necessary for initializing the program stored in the management information section 12 and notifies the memory management section 15 of the amount of memory, when it loads the executable program 13. 
     In a processing step P3, the memory management section 15 statically allocates the memory according to the notified memory amount. 
     In a processing step P4, if the program executor 16 encounters a memory deficiency while it executes a program, the program executor 16 requests the memory management section 15 to allocate the deficiency in memory and the memory management section 15 dynamically allocates the requested memory. 
     A feature of this invention resides in a combined use of a static memory allocation based on program information notified from a compiler and a linkage editor and a dynamic memory allocation when the statically allocated memory is deficient, which eliminates the need for having a user specify the amount of memory to be used. To be specific, the memory allocated is defined here as a memory space, where an actual memory corresponds on a one-to-one basis with a virtual memory. 
     In other words, the prior art requires that a user specifies the amount of memory to be allocated by a job control statement, and a job management section requests the memory management section 15 to allocate memory, when the job management section receives a request for executing a program. 
     On the other hand, this invention enables the loader 14 to request an allocation of a necessary amount of memory to the memory management section 15 immediately before it loads a program, based on the program information stored in the management information section 12. 
     If the amount of allocated memory turns out to be deficient during a program execution, the prior art method of statically allocating a memory only causes an abnormal termination of the program execution, but the method of this invention prevents such an abnormal termination, because it also allocates memory dynamically. 
     There is a risk that the dynamic memory allocation causes overhead due to a swapping. But for the following reasons, memory deficiency during program execution is considered rare, and an overhead due to a swapping is not much of a problem. 
     (a) Most programs a super computer system runs are written in FORTRAN. 
     (b) FORTRAN programs have little change in memory usage after their initialization is completed. 
     For the above reasons (a) and (b), few programs a super computer runs substantially change their memory usage. Therefore, the additional use of dynamic memory allocation seldom causes an overhead because of memory competition. 
     FIG. 4 is an exemplary block diagram of an embodiment of this invention. FIG. 5 is a diagram of an exemplary state of memory allocation in the embodiment of this invention. 
     The actions of the static memory allocation according to an embodiment of this invention are explained by referring to [1] through [8] shown in FIG. 4. 
     1 A compiler 20 and the linkage editor 11 determine the amount of memory necessary for initializing a program and stores the amount in the management information section 12 before a translation, an assembly or a compilation. 
     2 The job control statements 22 requests a program execution by the job management section 22. The job control statements 21 do not have to specify the amount of memory allocated. 
     3 The job management section 22 interprets the job control statements 21 and sets up an environment for program execution except for the memory allocation. After the execution environment is complete, the job management section 22 requests loading by the loader 4. 
     4 The loader 14 reads the information on the amount of memory required at program initialization written in the management information section 12 of the file for the executable program 13. 
     5 The loader 14 notifies the memory management section 15 of the information on the read memory volume. 
     6 The memory management section 15 allocates the memory according to the necessary amount of memory based on the notification from the loader 14. 
     7 The memory management section 15 notifies the loader 14 of the completion of the memory allocation. 
     8 The loader 14 reads the executable program 13 and loads it into the allocated memory. 
     As described above, memory is allocated immediately before the loading of the programs, which are then initialized and their executions begin. 
     FIG. 5 shows an exemplary time series change of the amount of memory allocated for a program. 
     The job management section 22 does not allocate memory, when program execution is requested. Instead, it allocates memory in a batch according to the amount of memory required at program initialization, when the program is loaded. The reference character &#34;a&#34; shown in FIG. 5 indicates the size of the loaded executable program. 
     Upon program initialization, the necessary memory space is in a state of being used. The reference character &#34;b&#34; shown in FIG. 5 corresponds to the size of the data space. 
     After the program execution starts, if a memory is deficient, an additional memory is dynamically allocated. However, cases requiring a swapping operation in a dynamic memory allocation are rare. 
     FIG. 6 is a flowchart illustrating the operation of a linkage editor. 
     After the linkage editor begins its processes, it creates an executable program from an object program. Then, it calculates the amount of memory required at program initialization. Finally, it stores the size of the executable program as the amount of memory required at program initialization in the file management information section of the executable program, before it ends its processes. 
     FIG. 7 is a flowchart illustrating the operation of a loader. 
     After the loader begins its processes, it reads the file&#39;s management information section of the executable program. Next, it notifies the memory management section of the amount of memory required at program initialization in the information read from the file&#39;s management information section. Then, it waits for the notification from the memory management section regarding the completion of the memory acquisition. Finally, it loads the execution format program, before it ends its processes. 
     FIGS. 8A shows a flowchart illustrating the operation of a program executor. 
     After the program executor begins its processes, it initializes a program and starts executing the program. If the amount of memory is insufficient while it executes the program, it interrupts the program execution, notifies the memory management section of the insufficient memory, waits for the notification from the memory management section regarding the completion of the memory acquisition, and resumes executing the program. Unless the memory is insufficient, it continues the program execution. When the program execution is completed, it requests the memory management section to release the memory, before it ends its processes. 
     More specifically, the memory deficiency is diagnosed by program error detection as shown in FIG. 8B, and the amount of memory to be re-allocated is calculated from the amount of memory required at the occurrence of an error. Namely, the amount of memory acquired is obtained as the difference between the previously requested amount of memory and the amount of memory required. 
     As described above this invention does not require that a user precisely estimate the memory volume necessary for program execution. Since memory is not occupied more than necessary, it is used efficiently, and its throughput is increased. Since the overhead does not increase, the high speed performance, which is a feature of a super computer system, is not hindered. Since the memory is allocated immediately before a program is loaded, rather than when the program execution is requested, the time period during which memory is allocated becomes shorter.