JP6103972B2 - Program generation method, program execution method, program execution device, and program execution program - Google Patents

Program generation method, program execution method, program execution device, and program execution program Download PDF

Info

Publication number
JP6103972B2
JP6103972B2 JP2013027249A JP2013027249A JP6103972B2 JP 6103972 B2 JP6103972 B2 JP 6103972B2 JP 2013027249 A JP2013027249 A JP 2013027249A JP 2013027249 A JP2013027249 A JP 2013027249A JP 6103972 B2 JP6103972 B2 JP 6103972B2
Authority
JP
Japan
Prior art keywords
program
execution
text
virtual space
area
Prior art date
Legal status (The legal status 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 status listed.)
Expired - Fee Related
Application number
JP2013027249A
Other languages
Japanese (ja)
Other versions
JP2014157434A (en
Inventor
坂倉 隆史
隆史 坂倉
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Mitsubishi Electric Corp
Original Assignee
Mitsubishi Electric Corp
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 Mitsubishi Electric Corp filed Critical Mitsubishi Electric Corp
Priority to JP2013027249A priority Critical patent/JP6103972B2/en
Publication of JP2014157434A publication Critical patent/JP2014157434A/en
Application granted granted Critical
Publication of JP6103972B2 publication Critical patent/JP6103972B2/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Description

本発明は、例えば、プログラムの起動時間を短くするためのプログラム生成方法、プログラム実行方法、プログラム生成装置、プログラム生成プログラム、プログラム実行装置およびプログラム実行プログラムに関するものである。   The present invention relates to, for example, a program generation method, a program execution method, a program generation device, a program generation program, a program execution device, and a program execution program for shortening the startup time of a program.

CPU(Central Processing Unit)およびDRAM(Dynamic Random Access Memory)の急速な高性能化および大容量化に伴い、アプリケーションプログラムは、高機能になる一方で肥大化の一途を辿っている。特に、グラフィカルなユーザーインターフェース(GUI)を有するアプリケーションプログラムは、C++などの高級言語で記載され、総開発ステップ数が100万行を超えるものも珍しくない。   Along with the rapid increase in performance and capacity of CPUs (Central Processing Units) and DRAMs (Dynamic Random Access Memories), application programs have become more and more bloated while becoming more functional. In particular, an application program having a graphical user interface (GUI) is written in a high-level language such as C ++, and the total number of development steps exceeds 1 million lines is not uncommon.

しかし、プログラムが巨大化すると、高速化したCPUおよびDRAMに比して処理遅延が依存として大きいファイルシステムを介するディスクI/Oがプログラムの起動時に多大な回数必要になる。一度立ち上がってしまえば、その操作性に問題はないが、プログラムの起動時間に対してユーザーの不満が募っていた。   However, when the program becomes large, disk I / O through a file system that requires a large processing delay as a dependency on the high-speed CPU and DRAM is required many times when the program is started. Once launched, there was no problem with its operability, but users were frustrated with the startup time of the program.

そこで、ハードディスクに比べてI/O性能が格段に高いNAND型フラッシュメモリを使用する方法も考えられる。
しかし、フラッシュメモリはハードディスクに比べて依然として高価である。また、フラッシュメモリは、CMOS化(CMOS:Complementary Metal Oxide Semiconductor)において64キロバイトブロックでのデータ消去を必要とし、一つのブロックに対して10万回程度のデータの書き込みまたは消去を行うとビット情報を表す電荷膜の劣化によって使用できなくなることがある。
このため、ハードディスクの代わりにフラッシュメモリを使用した場合、アプリケーションの起動時間は大幅に短縮されるが、システムを構築するための選択として必ずしも良い選択にならない場合がある。
Therefore, a method of using a NAND flash memory that has remarkably higher I / O performance than a hard disk may be considered.
However, flash memory is still more expensive than hard disks. In addition, flash memory requires data erasure in 64 kilobyte blocks in CMOS (CMOS: Complementary Metal Oxide Semiconductor), and if bit data is written or erased about 100,000 times in one block, bit information is stored. It may become unusable due to deterioration of the charge film.
For this reason, when a flash memory is used instead of a hard disk, the startup time of an application is greatly shortened, but it may not always be a good choice for building a system.

特許文献1または特許文献2には、アクセス例外が発生したときの例外発生ブロックが共有ライブラリの実行関数部分だった場合、共有ライブラリのファイルから実行関数部分を物理ブロックに読み出すとの記載がある。   Patent Document 1 or Patent Document 2 describes that when an exception occurrence block when an access exception occurs is an execution function portion of a shared library, the execution function portion is read from a file of the shared library into a physical block.

また、特許文献1には、ネットワークを経由してOS(Operating System)及びプログラムを主記憶装置に読み出すとの記載がある。   Japanese Patent Application Laid-Open No. 2004-228561 describes that an OS (Operating System) and a program are read out to a main storage device via a network.

また、利用機会が少ないと思われる共有ライブラリを遅延してロードするという工夫が常套的に行われている。   In addition, there is a common practice of delaying and loading a shared library that seems to have few opportunities for use.

特開2010−257173号公報JP 2010-257173 A 特開平6−250924号公報JP-A-6-250924

本発明は、例えば、起動に要する時間が短いプログラムを生成できるようにすることを目的とする。   An object of the present invention is, for example, to be able to generate a program having a short time required for activation.

本発明のプログラム生成方法は、
プログラム生成部が、プログラムの実行が開始される前に仮想空間にマッピングするプログラムコードとしてメイン関数を含む一部のプログラムコードを含み、前記プログラムの実行が開始される前に仮想空間にマッピングするデータとして前記一部のプログラムコードを除いた残りのプログラムコードが記憶される補助記憶装置内の記憶領域を特定するための記憶領域情報を含み、前記プログラムの実行が開始される前に仮想空間にマッピングしないデータとして前記残りのプログラムコードを含むファイルを前記プログラムとして生成する。
The program generation method of the present invention includes:
Data including a part of program code including a main function as a program code to be mapped to the virtual space before the program execution is started, and mapped to the virtual space before the execution of the program is started Including storage area information for specifying a storage area in the auxiliary storage device in which the remaining program codes excluding the part of the program codes are stored, and mapped to the virtual space before the execution of the program is started A file including the remaining program code as data not to be generated is generated as the program.

本発明によれば、例えば、起動に要する時間が短いプログラムを生成することができる。   According to the present invention, for example, it is possible to generate a program that takes a short time to start.

実施の形態1における計算機システム100のハードウェア構成の一例を示す図である。2 is a diagram illustrating an example of a hardware configuration of a computer system 100 according to Embodiment 1. FIG. 実施の形態1における計算機システム100のソフトウェア構成の一例を示す図である。2 is a diagram illustrating an example of a software configuration of a computer system 100 according to Embodiment 1. FIG. 実施の形態1における実行プログラム120の構成例を示す図である。FIG. 3 is a diagram illustrating a configuration example of an execution program 120 in the first embodiment. 実施の形態1における対応表122の一例を示す図である。6 is a diagram illustrating an example of a correspondence table 122 according to Embodiment 1. FIG. 実施の形態1における実行プログラム120のプロセス空間130の一例を示す図である。3 is a diagram showing an example of a process space 130 of an execution program 120 in the first embodiment. FIG. 実施の形態1における実行プログラム120の実行時のページ割り付け方法を示す概要図である。FIG. 3 is a schematic diagram showing a page allocation method during execution of an execution program 120 in the first embodiment. 実施の形態1における実行プログラム120の実行時のページ割り付け方法を示す概要図である。FIG. 3 is a schematic diagram showing a page allocation method during execution of an execution program 120 in the first embodiment. 実施の形態1における計算機システム100の機能構成図である。2 is a functional configuration diagram of a computer system 100 according to Embodiment 1. FIG. 実施の形態1におけるプログラム実行処理を示すフローチャートである。3 is a flowchart showing a program execution process in the first embodiment. 従来におけるプログラム実行時のページ割り付け方法の概要を示す図である。It is a figure which shows the outline | summary of the page allocation method at the time of the program execution in the past. 実施の形態4におけるプロセス空間を示す図である。FIG. 10 shows a process space in the fourth embodiment. 実施の形態9における第一の実行プログラム120Aおよび第二の実行プログラム120Bを示す図である。It is a figure which shows the 1st execution program 120A in Embodiment 9, and the 2nd execution program 120B. 実施の形態9における第一のプロセス空間130Aと第二のプロセス空間130Bとを示す図である。It is a figure which shows 1st process space 130A and 2nd process space 130B in Embodiment 9. FIG.

実施の形態1.
起動に要する時間が短いプログラムを生成し、プログラムを早く起動できるようにする形態について説明する。
Embodiment 1 FIG.
A description will be given of a mode in which a program having a short startup time is generated so that the program can be started quickly.

図1は、実施の形態1における計算機システム100のハードウェア構成の一例を示す図である。
実施の形態1における計算機システム100のハードウェア構成の一例について、図1に基づいて説明する。
FIG. 1 is a diagram illustrating an example of a hardware configuration of a computer system 100 according to the first embodiment.
An example of the hardware configuration of the computer system 100 according to the first embodiment will be described with reference to FIG.

計算機システム100は、CPU101と、DRAM103と、ディスクコントローラ104と、ハードディスク105と、ネットワークコントローラ106とを備える。
CPU101は、バス108を介してDRAM103、ディスクコントローラ104およびネットワークコントローラ106と接続し、これらのハードウェアを制御する。
CPU101は、仮想メモリの仮想アドレスと物理メモリ(DRAM103)の物理アドレスとを相互に変換するメモリ管理ユニット(MMU102)を備える。
DRAM103は、プログラムを実行するための記憶領域として使用される主記憶装置(メモリ、物理メモリ、メインメモリともいう)である。
ハードディスク105は、プログラムまたはプログラムで使用するデータなどを記憶するための補助記憶装置である。
ディスクコントローラ104は、ハードディスク105を制御する装置である。
ネットワークコントローラ106は、ネットワーク107に接続するための装置である。
The computer system 100 includes a CPU 101, a DRAM 103, a disk controller 104, a hard disk 105, and a network controller 106.
The CPU 101 is connected to the DRAM 103, the disk controller 104, and the network controller 106 via the bus 108, and controls these hardware.
The CPU 101 includes a memory management unit (MMU 102) that mutually converts a virtual address of the virtual memory and a physical address of the physical memory (DRAM 103).
The DRAM 103 is a main storage device (also referred to as a memory, a physical memory, or a main memory) used as a storage area for executing a program.
The hard disk 105 is an auxiliary storage device for storing a program or data used in the program.
The disk controller 104 is a device that controls the hard disk 105.
The network controller 106 is a device for connecting to the network 107.

CPU101はCentral Processing Unitの略であり、DRAM103はDynamic Random Access Memoryの略である。   CPU 101 is an abbreviation for Central Processing Unit, and DRAM 103 is an abbreviation for Dynamic Random Access Memory.

但し、計算機システム100のハードウェア構成は、図1に示した構成以外の構成であっても構わない。   However, the hardware configuration of the computer system 100 may be a configuration other than the configuration shown in FIG.

図2は、実施の形態1における計算機システム100のソフトウェア構成の一例を示す図である。
実施の形態1における計算機システム100のソフトウェア構成の一例について、図2に基づいて説明する。
FIG. 2 is a diagram illustrating an example of a software configuration of the computer system 100 according to the first embodiment.
An example of the software configuration of the computer system 100 according to the first embodiment will be described with reference to FIG.

計算機システム100は、OS111と、コンパイラ113と、リンカ114と、プログラムソース115と、スタティックライブラリソース116と、共有ライブラリソース117と、実行プログラム120とを備える。
OS111は、実行プログラム120などのソフトウェアに対して計算機システム100の機能を提供するオペレーティングシステムである。
OS111は、実行プログラム120をハードディスク105またはネットワークから物理メモリにロードするプログラムローダー112を備える。
The computer system 100 includes an OS 111, a compiler 113, a linker 114, a program source 115, a static library source 116, a shared library source 117, and an execution program 120.
The OS 111 is an operating system that provides the functions of the computer system 100 to software such as the execution program 120.
The OS 111 includes a program loader 112 that loads the execution program 120 into the physical memory from the hard disk 105 or the network.

プログラムソース115は、実行プログラム120のソースコードである。
スタティックライブラリソース116は、スタティックライブラリ(例えば、標準ライブラリ)のソースコードである。
共有ライブラリソース117は、共有ライブラリのソースコードである。
The program source 115 is a source code of the execution program 120.
The static library source 116 is source code of a static library (for example, a standard library).
The shared library source 117 is a source code of the shared library.

コンパイラ113は、プログラムソース115と、スタティックライブラリソース116と、共有ライブラリソース117とをコンパイルするためのプログラムである。
以下、コンパイルされたプログラムソース115を「オブジェクトプログラム」という。
また、コンパイルされたスタティックライブラリソース116を「スタティックライブラリ」といい、コンパイルされた共有ライブラリソース117を「共有ライブラリ」という。
The compiler 113 is a program for compiling the program source 115, the static library source 116, and the shared library source 117.
Hereinafter, the compiled program source 115 is referred to as an “object program”.
The compiled static library source 116 is called “static library”, and the compiled shared library source 117 is called “shared library”.

リンカ114は、オブジェクトプログラムと、スタティックライブラリと、共有ライブラリとを結合して実行プログラム120を生成するためのプログラムである。   The linker 114 is a program for generating an execution program 120 by combining an object program, a static library, and a shared library.

実行プログラム120は、CPU101によって実行される実行形式のプログラムである。   The execution program 120 is an execution format program executed by the CPU 101.

図3は、実施の形態1における実行プログラム120の構成例を示す図である。
実施の形態1における実行プログラム120の構成例について、図3に基づいて説明する。
FIG. 3 is a diagram illustrating a configuration example of the execution program 120 in the first embodiment.
A configuration example of the execution program 120 in the first embodiment will be described with reference to FIG.

実行プログラム120は、エントリポイントテキスト121と、対応表122と、プログラムデータ123と、プログラムテキスト124とを備える。   The execution program 120 includes an entry point text 121, a correspondence table 122, program data 123, and a program text 124.

エントリポイントテキスト121は、実行プログラム120のテキスト(プログラムコード、命令文、関数、ルーチンまたは機械語ともいう)のうちmain()関数を含む一部のテキストである。
エントリポイントテキスト121は、main()関数の他に、スタックポインタおよびヒープポインタを書き換える書き換えロジックと、メモリアクセス例外をハンドリングするシグナルハンドラとを含む。
エントリポイントテキスト121は、プログラムコードを格納するための.textセクションに格納される。
従来の実行プログラムでは、実行プログラム120の全てのテキストが.textセクションに格納される。
The entry point text 121 is a part of text including the main () function in the text of the execution program 120 (also referred to as program code, command statement, function, routine, or machine language).
In addition to the main () function, the entry point text 121 includes rewrite logic for rewriting the stack pointer and heap pointer, and a signal handler for handling a memory access exception.
The entry point text 121 is a. Stored in the text section.
In the conventional execution program, all the texts of the execution program 120 are. Stored in the text section.

プログラムデータ123は、実行プログラム120に定義されているデータの実体である。
例えば、プログラムデータ123には、エントリポイントテキスト121に定義されているデータと、スタティックライブラリに定義されているデータとが含まれる。
The program data 123 is a data entity defined in the execution program 120.
For example, the program data 123 includes data defined in the entry point text 121 and data defined in the static library.

プログラムテキスト124は、実行プログラム120のテキストのうちエントリポイントテキスト121を除く残りのテキストの実体である。
例えば、プログラムテキスト124にはスタティックライブラリが含まれる。
The program text 124 is an entity of the remaining text excluding the entry point text 121 in the text of the execution program 120.
For example, the program text 124 includes a static library.

プログラムデータ123およびプログラムテキスト124は、コメントを格納するための.commentセクションに格納される。   Program data 123 and program text 124 are... For storing comments. stored in the comment section.

対応表122は、仮想メモリ(仮想空間または仮想アドレス空間ともいう)のアドレスと、実行プログラム120の.commentセクションに格納されているプログラムデータ123またはプログラムテキスト124が記憶されている記憶領域と、を対応付ける情報である。仮想メモリのアドレスを「仮想アドレス」という。
対応表122は、プログラムに定義されているデータを格納するための.dataセクションに格納される。
従来の実行プログラムでは、プログラムデータ123が.dataセクションに格納される。また、従来の実行プログラムは対応表122を備えない。
The correspondence table 122 includes the addresses of the virtual memory (also referred to as virtual space or virtual address space), the. This is information for associating the program data 123 stored in the comment section or the storage area in which the program text 124 is stored. The address of the virtual memory is called “virtual address”.
The correspondence table 122 is a table for storing data defined in the program. Stored in the data section.
In the conventional execution program, the program data 123 is. Stored in the data section. Further, the conventional execution program does not include the correspondence table 122.

図4は、実施の形態1における対応表122の一例を示す図である。
実施の形態1における対応表122について、図4に基づいて説明する。
FIG. 4 is a diagram showing an example of the correspondence table 122 in the first embodiment.
The correspondence table 122 in the first embodiment will be described with reference to FIG.

対応表122は、仮想アドレスと、実行プログラム120の.comenntセクションに格納されているプログラムデータ123またはプログラムテキスト124が記憶されている記憶領域とを対応付ける情報である。
対応表122は、「仮想アドレス」「開始オフセット」「ページ数」を対応付ける。
「仮想アドレス」は、仮想メモリの記憶領域のうちプログラムデータ123またはプログラムテキスト124がマッピングされる先頭の記憶領域を識別するアドレスを示す。
「開始オフセット」は、ハードディスク105の記憶領域のうち実行プログラム120の.commentセクションに格納されているプログラムデータ123またはプログラムテキスト124が記憶されている先頭のページを識別するページ番号を示す。
「ページ数」は、プログラムデータ123またはプログラムテキスト124が記憶されているページの数を示す。
The correspondence table 122 includes virtual addresses and. This is information for associating the program data 123 stored in the coment section or the storage area where the program text 124 is stored.
The correspondence table 122 associates “virtual address”, “start offset”, and “number of pages”.
The “virtual address” indicates an address for identifying the first storage area to which the program data 123 or the program text 124 is mapped in the storage area of the virtual memory.
The “start offset” is a value of the execution program 120 in the storage area of the hard disk 105. A page number for identifying the first page in which program data 123 or program text 124 stored in the comment section is stored is shown.
“Number of pages” indicates the number of pages in which program data 123 or program text 124 is stored.

図5は、実施の形態1における実行プログラム120のプロセス空間130の一例を示す図である。
実施の形態1における実行プログラム120のプロセス空間130について、図5に基づいて説明する。
FIG. 5 is a diagram illustrating an example of the process space 130 of the execution program 120 in the first embodiment.
The process space 130 of the execution program 120 in the first embodiment will be described with reference to FIG.

プロセス空間130は、実行プログラム120を実行するプロセス用に割り当てられた仮想空間である。
プロセス空間130は、テキスト領域131と、スタック領域132と、ヒープ領域133と、bss領域134と、データ領域135とを備える。
テキスト領域131は、エントリポイントテキスト121と、プログラムテキスト124とがマッピングされる記憶領域である。
スタック領域132は、プログラムデータ123のうち局所変数の変数値がマッピングされる記憶領域である。
ヒープ領域133は、実行プログラム120の実行中に動的に確保される記憶領域である。
bss領域134は、プログラムデータ123のうち初期値が定義されていない大域変数の変数値がマッピングされる記憶領域である。
データ領域135は、プログラムデータ123のうち初期値が定義されている大域変数の変数値がマッピングされる記憶領域である。また、データ領域135には対応表122(図4参照)がマッピングされる。
The process space 130 is a virtual space allocated for a process that executes the execution program 120.
The process space 130 includes a text area 131, a stack area 132, a heap area 133, a bss area 134, and a data area 135.
The text area 131 is a storage area to which the entry point text 121 and the program text 124 are mapped.
The stack area 132 is a storage area to which variable values of local variables in the program data 123 are mapped.
The heap area 133 is a storage area that is dynamically reserved during execution of the execution program 120.
The bss area 134 is a storage area to which variable values of global variables whose initial values are not defined in the program data 123 are mapped.
The data area 135 is a storage area to which variable values of global variables in which initial values are defined in the program data 123 are mapped. Also, the correspondence table 122 (see FIG. 4) is mapped to the data area 135.

図6、図7は、実施の形態1における実行プログラム120の実行時のページ割り付け方法を示す概要図である。
実行プログラム120にプロセス空間130をマッピングし、プロセス空間130に対して物理ページを割り付けるページ割り付け方法の概要について、図6、図7に基づいて説明する。
6 and 7 are schematic diagrams showing a page allocation method at the time of execution of the execution program 120 in the first embodiment.
An overview of a page allocation method for mapping the process space 130 to the execution program 120 and allocating a physical page to the process space 130 will be described with reference to FIGS.

実行プログラム120のプロセス空間130は複数の仮想ページで構成される。
プロセス空間130を構成する仮想ページのうち網掛けされている仮想ページは、実行プログラム120の一部がマッピングされ、物理メモリの記憶領域(物理ページ)が割り付けられた仮想ページを意味する。
プロセス空間130を構成する仮想ページのうち網掛けされていない仮想ページは、実行プログラム120がマッピングされておらず、物理ページが割り付けられていない仮想ページを意味する。
The process space 130 of the execution program 120 is composed of a plurality of virtual pages.
A virtual page shaded among the virtual pages constituting the process space 130 means a virtual page to which a part of the execution program 120 is mapped and a storage area (physical page) of physical memory is allocated.
The virtual pages that are not shaded among the virtual pages constituting the process space 130 mean virtual pages to which the execution program 120 is not mapped and physical pages are not allocated.

テキスト領域131は、3つの領域「main text」「Libc text」「hoge text」を備える。
「main text」は、テキスト領域131にマッピングされるテキスト(プログラムコード)のうち、エントリポイントテキスト121がマッピングされる領域である。
「Libc text」は、テキスト領域131にマッピングされるテキストのうち、スタティックライブラリのテキスト(プログラムテキスト124の一部)がマッピングされる領域である。
「hoge text」は、テキスト領域131にマッピングされるテキストのうち、プログラムテキスト124(スタティックライブラリを除く。例えば、共有ライブラリ)がマッピングされる領域である。
The text area 131 includes three areas “main text”, “Libc text”, and “hoge text”.
“Main text” is an area to which the entry point text 121 is mapped out of the text (program code) mapped to the text area 131.
“Libc text” is an area to which the text of the static library (part of the program text 124) is mapped among the texts mapped to the text area 131.
The “hoge text” is an area to which program text 124 (excluding a static library, for example, a shared library) is mapped among texts mapped to the text area 131.

データ領域135は、3つの領域「main data」「Libc data」「hoge data」を備える。
「main data」は、データ領域135にマッピングされるデータのうちエントリポイントテキスト121に定義されているデータがマッピングされる領域である。また、「main data」には対応表122もマッピングされる。
「Libc data」は、データ領域135にマッピングされるデータのうちスタティックライブラリに定義されているデータがマッピングされる領域である。
「hoge data」は、データ領域135の残りのデータがマッピングされる領域である。
The data area 135 includes three areas “main data”, “Libc data”, and “hoge data”.
“Main data” is an area to which data defined in the entry point text 121 among data mapped to the data area 135 is mapped. Further, the correspondence table 122 is also mapped to “main data”.
“Libc data” is an area to which data defined in the static library among data mapped to the data area 135 is mapped.
“Hoge data” is an area to which the remaining data of the data area 135 is mapped.

実行プログラム120の実行が開始される前に、プログラムローダー112は、エントリポイントテキスト121を「main text」を構成する仮想ページにマッピングする。そして、OS111の仮想記憶機能は、「main text」を構成する仮想ページに物理メモリの物理ページを割り付け、割り付けた物理ページにエントリポイントテキスト121をロードする。
また、プログラムローダー112は、対応表122を「main data」を構成する仮想ページにマッピングする。そして、OS111の仮想記憶機能は、「main data」を構成する仮想ページに物理メモリの物理ページを割り付け、割り付けた物理ページに対応表122をロードする。
プログラムローダー112は、実行プログラム120の実行が開始される前に、エントリポイントテキスト121および対応表122以外のテキストまたはデータをプロセス空間130にマッピングしない(図6参照)。
Before the execution of the execution program 120 is started, the program loader 112 maps the entry point text 121 to a virtual page that constitutes “main text”. The virtual storage function of the OS 111 allocates the physical page of the physical memory to the virtual page that constitutes “main text”, and loads the entry point text 121 to the allocated physical page.
In addition, the program loader 112 maps the correspondence table 122 to a virtual page constituting “main data”. Then, the virtual storage function of the OS 111 allocates a physical page of the physical memory to a virtual page constituting “main data”, and loads the correspondence table 122 to the allocated physical page.
The program loader 112 does not map text or data other than the entry point text 121 and the correspondence table 122 to the process space 130 before the execution of the execution program 120 is started (see FIG. 6).

エントリポイントテキスト121および対応表122以外のテキストまたはデータは、実行プログラム120の実行が開始されてアクセス命令が発生したときに、メモリアクセス例外によってプロセス空間130にマッピングされ、物理メモリにロードされる(図7参照)。   Text or data other than the entry point text 121 and the correspondence table 122 is mapped to the process space 130 by a memory access exception and loaded into the physical memory when the execution instruction 120 is started and an access instruction is generated ( (See FIG. 7).

図8は、実施の形態1における計算機システム100の機能構成図である。
実施の形態1における計算機システム100の機能構成について、図8に基づいて説明する。
FIG. 8 is a functional configuration diagram of the computer system 100 according to the first embodiment.
A functional configuration of the computer system 100 according to the first embodiment will be described with reference to FIG.

計算機システム100(プログラム実行装置の一例)は、プログラム実行部141と、コンパイル部142と、リンク部143(プログラム生成部の一例)と、OS部144(開始前マッピング部、実行中マッピングの一例)と、シグナルハンドラ部145と、デバイスドライバ部146と、プログラム記憶部149とを備える。
プログラム実行部141は、実行プログラム120を実行する。
コンパイル部142は、コンパイラ113を実行することによって、プログラムソース115と、スタティックライブラリソース116と、共有ライブラリソース117とをコンパイルする。
リンク部143は、リンカ114を実行することによって、コンパイルされたプログラムソース115(オブジェクトプログラム)と、コンパイルされたスタティックライブラリソース116(スタティックライブラリ)と、コンパイルされた共有ライブラリソース117(共有ライブラリ)とを結合して実行プログラム120を生成する。
OS部144は、OS111を実行する。例えば、OS部144は、OS111のプログラムローダー112および仮想記憶機能(ページング機構を含む)を実行する。
シグナルハンドラ部145は、実行プログラム120のmain()関数に定義されるシグナルハンドラを実行する。
デバイスドライバ部146は、ディスクコントローラ104を制御するためのデバイスドライバを実行する。
プログラム記憶部149は、ハードディスク105を用いて、プログラムソース115、スタティックライブラリソース116、共有ライブラリソース117または実行プログラム120などを記憶する。
The computer system 100 (an example of a program execution device) includes a program execution unit 141, a compilation unit 142, a link unit 143 (an example of a program generation unit), and an OS unit 144 (an example of a pre-start mapping unit and an executing mapping). A signal handler unit 145, a device driver unit 146, and a program storage unit 149.
The program execution unit 141 executes the execution program 120.
The compiling unit 142 compiles the program source 115, the static library source 116, and the shared library source 117 by executing the compiler 113.
By executing the linker 114, the link unit 143 executes a compiled program source 115 (object program), a compiled static library source 116 (static library), a compiled shared library source 117 (shared library), Are combined to generate an execution program 120.
The OS unit 144 executes the OS 111. For example, the OS unit 144 executes the program loader 112 and the virtual storage function (including the paging mechanism) of the OS 111.
The signal handler unit 145 executes a signal handler defined in the main () function of the execution program 120.
The device driver unit 146 executes a device driver for controlling the disk controller 104.
The program storage unit 149 stores the program source 115, the static library source 116, the shared library source 117, the execution program 120, and the like using the hard disk 105.

図9は、実施の形態1におけるプログラム実行処理を示すフローチャートである。
実施の形態1におけるプログラム実行処理について、図9に基づいて説明する。
FIG. 9 is a flowchart showing a program execution process in the first embodiment.
The program execution process in Embodiment 1 is demonstrated based on FIG.

ここで、コンパイル部142およびリンク部143によって、実行プログラム120(図3参照)および対応表122(図4参照)が生成されているものとする。   Here, it is assumed that the execution program 120 (see FIG. 3) and the correspondence table 122 (see FIG. 4) are generated by the compiling unit 142 and the link unit 143.

S110において、OS部144は、実行プログラム120を実行するためのプロセス空間130(図5参照)を生成する。
S110の後、処理はS120に進む。
In S110, the OS unit 144 generates a process space 130 (see FIG. 5) for executing the execution program 120.
After S110, the process proceeds to S120.

S120において、OS部144は、以下のようにエントリポイントテキスト121および対応表122をロードする。   In S120, the OS unit 144 loads the entry point text 121 and the correspondence table 122 as follows.

OS部144は、実行プログラム120の.textセクションに格納されたエントリポイントテキスト121を、プロセス空間130のテキスト領域131にある「main text」の仮想ページにマッピングする。
OS部144は、実行プログラム120の.textセクションに格納されたエントリポイントテキスト121を、プロセス空間130のテキスト領域131にある「main text」の仮想ページにマッピングする。
OS部144は、物理メモリ(DRAM103)の物理ページを「main text」の仮想ページに割り付ける(図6参照)。
そして、OS部144は、プログラム記憶部149(ハードディスク105)からエントリポイントテキスト121を読み出し、読み出したエントリポイントテキスト121を物理ページに書き込む。つまり、OS部144は、エントリポイントテキスト121を物理ページにロードする。
The OS unit 144 executes the execution program 120. The entry point text 121 stored in the text section is mapped to a virtual page of “main text” in the text area 131 of the process space 130.
The OS unit 144 executes the execution program 120. The entry point text 121 stored in the text section is mapped to a virtual page of “main text” in the text area 131 of the process space 130.
The OS unit 144 allocates a physical page of the physical memory (DRAM 103) to a virtual page of “main text” (see FIG. 6).
Then, the OS unit 144 reads the entry point text 121 from the program storage unit 149 (hard disk 105), and writes the read entry point text 121 on the physical page. That is, the OS unit 144 loads the entry point text 121 onto the physical page.

また、OS部144は、スタック領域132を指定するためのスタックポインタに「main text」の直後の仮想アドレスを設定する(図6の(1)参照)。   Further, the OS unit 144 sets a virtual address immediately after “main text” in the stack pointer for designating the stack area 132 (see (1) in FIG. 6).

さらに、OS部144は、実行するプログラムコードを指定するためのエントリポインタに、エントリポイントテキスト121に含まれる書き換えロジックの仮想アドレスを設定する。書き換えロジックが実行された後、main()関数が実行される。但し、OS部144がエントリポインタにmain()関数の仮想アドレスを設定し、main()関数から書き換えロジックが呼び出されても構わない。   Further, the OS unit 144 sets a virtual address of the rewrite logic included in the entry point text 121 as an entry pointer for designating a program code to be executed. After the rewrite logic is executed, the main () function is executed. However, the OS unit 144 may set the virtual address of the main () function in the entry pointer, and the rewrite logic may be called from the main () function.

同様に、OS部144は、実行プログラム120の.dataセクションに格納された対応表122を、プロセス空間130のデータ領域135にある「main data」の仮想ページにマッピングする。
OS部144は、物理ページを「main data」の仮想ページに割り付ける(図6参照)。
そして、OS部144は、プログラム記憶部149から物理ページに対応表122をロードする。
また、OS部144は、ヒープ領域133を指定するためのヒープポインタに「main data」の直前の仮想アドレスを設定する(図6の(2)参照)。
S120の後、処理はS130に進む。
Similarly, the OS unit 144. The correspondence table 122 stored in the data section is mapped to a virtual page of “main data” in the data area 135 of the process space 130.
The OS unit 144 allocates a physical page to a virtual page of “main data” (see FIG. 6).
Then, the OS unit 144 loads the correspondence table 122 from the program storage unit 149 to the physical page.
Further, the OS unit 144 sets a virtual address immediately before “main data” in the heap pointer for designating the heap area 133 (see (2) in FIG. 6).
After S120, the process proceeds to S130.

S130において、プログラム実行部141は、実行プログラム120の実行を開始する。つまり、プログラム実行部141は、エントリポインタに設定されている書き換えロジック(または、main()関数から呼び出された書き換えロジック)を実行する。   In S <b> 130, the program execution unit 141 starts execution of the execution program 120. That is, the program execution unit 141 executes the rewrite logic (or the rewrite logic called from the main () function) set in the entry pointer.

プログラム実行部141は、書き換えロジックを実行することによってスタック領域132の正しい仮想アドレスをスタックポインタに設定すると共に、ヒープ領域133の正しい仮想アドレスをヒープポインタに設定する。
つまり、プログラム実行部141は、スタックポインタに設定されている仮想アドレスをテキスト領域131の直後の仮想アドレスに更新し(図6の(3)参照)、ヒープポインタに設定されている仮想アドレスをbss領域134の直前の仮想アドレスに更新する(図6の(4)参照)。
これにより、既存のプログラムローダーに書き換えロジックの機能を追加しなくても、既存のプログラムローダーを計算機システム100のプログラムローダー112として使用することができる。
The program execution unit 141 sets the correct virtual address of the stack area 132 as the stack pointer by executing the rewrite logic, and sets the correct virtual address of the heap area 133 as the heap pointer.
That is, the program execution unit 141 updates the virtual address set in the stack pointer to the virtual address immediately after the text area 131 (see (3) in FIG. 6), and sets the virtual address set in the heap pointer to bss. The virtual address immediately before the area 134 is updated (see (4) in FIG. 6).
Thus, the existing program loader can be used as the program loader 112 of the computer system 100 without adding a rewrite logic function to the existing program loader.

プログラム実行部141は、書き換えロジックの実行後、書き換えロジックの次のプログラムコードを実行する。
S130の後、処理はS140に進む。
After executing the rewrite logic, the program execution unit 141 executes the next program code of the rewrite logic.
After S130, the process proceeds to S140.

S140において、仮想ページがマッピングされていなプログラムデータ123またはプログラムテキスト124にアクセスするアクセス命令(call、jump、load、storeなど)が実行される場合、OS部144は、アクセスされる仮想アドレスをシグナルハンドラ部145に通知することによって、メモリアクセス違反を発生させる。
以下、S140でアクセスされるプログラムデータ123またはプログラムテキスト124を「アクセス違反データ」とし、アクセス違反データの仮想アドレスを「アクセス違反アドレス」とする。
メモリアクセス違反が発生した場合(YES)、処理はS150に進む。
メモリアクセス違反が発生しない場合(NO)、処理はS170に進む。
In S140, when an access instruction (call, jump, load, store, etc.) for accessing the program data 123 or the program text 124 to which the virtual page is not mapped is executed, the OS unit 144 signals the virtual address to be accessed. By notifying the handler unit 145, a memory access violation is generated.
Hereinafter, the program data 123 or program text 124 accessed in S140 is referred to as “access violation data”, and the virtual address of the access violation data is referred to as “access violation address”.
If a memory access violation has occurred (YES), the process proceeds to S150.
If no memory access violation occurs (NO), the process proceeds to S170.

S150において、シグナルハンドラ部145は、main()関数に定義されているシグナルハンドラを実行することによって以下のような処理を行う。   In S150, the signal handler unit 145 performs the following processing by executing the signal handler defined in the main () function.

シグナルハンドラ部145は、対応表122(図4参照)から、アクセス違反アドレスと同じ仮想アドレスに対応付けられた開始オフセットおよびページ数を取得する。
そして、シグナルハンドラ部145は、取得した開始オフセットおよびページ数によって特定されるハードディスク105内のページ(アクセス違反データ)を、アクセス違反アドレスによって特定される仮想ページにマッピングし、仮想ページに物理ページを割り付ける。
The signal handler unit 145 acquires the start offset and the number of pages associated with the same virtual address as the access violation address from the correspondence table 122 (see FIG. 4).
Then, the signal handler unit 145 maps the page (access violation data) in the hard disk 105 specified by the acquired start offset and the number of pages to the virtual page specified by the access violation address, and assigns the physical page to the virtual page. Assign.

例えば、アクセス違反アドレスが「0xc0077000」である場合、シグナルハンドラ部145は、対応表122から開始オフセット「114」およびページ数「56」を取得する。
そして、シグナルハンドラ部145は、ハードディスク105の「114」番目のページから「169」番目のページまでの「56」個のページを仮想ページにマッピングし、仮想ページに物理ページを割り付ける。
For example, when the access violation address is “0xc0077000”, the signal handler unit 145 acquires the start offset “114” and the page number “56” from the correspondence table 122.
The signal handler unit 145 maps “56” pages from the “114” -th page to the “169” -th page of the hard disk 105 to the virtual page, and allocates the physical page to the virtual page.

以下、S150で取得された開始オフセットを「対象開始オフセット」とし、S150で取得されたページ数を「対象ページ数」とする。
S150の後、処理はS160に進む。
Hereinafter, the start offset acquired in S150 is referred to as “target start offset”, and the number of pages acquired in S150 is referred to as “target page number”.
After S150, the process proceeds to S160.

S160において、OS部144は、シグナルハンドラ部145から対象開始オフセットおよび対象ページ数を取得する。
OS部144は、OS111のページング機能を用いて、ハードディスク105のセクタ(記憶領域)のうち対象開始オフセットおよび対象ページ数によって特定されるページに対応するセクタを特定する。
以下、特定したセクタを「対象セクタ」とし、特定したセクタを識別する識別子を「対象セクタ番号」とする。
In S160, the OS unit 144 acquires the target start offset and the target page number from the signal handler unit 145.
The OS unit 144 uses the paging function of the OS 111 to specify the sector corresponding to the page specified by the target start offset and the target page number among the sectors (storage areas) of the hard disk 105.
Hereinafter, the specified sector is referred to as “target sector”, and the identifier for identifying the specified sector is referred to as “target sector number”.

OS部144は、アクセス違反アドレスと対象セクタ番号とをデバイスドライバ部146に通知する。   The OS unit 144 notifies the device driver unit 146 of the access violation address and the target sector number.

デバイスドライバ部146は、MMU102を用いてアクセス違反アドレスを物理アドレスに変換し、物理アドレスと対象セクタ番号とを含んだI/O命令をディスクコントローラ104に入力する。   The device driver unit 146 converts the access violation address into a physical address using the MMU 102 and inputs an I / O instruction including the physical address and the target sector number to the disk controller 104.

ディスクコントローラ104は、I/O命令に従って、ハードディスク105の対象セクタに記憶されているアクセス違反データを、物理アドレスで識別される物理ページにロードする。
例えば、ディスクコントローラ104は、DMA(Direct Memory Access)機能を用いて、アクセス違反データのロードを行う。
S160の後、処理はS170に進む。
In accordance with the I / O instruction, the disk controller 104 loads the access violation data stored in the target sector of the hard disk 105 into the physical page identified by the physical address.
For example, the disk controller 104 loads access violation data by using a DMA (Direct Memory Access) function.
After S160, the process proceeds to S170.

S170において、プログラム実行部141は、実行プログラム120の実行を続ける。
S170の後、処理はS171に進む。
In S170, the program execution unit 141 continues to execute the execution program 120.
After S170, the process proceeds to S171.

S171において、実行プログラム120の実行が終了した場合(YES)、プログラム実行処理は終了する。
また、実行プログラム120の実行が終了しない場合(NO)、処理はS140に戻る。
In S171, when the execution of the execution program 120 is completed (YES), the program execution process ends.
If execution of the execution program 120 does not end (NO), the process returns to S140.

以上のように、実施の形態1における計算機システム100は、プログラムの実行において必要なページのみを使用し、冗長なコピーを発生させない。結果として、巨大なアプリケーションになればなるほど、従来例に比較して高速に起動し、且つ、無駄なメモリ消費を抑えることができる。   As described above, the computer system 100 according to the first embodiment uses only pages necessary for program execution and does not generate redundant copies. As a result, the larger the application, the faster the startup compared to the conventional example, and it is possible to suppress unnecessary memory consumption.

実施の形態1において、計算機システム100が備えるハードディスク105に実行プログラム120を記憶しておく形態について説明した。
但し、実行プログラム120(または実行プログラム120の一部)はネットワーク107に接続された他の記憶装置に記憶しておいても構わない。この場合、計算機システム100はネットワーク107を介して他の記憶装置から実行プログラム120(または実行プログラム120の一部)を取得する。
In the first embodiment, the form in which the execution program 120 is stored in the hard disk 105 provided in the computer system 100 has been described.
However, the execution program 120 (or a part of the execution program 120) may be stored in another storage device connected to the network 107. In this case, the computer system 100 acquires the execution program 120 (or a part of the execution program 120) from another storage device via the network 107.

図10は、従来におけるプログラム実行時のページ割り付け方法の概要を示す図である。
従来のプログラムの実行開始時におけるページ割り付け方法の概要について、図10に基づいて説明する。
FIG. 10 is a diagram showing an outline of a conventional page allocation method during program execution.
An overview of a page allocation method at the start of execution of a conventional program will be described with reference to FIG.

従来、プログラムが実行される場合、プログラムの実行が開始される前に、プロセス空間および実行コンテキストが確保される。
また、プロセス空間のうちプログラムのテキスト用の領域「main text」およびスタティックライブラリのテキスト用の領域「Libc text」に物理ページが割り付けられ、プログラムのテキストおよびスタティックライブラリのテキストがロードされる。
また、プログラムのデータ用の領域「main data」、スタティックライブラリのデータ用の領域「Libc data」および共有ライブラリのデータ用の領域「hoge data」に物理ページが割り付けられ、プログラム、スタティックライブラリおよび共有ライブラリのデータがロードされる。
さらに、プログラムのプロセス空間とは別の仮想空間に設けられる共有ライブラリのテキスト用の領域「hoge text」に物理ページが割り付けられ、共有ライブラリのテキストがロードされる。
つまり、従来は、プログラムの実行が開始される前に、全てのプログラム、スタティックライブラリおよび共有ライブラリが物理メモリにロードされる。
Conventionally, when a program is executed, a process space and an execution context are secured before the execution of the program is started.
Also, physical pages are allocated to the program text area “main text” and the static library text area “Libc text” in the process space, and the program text and the static library text are loaded.
Further, physical pages are allocated to the program data area “main data”, the static library data area “Libc data”, and the shared library data area “hoge data”, and the program, static library, and shared library Data is loaded.
Furthermore, a physical page is allocated to the text area “hoge text” of the shared library provided in a virtual space different from the process space of the program, and the text of the shared library is loaded.
In other words, conventionally, all programs, static libraries, and shared libraries are loaded into physical memory before program execution is started.

なお、スタック領域はテキスト領域「main text」「Libc text」の直後に設けられ、bss領域はデータ領域「main data」「Libc data」「hoge data」の直前に設けられ、ヒープ領域はbss領域の直前に設けられる。
また、プログラムは、エントリポインタで指定されるmain()関数から順に実行される。
The stack area is provided immediately after the text areas “main text” and “Libc text”, the bss area is provided immediately before the data areas “main data”, “Libc data”, and “hoge data”, and the heap area is the bss area. It is provided immediately before.
The program is executed in order from the main () function specified by the entry pointer.

プログラムの実行が開始された後、物理メモリが不足した場合、共有ライブラリがハードディスクに退避される。
また、ハードディスクに退避された共有ライブラリが使用される場合、共有ライブラリをロードするためのロード関数が実行され、共有ライブラリがハードディスクから物理メモリにロードされる。
After running the program, if the physical memory is insufficient, the shared library is saved to the hard disk.
When the shared library saved on the hard disk is used, a load function for loading the shared library is executed, and the shared library is loaded from the hard disk to the physical memory.

次に、ハードディスクから物理メモリにデータ(例えば、共有ライブラリ)をロードするファイルシステムについて説明する。
ファイルシステムは、ハードディスクの1セクタに相当する512バイトのバッファメモリをOSの機能で管理し、このOSのバッファメモリを用いてハードディスクから物理メモリに共有ライブラリをロードする。
つまり、ファイルシステムは、共有ライブラリをロードするためにread()またはwrite()などのOSのシステムコールが呼び出されると、ハードディスクのセクタ単位で共有ライブラリをバッファメモリにコピーすると共に、共有ライブラリをバッファメモリから物理メモリにコピーする。
Next, a file system for loading data (for example, a shared library) from the hard disk into the physical memory will be described.
The file system manages a 512-byte buffer memory corresponding to one sector of the hard disk by the function of the OS, and loads the shared library from the hard disk to the physical memory using the buffer memory of the OS.
That is, when an OS system call such as read () or write () is called to load the shared library, the file system copies the shared library to the buffer memory in units of sectors on the hard disk and buffers the shared library. Copy from memory to physical memory.

但し、近年のファイルシステムは、OSのバッファメモリを使用する代わりに、物理メモリの1ページに相当するLibc用のデータバッファを使用する。Libcとは、C言語で用意された標準ライブラリである。
例えば、ファイルシステムは、共有ライブラリをロードするためのロード関数が実行されると、ハードディスク内のファイルうち共有ライブラリを含んだファイルをopen()関数でオープンし、共有ライブラリをread()関数でハードディスクから読み出し、読み出した共有ライブラリをLibc用のデータバッファにコピーする。
さらに、ファイルシステムは、共有ライブラリをLibc用のデータバッファからヒープ領域またはテキスト領域「hoge text」に割り付けられた物理メモリにコピーする。
つまり、ファイルシステムは、共有ライブラリを物理メモリにロードするために、物理メモリのページ毎に、1回のディスクI/O(ハードディスクからの読み出し)および2回のデータコピー(ハードディスクからデータバッファへのコピー、データバッファから物理メモリへのコピー)を行う。
However, recent file systems use a Libc data buffer corresponding to one page of physical memory instead of using the OS buffer memory. Libc is a standard library prepared in C language.
For example, when a load function for loading a shared library is executed, the file system opens a file including the shared library among files on the hard disk with the open () function, and opens the shared library with the read () function. The shared library that has been read is copied to the data buffer for Libc.
Further, the file system copies the shared library from the data buffer for Libc to the physical memory allocated to the heap area or the text area “hoge text”.
That is, the file system loads one disk I / O (read from the hard disk) and two data copies (from the hard disk to the data buffer) for each page of the physical memory in order to load the shared library into the physical memory. Copy, copy from data buffer to physical memory).

実施の形態1において、例えば、以下のようなプログラム生成方法およびプログラム実行方法について説明した。括弧内に、対応する構成の符号または名称を記す。
プログラム生成部(143)が、プログラム(120)の実行が開始される前に仮想空間にマッピングするプログラムコードとしてメイン関数(main()関数)を含む一部のプログラムコード(121)を含み、前記プログラムの実行が開始される前に仮想空間にマッピングするデータとして前記一部のプログラムコードを除いた残りのプログラムコードが記憶される補助記憶装置(105)内の記憶領域を特定するための記憶領域情報(122)を含み、前記プログラムの実行が開始される前に仮想空間にマッピングしないデータとして前記残りのプログラムコード(124)を含むファイルを前記プログラムとして生成する。
In the first embodiment, for example, the following program generation method and program execution method have been described. The code or name of the corresponding configuration is shown in parentheses.
The program generation unit (143) includes a part of program code (121) including a main function (main () function) as a program code to be mapped to the virtual space before the execution of the program (120) is started, A storage area for specifying a storage area in the auxiliary storage device (105) in which the remaining program codes excluding the part of the program codes are stored as data to be mapped in the virtual space before the execution of the program is started A file including the information (122) and including the remaining program code (124) as data not mapped in the virtual space before the execution of the program is started is generated as the program.

開始前マッピング部(144)が、実行プログラムの実行が開始される前に、前記実行プログラムのプログラムコードのうちメイン関数を含む一部のプログラムコードと、前記実行プログラムのプログラムコードのうち前記一部のプログラムコードを除いた残りのプログラムコードが記憶される補助記憶装置内の記憶領域を特定するための記憶領域情報と、を仮想空間にマッピングする。
プログラム実行部(141)が、前記実行プログラムを実行する。
実行中マッピング部(144)が、前記プログラム実行部が前記開始前マッピング部によって仮想空間にマッピングされていない前記残りのプログラムコードに含まれるプログラムコードを実行コードとして実行するときに、前記開始前マッピング部によって仮想空間にマッピングされた前記記憶領域情報を用いて前記実行コードを仮想空間にマッピングする。
Before the start mapping unit 144 starts execution of the execution program, a part of the program code of the execution program including a main function and the part of the program code of the execution program The storage area information for specifying the storage area in the auxiliary storage device in which the remaining program codes excluding the program code are stored is mapped in the virtual space.
A program execution unit (141) executes the execution program.
When the executing mapping unit (144) executes, as the execution code, the program code included in the remaining program code that is not mapped in the virtual space by the pre-start mapping unit, the pre-start mapping The execution code is mapped to the virtual space using the storage area information mapped to the virtual space by the unit.

実施の形態1においてフローチャートなどに含まれている矢印は主としてデータや信号の入出力を示す。フローチャートなどに基づいて説明する処理はハードウェアを用いて実行される。
実施の形態1において「〜部」として説明するものは「〜回路」「〜装置」「〜ユニット」「〜ステップ」または「〜処理」に置き換えてもよい。すなわち、「〜部」として説明するものは、ファームウェア、ソフトウェア、ハードウェアまたはこれらの組み合わせのいずれで実装されても構わない。
In the first embodiment, the arrows included in the flowchart mainly indicate input / output of data and signals. The processing described based on the flowchart and the like is executed using hardware.
What is described as “˜unit” in the first embodiment may be replaced with “˜circuit”, “˜device”, “˜unit”, “˜step”, or “˜processing”. That is, what is described as “to part” may be implemented by any of firmware, software, hardware, or a combination thereof.

以降の実施の形態では、実施の形態1における計算機システム100について説明を補足する。   In the following embodiments, the description of the computer system 100 in the first embodiment will be supplemented.

実施の形態2.
実施の形態1で説明したように、計算機システム100は、オペレーティングシステムの仮想記憶機能をそのまま使用することによって、プログラムを実行するためのワーキングセット(メモリ領域)を管理することができる。
なお、計算機システム100は、仮想記憶装置として利用するバックストアの所在を制限しない。例えば、計算機システム100は、インターネットなどのネットワークに接続するサーバーを仮想記憶装置として用いても構わない。つまり、計算機システム100は、実行プログラム120をハードディスク105の代わりにサーバーから物理メモリにロードしても構わない。
Embodiment 2. FIG.
As described in the first embodiment, the computer system 100 can manage a working set (memory area) for executing a program by using the virtual storage function of the operating system as it is.
The computer system 100 does not limit the location of the back store used as a virtual storage device. For example, the computer system 100 may use a server connected to a network such as the Internet as a virtual storage device. That is, the computer system 100 may load the execution program 120 from the server into the physical memory instead of the hard disk 105.

実施の形態2において、例えば、以下のような計算機システム100について説明した。
計算機システム100は、ライブラリテキストおよびデータのページデータを実行プログラムファイルのレプリカとしてネットワーク上に配置し、当該ページデータをネットワーク経由で取得する。
In the second embodiment, for example, the following computer system 100 has been described.
The computer system 100 places the library text and the page data of the data on the network as a replica of the execution program file, and acquires the page data via the network.

実施の形態3.
実施の形態1で説明したように、計算機システム100は、オペレーティングシステムの仕様を問わないため、既存のオペレーティングシステムを使用することができる。
つまり、計算機システム100のリンカ114は、既存のCPU101、MMU102およびOS111によって実現される仮想記憶機構の実装に則って実装することが可能である。
例えば、計算機システム100は、インテル社またはAMD社のCPU101、マイクロソフト社またはHP社のOS111、HP社のPA−RISCインバーティッドテーブルアーキテクチャ、IBM社のサーバーなどを適用することが可能である。
Embodiment 3 FIG.
As described in the first embodiment, the computer system 100 can use an existing operating system because the specification of the operating system does not matter.
That is, the linker 114 of the computer system 100 can be implemented in accordance with the implementation of the virtual storage mechanism realized by the existing CPU 101, MMU 102, and OS 111.
For example, the computer system 100 can apply a CPU 101 of Intel or AMD, an OS 111 of Microsoft or HP, a PA-RISC inverted table architecture of HP, an IBM server, or the like.

実施の形態3において、例えば、以下のような計算機システム100について説明した。
計算機システム100は、実行プログラムを実行することによってスタックポインタとヒープポインタとを変更し、ライブラリのテキスト配置領域とデータ配置領域を確保する。これにより、計算機システム100は、既存システムのプログラムのローダー機能の変更を必要としない。
In the third embodiment, for example, the following computer system 100 has been described.
The computer system 100 changes the stack pointer and the heap pointer by executing the execution program, and secures the text placement area and data placement area of the library. Thereby, the computer system 100 does not need to change the loader function of the program of the existing system.

実施の形態4.
実施の形態1では、計算機システム100が実行プログラム120を一つのプロセス空間で実行される場合について説明した。
但し、計算機システム100は、実行プログラム120を複数のプロセス空間で実行することもできる。例えば、計算機システム100は、ウェブブラウザの実行プログラム120を複数のプロセス空間で実行することによって、ウェブブラウザとして機能するウィンドウを複数表示することもできる。
Embodiment 4 FIG.
In the first embodiment, the case where the computer system 100 executes the execution program 120 in one process space has been described.
However, the computer system 100 can also execute the execution program 120 in a plurality of process spaces. For example, the computer system 100 can display a plurality of windows functioning as a web browser by executing the web browser execution program 120 in a plurality of process spaces.

図11は、実施の形態4におけるプロセス空間を示す図である。
計算機システム100は、実行プログラム120の実行を開始するときに第一のプロセス空間を生成し、生成した第一のプロセス空間を用いて実行プログラム120を実行する。
さらに、計算機システム100は、第一のプロセス空間を用いて実行プログラム120を実行しているときに第二のプロセスを生成し、生成した第二のプロセス空間を用いて第一のプロセス空間とは別に実行プログラム120を実行する。
なお、第一のプロセス空間と第二のプロセス空間とで共有することができる領域「hoge text」は、第一のプロセス空間と第二のプロセス空間とは別の仮想領域に設けてもよい。
FIG. 11 is a diagram showing a process space in the fourth embodiment.
The computer system 100 generates a first process space when the execution of the execution program 120 is started, and executes the execution program 120 using the generated first process space.
Furthermore, the computer system 100 generates a second process when the execution program 120 is executed using the first process space, and what is the first process space using the generated second process space? The execution program 120 is executed separately.
The area “hoge text” that can be shared by the first process space and the second process space may be provided in a virtual area different from the first process space and the second process space.

実施の形態4において、例えば、以下のような計算機システム100について説明した。
計算機システム100は、実行プログラムを2つ以上実行するとき、当該テキストが割り当てられている物理メモリのページを共有する。
In the fourth embodiment, for example, the following computer system 100 has been described.
When the computer system 100 executes two or more execution programs, the computer system 100 shares a physical memory page to which the text is assigned.

実施の形態5.
共有ライブラリを利用する利点の一つとして、次のような事項が挙げられる。共有ライブラリが何らかの理由で更新されても共有ライブラリのAPI(Application Program Interface)に変更がない場合、更新された共有ライブラリを利用するアプリケーションプログラムをリコンパイルする必要が無い。
実施の形態1で説明した計算機システム100においても、APIの変更を除いた共有ライブラリの更新に伴ってアプリケーションプログラム(実行プログラム120)をリコンパイルする必要は無い。但し、計算機システム100は、更新後の共有ライブラリを利用するため、新たにリンカ114を実行することによって新たにアプリケーションプログラムを生成する必要がある。
Embodiment 5. FIG.
One of the advantages of using a shared library is as follows. Even if the shared library is updated for some reason, if there is no change in the API (Application Program Interface) of the shared library, there is no need to recompile an application program that uses the updated shared library.
In the computer system 100 described in the first embodiment, it is not necessary to recompile the application program (execution program 120) in accordance with the update of the shared library excluding the API change. However, since the computer system 100 uses the updated shared library, it is necessary to newly generate an application program by executing the linker 114 anew.

実施の形態5において、例えば、以下のような計算機システム100について説明した。
計算機システム100は、共有ライブラリに変更があっても当該ライブラリのインクリメンタルな変更だけを行い、実行プログラムのリコンパイルを必要としない。
In the fifth embodiment, for example, the following computer system 100 has been described.
Even if there is a change in the shared library, the computer system 100 performs only an incremental change of the library and does not require recompilation of the execution program.

実施の形態6.
実施の形態1で説明した計算機システム100は、アプリケーションプログラム(実行プログラム120)を仮想空間に貼り付け、その実行に必要なページのみを有効化することによって、アプリケーションプログラムの起動時間の短縮およびメモリ消費の最適化を図るものである。
計算機システム100は既存のシステムに手を加えずに上記の効果を奏することができるが、既存のシステムに手を加えて計算機システム100を構築しても構わない。
Embodiment 6 FIG.
The computer system 100 described in the first embodiment pastes the application program (execution program 120) into the virtual space and enables only the pages necessary for its execution, thereby shortening the startup time of the application program and memory consumption. Is to optimize.
The computer system 100 can achieve the above effect without modifying the existing system, but the computer system 100 may be constructed by modifying the existing system.

実施の形態7.
計算機システム100は、実行プログラム120の実行時にメモリアクセス違反が発生した仮想アドレスを記憶し、記憶した仮想アドレスで識別される仮想領域に設定されるテキストまたはデータを.textセクションまたは.dataセクションに格納するように実行プログラム120を再構成してもよい。また、計算機システム100は、記憶した仮想アドレスに設定されるテキストまたはデータをアドレスの記憶番にソートしてもよい。
これにより、計算機システム100は、実行プログラム120の実行を開始する前に、実行プログラム120を実行中に使用する可能性が高いテキストまたはデータを物理メモリにロードすることができる。つまり、計算機システム100は、実行プログラム120の実行中に発生するメモリアクセス違反を抑制することができる。
Embodiment 7 FIG.
The computer system 100 stores a virtual address where a memory access violation has occurred during execution of the execution program 120, and stores text or data set in a virtual area identified by the stored virtual address. text section or. The execution program 120 may be reconfigured so as to be stored in the data section. Further, the computer system 100 may sort the text or data set in the stored virtual address into the address storage number.
As a result, the computer system 100 can load text or data that is likely to be used during execution of the execution program 120 into the physical memory before the execution of the execution program 120 is started. That is, the computer system 100 can suppress a memory access violation that occurs during execution of the execution program 120.

実施の形態7において、例えば、以下のような計算機システム100について説明した。
計算機システム100は、テキスト及びデータのメモリアクセス違反が発生したアドレスを取得し、そのアドレスに該当するシンボル単位でテキスト及びデータをソートし、プログラムを再リンクする。
In the seventh embodiment, for example, the following computer system 100 has been described.
The computer system 100 acquires the address where the memory access violation of text and data has occurred, sorts the text and data in symbol units corresponding to the address, and relinks the program.

実施の形態8.
計算機システム100は、マイクロソフト社が提供するリンカを使用し、マイクロソフト社のPE実行ファイル形式を踏襲してアプリケーションプログラム(実行プログラム120)を生成してもよい。
計算機システム100は、マイクロソフト社のオペレーティングシステム「Windows(登録商標)」上で動作するすべてのアプリケーションプログラムに対して適用することが可能である。
例えば、「Windows(登録商標)」上で動作するアプリケーションプログラムを開発する開発者は、マイクロソフト社の「Visual Studio(登録商標)」などの開発環境を用いて従来通りにプログラムの作成および試験を行い、製品としてしかるべき品質のアプリケーションプログラムを開発すればよい。そして、開発者は、マイクロソフト社が提供するリンカを使用し、PE実行ファイル形式のアプリケーションプログラムを作成し、作成したアプリケーションプログラムを製品として出荷する。
Embodiment 8 FIG.
The computer system 100 may generate an application program (execution program 120) using a linker provided by Microsoft Corporation and following the Microsoft PE execution file format.
The computer system 100 can be applied to all application programs that operate on the operating system “Windows (registered trademark)” of Microsoft Corporation.
For example, a developer who develops an application program that runs on "Windows (registered trademark)" creates and tests a program as usual using a development environment such as "Visual Studio (registered trademark)" of Microsoft Corporation. An application program of an appropriate quality as a product may be developed. Then, the developer creates a PE execution file format application program using a linker provided by Microsoft, and ships the created application program as a product.

実施の形態8において、例えば、以下のような計算機システム100について説明した。
計算機システム100は、実行プログラム形式を解釈可能なローダーを有する。
In the eighth embodiment, for example, the following computer system 100 has been described.
The computer system 100 has a loader that can interpret the execution program format.

実施の形態9.
実施の形態1とは異なる実行プログラム120の形態について説明する。
実施の形態1と異なる事項について主に説明し、説明を省略する事項については実施の形態1と同様である。
Embodiment 9 FIG.
The form of the execution program 120 different from the first embodiment will be described.
Items different from the first embodiment will be mainly described, and items omitted will be the same as those in the first embodiment.

図12は、実施の形態9における第一の実行プログラム120Aおよび第二の実行プログラム120Bを示す図である。
図12に示すように、リンク部143は、エントリポイントテキスト121と対応表122とから成る第一の実行プログラム120Aと、プログラムテキスト124とプログラムデータ123とから成る第二の実行プログラム120Bとを生成する。
エントリポイントテキスト121のmain()関数は、プロセス空間130をコピーするためのシステムコール(fork)と、コピーされたプロセス空間130にプログラムテキスト124およびプログラムデータ123をマッピングするマッピングロジックとを含んでいる。
FIG. 12 is a diagram showing the first execution program 120A and the second execution program 120B in the ninth embodiment.
As shown in FIG. 12, the link unit 143 generates a first execution program 120A composed of the entry point text 121 and the correspondence table 122, and a second execution program 120B composed of the program text 124 and the program data 123. To do.
The main () function of the entry point text 121 includes a system call (fork) for copying the process space 130 and mapping logic for mapping the program text 124 and the program data 123 to the copied process space 130. .

図13は、実施の形態9における第一のプロセス空間130Aと第二のプロセス空間130Bとを示す図である。
図13において、OS部144は、第一の実行プログラム120A(図12参照)を実行するための第一のプロセス空間130Aを生成する。
OS部144は、第一の実行プログラム120Aのエントリポイントテキスト121を「main text」の仮想ページにマッピングし、対応表122を「main data」にマッピングする。
OS部144は、「main text」の仮想ページおよび「main data」の仮想ページに物理ページを割り付け、割り付けた物理ページにエントリポイントテキスト121および対応表122をロードする。
FIG. 13 is a diagram showing a first process space 130A and a second process space 130B in the ninth embodiment.
In FIG. 13, the OS unit 144 generates a first process space 130A for executing the first execution program 120A (see FIG. 12).
The OS unit 144 maps the entry point text 121 of the first execution program 120A to a virtual page of “main text”, and maps the correspondence table 122 to “main data”.
The OS unit 144 allocates a physical page to the virtual page of “main text” and the virtual page of “main data”, and loads the entry point text 121 and the correspondence table 122 to the allocated physical page.

プログラム実行部141は、第一のプロセス空間130Aのエントリポイントテキスト121に含まれるmain()関数を実行する。
これにより、第一のプロセス空間130Aをコピーして第二のプロセス空間130Bが生成され、対応表122を用いて第二のプロセス空間130Bにプログラムテキスト124とプログラムデータ123とがマッピングされる。
The program execution unit 141 executes a main () function included in the entry point text 121 of the first process space 130A.
Thereby, the first process space 130A is copied to generate the second process space 130B, and the program text 124 and the program data 123 are mapped to the second process space 130B using the correspondence table 122.

その後、プログラム実行部141は、第二のプロセス空間130Bにマッピングされた第二の実行プログラム120Bを実行する。   Thereafter, the program execution unit 141 executes the second execution program 120B mapped to the second process space 130B.

実施の形態9において、エントリポイントテキスト121と対応表122とから成る最小の実行プログラムと、プログラムテキスト124とプログラムデータ123とから成る通常の実行プログラムとを生成することを説明した。
また、最小の実行プログラムのプロセス空間をコピーすることによって、通常のプログラムを実行するためのプロセス空間を生成することを説明した。
In the ninth embodiment, it has been described that the minimum execution program composed of the entry point text 121 and the correspondence table 122 and the normal execution program composed of the program text 124 and the program data 123 are generated.
Further, it has been described that the process space for executing a normal program is generated by copying the process space of the smallest execution program.

各実施の形態において、例えば、以下の事項を説明した。
従来のオペレーティングシステム機能により、共有ライブラリのテキストのメモリ上へのロード、利用プロセスへのデータコピーなどのサービスを回避し、スタティックライブラリを含め、全てのライブラリを当該実行プログラムの仮想アドレス空間の中に配置し、アドレスを解決して一つの実行プログラムとする。
In each embodiment, for example, the following matters have been described.
Conventional operating system functions avoid services such as loading shared library text into memory and copying data to the process of use, and all libraries, including static libraries, are in the virtual address space of the executable program. Arrange and resolve the address to make one execution program.

リンカプログラムはmain()関数に先立って、全てのテキストが格納されるテキスト位置にスタックポインタを初期化する論理とライブラリ部分のデータを追加し、BSS格納に必要な位置にヒープポインタを更新する論理を追加する。   Prior to the main () function, the linker program adds logic for initializing the stack pointer at the text position where all text is stored and data for the library part, and logic for updating the heap pointer at the position required for BSS storage. Add

main()関数で記述されるプログラムは最小限である。
リンカプログラムは実行プログラムの.textセクションに当該プログラムのテキストを格納し、.dataセクションに当該プログラムのデータと、ライブラリプログラムのテキスト、データおよびBSSの対応表とを格納する。
また、対応表にポイントされるライブラリのテキストとデータは.commentセクションに格納する。
The program described by the main () function is minimal.
A linker program is an executable program. Store the text of the program in the text section; In the data section, the data of the program and the correspondence table of the text, data and BSS of the library program are stored.
The text and data of the library pointed to the correspondence table is. Store in the comment section.

システムプログラムのローダーは.textセクションと.dataセクションとを確保したプロセス空間にロードする。
システムが当該プロセスに実行コンテキストを与えると、実行プログラムはスタックポインタおよびヒープポインタの更新論理により、ライブラリテキスト、データおよびBSSの格納領域を確保する。
The system program loader is. text section and. The data section is loaded into the secured process space.
When the system gives an execution context to the process, the execution program secures storage areas for library text, data, and BSS by the update logic of the stack pointer and heap pointer.

プログラムの実行により、テキスト参照、あるいはデータ参照・書き込みでメモリアクセス違反の例外が発生する。   By executing the program, a memory access violation exception occurs in text reference or data reference / write.

実行プログラムにはメモリアクセス違反の例外処理ハンドラが定義されている。
ハンドラは、メモリアクセス違反が発生したアドレスをもって対応表を参照し、.commentセクションにあるテキストあるいはデータを、当該アドレスを含むページにマップする。そして、システムのページング機構がファイルシステムを介してハードディスクコントローラにDMA I/O命令を発行する事により、実行プログラムファイルの当該ページ部分の内容がハードディスクの当該セクタから当該ページにDMAでデータ書き込みされる。
An exception handler for memory access violation is defined in the execution program.
The handler refers to the correspondence table with the address where the memory access violation occurred. The text or data in the comment section is mapped to the page containing the address. Then, when the system paging mechanism issues a DMA I / O instruction to the hard disk controller via the file system, the contents of the page portion of the execution program file are written into the page from the sector of the hard disk by DMA. .

実行プログラムは、スタックポインタおよびヒープポインタを更新するタイミングで実行プログラムのライブラリテキストとデータの全域とをプロセス空間にマップしておいても良い。   The execution program may map the library text of the execution program and the entire data in the process space at the timing of updating the stack pointer and the heap pointer.

前記実行プログラムのレプリカはネットワーク上に置かれていても良い。   The replica of the execution program may be placed on the network.

巨大なアプリケーションの共有ライブラリはシステムの上で当該プログラムでのみ使用される物が多い。
しかしながら、同一のシステム上で複数の同一アプリケーションが複数利用されることがある。
この状況を鑑みて、実行プログラムは自身の同時複数実行がどれほどなされるか統計情報を取る。
統計情報から2以上同時に実行されることが多いと判断したときは、実行プログラムはライブラリ用テキストのページメモリを共有メモリとして確保する。
これにより、2つ目以降の実行プログラムはライブラリテキストのメモリ空間を共用することができる。
Many shared libraries for huge applications are used only by the program on the system.
However, a plurality of the same applications may be used on the same system.
In view of this situation, the execution program takes statistical information on how many simultaneous executions of itself are performed.
When it is determined from the statistical information that two or more are often executed simultaneously, the execution program reserves the page memory of the library text as a shared memory.
Thus, the second and subsequent execution programs can share the library text memory space.

ライブラリ用の共有メモリ領域を使用する実行方式は実行プログラムのプロセス数に関わらず常に適用する運用も可能である。   The execution method using the shared memory area for the library can always be applied regardless of the number of processes of the execution program.

リンカプログラムにより既存の共有ライブラリを実行プログラムに再構成する。
しかし、使用する共有ライブラリに変更が発生した場合は、リンカプログラムの再実行を行う。
The linker program reconfigures the existing shared library into an execution program.
However, if a change occurs in the shared library to be used, the linker program is re-executed.

各実施の形態は、既存システムの変更なしに奏効することを特徴とする。
しかし、CPUおよびDRAMの高性能化および大容量化によるプログラミングパラダイムの変化を否定するものではない。システムプログラム、特に実行時にプロセス空間の確保と実行プログラムのマッピングとを行うローダーを実装することも許容する。
Each embodiment is characterized in that it is effective without changing the existing system.
However, this does not deny the change in programming paradigm due to higher performance and larger capacity of CPUs and DRAMs. It is also acceptable to implement a system program, particularly a loader that secures process space and maps the execution program during execution.

計算機システム100はプログラム実行によってメモリアクセス違反を発生させたアドレスを記憶し、そのアドレスが含まれるシンボルと当該シンボルにより修飾されるテキスト及びデータをメモリアクセス違反の発生順に再リンクする。これにより、更に効率の高いページメモリ使用を可能にする。   The computer system 100 stores the address that caused the memory access violation by executing the program, and relinks the symbol including the address and the text and data modified by the symbol in the order of occurrence of the memory access violation. This enables more efficient use of the page memory.

各実施の形態により、巨大なアプリケーションの起動が非常に高速になる。
また、アプリケーションが自らメモリ使用を管理できるので、メモリ使用の制約が厳しい組み込みシステムにおけるアプリケーションにおいても、ワーキングセット管理をアプリケーション機能として実装することが可能である。
According to each embodiment, the start-up of a huge application becomes very fast.
Further, since the application can manage the memory use by itself, the working set management can be implemented as an application function even in an application in an embedded system in which restrictions on the memory use are severe.

各実施の形態において、例えば、以下のようなプログラム生成方法およびプログラム実行方法について説明した。
実行形式のプログラムを生成するリンカと実行形式のプログラムをメモリ上にロードするローダーとから構成され、プログラムがライブラリテキスト、データまたはBSSを参照する際に発生するメモリアクセス例外によって、プログラムアドレス空間の当該部分のページメモリの確保および当該データのロードを行う。
リンカは、実行プログラム生成時に必要とするスタティックライブラリおよび共有ライブラリを一つのプログラムアドレス空間に配置し、共有ライブラリを含めてアドレス解決のみを行い、実行プログラムに格納されているロードアドレスと当該ライブラリのテキストおよびデータとを特定する手段である対応表をデータとして生成し、実行形式のプログラムを生成する。
In each embodiment, for example, the following program generation method and program execution method have been described.
A linker that generates an executable program and a loader that loads the executable program into memory. The memory address exception that occurs when the program references library text, data, or BSS causes the program address space A part of page memory is secured and the data is loaded.
The linker places the static library and shared library required when generating the execution program in one program address space, performs address resolution only including the shared library, and stores the load address stored in the execution program and the text of the library. A correspondence table, which is a means for specifying the data, is generated as data, and an executable program is generated.

ライブラリテキストおよびデータのページデータを実行プログラムファイルのレプリカとしてネットワーク上に配置し、当該ページデータをネットワーク経由で取得する。   The library text and the page data of the data are arranged on the network as a replica of the execution program file, and the page data is acquired via the network.

実行プログラム自身がスタックポインタおよびヒープ領域ポインタを変更することによって、ライブラリのテキスト配置領域およびデータ配置領域を確保する。
これにより、既存システムのプログラムのローダー機能を変更する必要がない。
The execution program itself changes the stack pointer and heap area pointer to secure the text arrangement area and data arrangement area of the library.
Thereby, it is not necessary to change the loader function of the program of the existing system.

同一のシステム上にて、実行プログラムが2以上実行されるときは、当該テキストが割り当てられている物理メモリページを共有する。   When two or more execution programs are executed on the same system, the physical memory page to which the text is assigned is shared.

ロードアドレスとテキストおよびデータとの対応表と、その内容を更新する手段とを有する。
共有ライブラリ部分に変更があっても当該ライブラリのインクリメンタルな変更のみで、実行プログラムの他のプログラムのリコンパイルは必要としない。
It has a correspondence table of load addresses, texts and data, and means for updating the contents.
Even if there is a change in the shared library portion, it is only an incremental change of the library, and no recompilation of other programs in the execution program is required.

システムに実行プログラム形式を解釈可能なローダーを有する。   The system has a loader that can interpret the executable program format.

実行プログラムは、プログラムの実行によってテキスト及びデータのメモリアクセス違反を発生させたアドレス情報を取得し、そのアドレスに該当するシンボル単位でテキスト及びデータをソートし、テキスト及びデータを再リンクする。   The execution program acquires the address information that caused the memory access violation of the text and data by executing the program, sorts the text and data in symbol units corresponding to the address, and relinks the text and data.

100 計算機システム、101 CPU、102 MMU 103 DRAM、104 ディスクコントローラ、105 ハードディスク、106 ネットワークコントローラ、107 ネットワーク、108 バス、111 OS、112 プログラムローダー、113 コンパイラ、114 リンカ、115 プログラムソース、116 スタティックライブラリソース、117 共有ライブラリソース、120 実行プログラム、121 エントリポイントテキスト、122 対応表、123 プログラムデータ、124 プログラムテキスト、130 プロセス空間、131 テキスト領域、132 スタック領域、133 ヒープ領域、134 bss領域、135 データ領域、141 プログラム実行部、142 コンパイル部、143 リンク部、144 OS部、145 シグナルハンドラ部、146 デバイスドライバ部、149 プログラム記憶部。   100 computer system, 101 CPU, 102 MMU 103 DRAM, 104 disk controller, 105 hard disk, 106 network controller, 107 network, 108 bus, 111 OS, 112 program loader, 113 compiler, 114 linker, 115 program source, 116 static library source 117 shared library source, 120 execution program, 121 entry point text, 122 correspondence table, 123 program data, 124 program text, 130 process space, 131 text area, 132 stack area, 133 heap area, 134 bss area, 135 data area 141 Program execution unit 142 Compile unit 143 Link , 144 OS unit, 145 signal handler unit, 146 device driver section, 149 a program storage unit.

Claims (11)

開始前マッピング部が、実行プログラムの実行が開始される前に、前記実行プログラムのプログラムコードのうちメイン関数を含む一部のプログラムコードと、前記実行プログラムのプログラムコードのうち前記一部のプログラムコードを除いた残りのプログラムコードが記憶される補助記憶装置内の記憶領域を特定するための記憶領域情報と、を仮想空間にマッピングし、
プログラム実行部が、前記実行プログラムを実行し、
実行中マッピング部が、前記プログラム実行部が前記開始前マッピング部によって仮想空間にマッピングされていない前記残りのプログラムコードに含まれるプログラムコードを実行コードとして実行するときに、前記開始前マッピング部によって仮想空間にマッピングされた前記記憶領域情報を用いて前記実行コードを仮想空間にマッピングするプログラム実行方法であって、
プログラム生成部が、プログラムを実行するための仮想空間を構成する領域のうちプログラムコードを設定するためのテキスト領域に設定するテキストセクションデータとして前記一部のプログラムコードを含むプログラムを前記実行プログラムとして生成し、
前記開始前マッピング部は、前記プログラム生成部によって生成された前記実行プログラムの実行が開始される前に、前記実行プログラムに前記テキストセクションデータとして含まれる前記一部のプログラムコードを仮想空間の前記テキスト領域にマッピングし、
前記一部のプログラムコードが、前記メイン関数とポインタ書き換え関数とを含み、
前記ポインタ書き換え関数が、前記テキスト領域の隣に位置する第一の領域を指定するための第一のポインタに、前記残りのプログラムコードを前記テキスト領域に加えた場合の前記第一の領域を指定するアドレスを設定する関数である
ことを特徴とするプログラム実行方法。
Before the start mapping unit starts executing the execution program, a part of the program code of the execution program including a main function and a part of the program code of the execution program Mapping the storage area information for specifying the storage area in the auxiliary storage device in which the remaining program codes except for are stored in the virtual space,
The program execution unit executes the execution program,
When the executing mapping unit executes, as the execution code, the program code included in the remaining program code that is not mapped to the virtual space by the pre-start mapping unit, the pre-start mapping unit performs virtual processing by the pre-start mapping unit. A program execution method for mapping the execution code to a virtual space using the storage area information mapped to space ,
A program generation unit generates, as the execution program, a program including the part of the program code as text section data to be set in a text area for setting a program code among areas constituting a virtual space for executing the program And
The pre-start mapping unit converts the partial program code included in the execution program as the text section data into the text in the virtual space before the execution of the execution program generated by the program generation unit is started. Map to the area ,
The part of the program code includes the main function and a pointer rewriting function,
The pointer rewriting function designates the first area when the remaining program code is added to the text area as a first pointer for designating a first area located next to the text area. features and to Help program execution method that is a function of setting the address.
前記プログラム生成部は、仮想空間を構成する領域のうちプログラムに定義されたデータを設定するためのデータ領域に設定するデータセクションデータとして前記記憶領域情報を含むプログラムを前記実行プログラムとして生成し、
前記開始前マッピング部は、前記プログラム生成部によって生成された前記実行プログラムの実行が開始される前に、前記実行プログラムに前記データセクションデータとして含まれる前記記憶領域情報を仮想空間の前記データ領域にマッピングする
ことを特徴とする請求項記載のプログラム実行方法。
The program generation unit generates, as the execution program, a program including the storage area information as data section data to be set in a data area for setting data defined in the program among the areas constituting the virtual space,
The pre-start mapping unit stores the storage area information included in the execution program as the data section data in the data area of the virtual space before the execution of the execution program generated by the program generation unit is started. program execution method according to claim 1, wherein the mapping.
前記ポインタ書き換え関数が、前記テキスト領域と前記データ領域と前記第一の領域以外の第二の領域を指定するための第二のポインタに、前記実行プログラムに定義されたデータを前記データ領域に加えた場合の前記第二の領域を指定するアドレスを設定する関数である
ことを特徴とする請求項記載のプログラム実行方法。
The pointer rewriting function adds data defined in the execution program to the data area to a second pointer for designating the second area other than the text area, the data area, and the first area. 3. The program execution method according to claim 2 , wherein the program execution function is a function for setting an address for designating the second area.
前記プログラム実行部は、前記ポインタ書き換え関数を実行した後に前記メイン関数を実行する
ことを特徴とする請求項から請求項いずれかに記載のプログラム実行方法。
The program execution unit, a program execution method according to any claims 1 to 3, characterized in that performing the main function after performing the pointer rewrite function.
前記補助記憶装置がネットワークに接続された装置であることを特徴とする請求項から請求項いずれかに記載のプログラム実行方法。 Program execution method according to any one of claims 1 to 4, wherein said auxiliary storage device is a device connected to the network. 前記実行中マッピング部は、前記プログラム実行部によって第一の仮想空間を用いて前記実行プログラムが実行されると共に第二の仮想空間を用いて前記実行プログラムが実行される場合、前記第一の仮想空間を用いて実行される前記実行プログラムと前記第二の仮想空間を用いて実行される前記実行プログラムとが共有する第三の仮想空間に、前記残りのプログラムコードに含まれる少なくともいずれかのプログラムコードをマッピングすることを特徴とする請求項から請求項いずれかに記載のプログラム実行方法。 When the execution program is executed by using the first virtual space and the execution program is executed by using the second virtual space by the program execution unit, the executing mapping unit At least one program included in the remaining program code in a third virtual space shared by the execution program executed using the space and the execution program executed using the second virtual space program execution method according to any one claims 1 to 5, wherein the mapping the code. 前記プログラム生成部は、前記実行中マッピング部によってマッピングされた前記実行コードを前記一部のプログラムコードに含めて新たに前記実行プログラムを生成する
ことを特徴とする請求項から請求項いずれかに記載のプログラム実行方法。
The said program generation part includes the said execution code mapped by the said mapping part during execution in the said one part program code, and produces | generates the said execution program newly, The one of Claims 1-4 characterized by the above-mentioned. The program execution method described in 1.
実行プログラムの実行が開始される前に、前記実行プログラムのプログラムコードのうちメイン関数を含む一部のプログラムコードと、前記実行プログラムのプログラムコードのうち前記一部のプログラムコードを除いた残りのプログラムコードが記憶される補助記憶装置内の記憶領域を特定するための記憶領域情報と、を仮想空間にマッピングする開始前マッピング部と、
前記実行プログラムを実行するプログラム実行部と、
前記プログラム実行部が前記開始前マッピング部によって仮想空間にマッピングされていない前記残りのプログラムコードに含まれるプログラムコードを実行コードとして実行するときに、前記開始前マッピング部によって仮想空間にマッピングされた前記記憶領域情報を用いて前記実行コードを仮想空間にマッピングする実行中マッピング部と
プログラムを実行するための仮想空間を構成する領域のうちプログラムコードを設定するためのテキスト領域に設定するテキストセクションデータとして前記一部のプログラムコードを含むプログラムを前記実行プログラムとして生成するプログラム生成部とを備え、
前記開始前マッピング部は、前記プログラム生成部によって生成された前記実行プログラムの実行が開始される前に、前記実行プログラムに前記テキストセクションデータとして含まれる前記一部のプログラムコードを仮想空間の前記テキスト領域にマッピングし、
前記一部のプログラムコードが、前記メイン関数とポインタ書き換え関数とを含み、
前記ポインタ書き換え関数が、前記テキスト領域の隣に位置する第一の領域を指定するための第一のポインタに、前記残りのプログラムコードを前記テキスト領域に加えた場合の前記第一の領域を指定するアドレスを設定する関数である
ことを特徴とするプログラム実行装置。
Before execution of the execution program is started, a part of the program code of the execution program including a main function and a remaining program excluding the part of the program code of the execution program A storage area information for specifying a storage area in the auxiliary storage device in which the code is stored; and a pre-start mapping unit that maps the virtual space;
A program execution unit for executing the execution program;
When the program execution unit executes the program code included in the remaining program code that is not mapped to the virtual space by the pre-start mapping unit as the execution code, the pre-start mapping unit is mapped to the virtual space An executing mapping unit that maps the execution code to a virtual space using storage area information ;
A program generator for generating, as the execution program, a program including the part of the program code as text section data to be set in a text area for setting a program code in an area constituting a virtual space for executing the program; With
The pre-start mapping unit converts the partial program code included in the execution program as the text section data into the text in the virtual space before the execution of the execution program generated by the program generation unit is started. Map to the area,
The part of the program code includes the main function and a pointer rewriting function,
The pointer rewriting function designates the first area when the remaining program code is added to the text area as a first pointer for designating a first area located next to the text area. A program execution device characterized by being a function for setting an address to be executed.
請求項記載のプログラム実行装置としてコンピュータを機能させるためのプログラム実行プログラム。 A program execution program for causing a computer to function as the program execution device according to claim 8 . プログラム生成部が、仮想空間をコピーすると共に仮想空間に第二のプログラムのプログラムコードをマッピングするメイン関数を含むプログラムコードであるエントリポイントテキストと、前記第二のプログラムのプログラムコードが記憶される補助記憶装置内の記憶領域を特定するための記憶領域情報と、を含む第一のプログラムを生成する
ことを特徴とするプログラム生成方法。
An entry point text that is a program code including a main function for copying the virtual space and mapping the program code of the second program to the virtual space, and an auxiliary for storing the program code of the second program A program generation method comprising: generating a first program including storage area information for specifying a storage area in a storage device.
開始前マッピング部が、第二のプログラムの実行が開始される前に、仮想空間をコピーすると共に仮想空間に前記第二のプログラムのプログラムコードをマッピングするメイン関数を含むプログラムコードであるエントリポイントテキストと、前記第二のプログラムのプログラムコードが記憶される補助記憶装置内の記憶領域を特定するための記憶領域情報と、を含む第一のプログラムを仮想空間にマッピングし、
プログラム実行部が、前記第一のプログラムの前記メイン関数を実行することにより、前記第一のプログラム用の第一の仮想空間をコピーして第二の仮想空間を生成し、
前記プログラム実行部が、前記記憶領域情報を用いて前記第二のプログラムのプログラムコードを前記第二の仮想空間にマッピングし、
前記プログラム実行部が、前記第二の仮想空間を用いて前記第二のプログラムのプログラムコードを実行する
ことを特徴とするプログラム実行方法。
Entry point text that is a program code that includes a main function for the pre-start mapping unit to copy the virtual space and map the program code of the second program to the virtual space before the execution of the second program is started And mapping the first program to the virtual space, the storage area information for specifying the storage area in the auxiliary storage device in which the program code of the second program is stored,
By executing the main function of the first program, the program execution unit creates a second virtual space by copying the first virtual space for the first program,
The program execution unit maps the program code of the second program to the second virtual space using the storage area information,
The program execution method, wherein the program execution unit executes the program code of the second program using the second virtual space.
JP2013027249A 2013-02-15 2013-02-15 Program generation method, program execution method, program execution device, and program execution program Expired - Fee Related JP6103972B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2013027249A JP6103972B2 (en) 2013-02-15 2013-02-15 Program generation method, program execution method, program execution device, and program execution program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2013027249A JP6103972B2 (en) 2013-02-15 2013-02-15 Program generation method, program execution method, program execution device, and program execution program

Publications (2)

Publication Number Publication Date
JP2014157434A JP2014157434A (en) 2014-08-28
JP6103972B2 true JP6103972B2 (en) 2017-03-29

Family

ID=51578284

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2013027249A Expired - Fee Related JP6103972B2 (en) 2013-02-15 2013-02-15 Program generation method, program execution method, program execution device, and program execution program

Country Status (1)

Country Link
JP (1) JP6103972B2 (en)

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS63626A (en) * 1986-06-19 1988-01-05 Casio Comput Co Ltd Program managing device
JP2002222088A (en) * 2001-01-25 2002-08-09 Nec Corp System and method for compilation, and program

Also Published As

Publication number Publication date
JP2014157434A (en) 2014-08-28

Similar Documents

Publication Publication Date Title
US10761876B2 (en) Faster access of virtual machine memory backed by a host computing device&#39;s virtual memory
US10157268B2 (en) Return flow guard using control stack identified by processor register
JP5255348B2 (en) Memory allocation for crash dump
US8281293B2 (en) Copy-on-write optimization of immutable objects for objects oriented languages
US8832672B2 (en) Ensuring register availability for dynamic binary optimization
US9298472B2 (en) High-speed restart method, information processing device, and program
US10496534B2 (en) Manual memory management using lazy patching
US10296353B2 (en) Protecting basic input/output (BIOS) code
JP5778296B2 (en) Virtual computer system, virtualization mechanism, and data management method
JP5422652B2 (en) Avoiding self-eviction due to dynamic memory allocation in flash memory storage
JP2013520744A (en) Method and apparatus for generating minimum boot image
Tang et al. Exploring control flow guard in windows 10
CN104583948A (en) Layout and execution of operating systems using BPRAM
JP2022545012A (en) Data storage using flash order of memory aperture
JP2010086410A (en) Memory protection method, information processing apparatus, memory protection program and recording medium with memory protection program recorded thereon
JP2009020696A (en) Information proceing apparatus and system
US6782446B2 (en) Method to prevent corruption of page tables during flash EEPROM programming
US10496433B2 (en) Modification of context saving functions
CN113127263B (en) Kernel crash recovery method, device, equipment and storage medium
KR20110052902A (en) Computing system and method for controling memory of computing system
JP6103972B2 (en) Program generation method, program execution method, program execution device, and program execution program
JP2009020695A (en) Information processing apparatus and system
JP6691294B2 (en) Information processing apparatus, dynamic link program, and program restart method
US9110793B2 (en) Inner process
Du Protecting Applications on Real-time Embedded Systems from Control-flow Hijacking with Kage

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20151217

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20161025

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20161115

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20161214

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20170131

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20170228

R150 Certificate of patent or registration of utility model

Ref document number: 6103972

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

LAPS Cancellation because of no payment of annual fees