AT5729U1 - METHOD AND PROGRAM LOGIC FOR THE DYNAMICALLY REQUIRED ALLOCATION AND RELEASE OF MEMORY BLOCKS - Google Patents

METHOD AND PROGRAM LOGIC FOR THE DYNAMICALLY REQUIRED ALLOCATION AND RELEASE OF MEMORY BLOCKS Download PDF

Info

Publication number
AT5729U1
AT5729U1 AT0081500U AT8152000U AT5729U1 AT 5729 U1 AT5729 U1 AT 5729U1 AT 0081500 U AT0081500 U AT 0081500U AT 8152000 U AT8152000 U AT 8152000U AT 5729 U1 AT5729 U1 AT 5729U1
Authority
AT
Austria
Prior art keywords
memory
entry
application
section
allocation table
Prior art date
Application number
AT0081500U
Other languages
German (de)
Inventor
Peter Dipl Ing Hofbauer
Original Assignee
Kapsch Ag
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 Kapsch Ag filed Critical Kapsch Ag
Priority to AT0081500U priority Critical patent/AT5729U1/en
Publication of AT5729U1 publication Critical patent/AT5729U1/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/0223User address space allocation, e.g. contiguous or non contiguous base addressing
    • G06F12/023Free address space management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Memory System (AREA)

Abstract

Verfahren zum dynamisch angeforderten Zuteilen und Freigeben von Speicherblöcken (5) zu/von Applikationen, die jeweils zumindest zeitweise mehrere Speicherblöcke benötigen, im Rahmen eines Betriebssystems, das Speicherbereiche (1) für Speicherblöcke (5) zur Verfügung stellt, mit den Schritten: Zurverfügungstellen zumindest eines Speicherbereiches (1) für mehrere Speicherblöcke (5) durch das Betriebssystem an eine Applikation bei der Initialisierung derselben und Einrichten einer Zuteilungstabelle (7) für diesen Speicherbereich (1), die einen Eintrag (8) für jeden nicht von einem Speicherblock belegten zusammenhängenden Abschnitt (9) eines Speicherbereiches enthält, und, bei einer Anforderung einer Applikation nach Zuteilung eines Speicherblockes (5) bestimmter Größe, Durchsuchen der Zuteilungstabelle (7) nach einem Eintrag (8), der auf einen Abschnitt (9) mit zumindest der bestimmten Größe verweist, und Zuteilen dieses Abschnittes (9) als Speicherblock (5) und Löschen dieses Eintrages (8), sowie, bei einer Anforderung einer Applikation nach Freigabe eines bestimmten Speicherblockes (5), Erstellen eines Eintrages (8) für diesen Speicherblock (5) in der Zuteilungstabelle (7).Method for dynamically requesting allocation and release of memory blocks (5) to / from applications, each of which at least temporarily requires several memory blocks, within the framework of an operating system that provides memory areas (1) for memory blocks (5), with the steps: at least making them available a memory area (1) for a plurality of memory blocks (5) by the operating system to an application when initializing the same and setting up an allocation table (7) for this memory area (1) which has an entry (8) for each contiguous section not occupied by a memory block (9) contains a memory area and, when an application requests a memory block (5) of a certain size, search the allocation table (7) for an entry (8) which refers to a section (9) of at least the certain size , and allocating this section (9) as a memory block (5) and deleting this entry (8), and, when an application is requested after the release of a specific memory block (5), creating an entry (8) for this memory block (5) in the allocation table (7).

Description

       

   <Desc/Clms Page number 1> 
 



   Die vorliegende Erfindung betrifft ein Verfahren und eine Programmlogik zum dynamisch angeforderten Zuteilen und Freigeben von Speicherblöcken zu/von Applikationen, die jeweils zumindest zeitweise mehrere Speicherblöcke benötigen, im Rahmen eines Betriebssystems, das Speicherbereiche für Speicherblöcke zur Verfügung stellt. 



   Im allgemeinen stellen Betriebsysteme Routinen zur Verfügung, die dynamische Speicheranforderungen behandeln. Diese Routinen reagieren in der Praxis wegen diverser Verwaltungsmechanismen sehr langsam, so dass sie in zeitkritischen Applikationen nicht verwendet werden können. 



   Die Erfindung setzt sich zum Ziel, einen Speicherverwaltungsmechanismus zu schaffen, der es einer Applikationssoftware ("Benutzer") erlaubt, Speicherblöcke beliebiger Grösse ohne systembedingte Verzögerungen anzufordern. Dieses Ziel wird mit einem Verfahren der einleitend genannten Art erreicht, das die folgenden Schritte umfasst :

  
Zurverfügungstellen zumindest eines Speicherbereiches für mehrere Speicherblöcke durch das Betriebssystem an eine Applikation bei der Initialisierung derselben und
Einrichten einer Zuteilungstabelle für diesen Speicherbereich, die einen Eintrag für jeden nicht von einem Speicher- 

 <Desc/Clms Page number 2> 

 block belegten zusammenhängenden Abschnitt eines Speicherbereiches enthält, und, bei einer Anforderung einer Applikation nach Zuteilung eines Speicherblockes bestimmter Grösse, Durchsuchen der Zuteilungstabelle nach einem Eintrag, der auf einen Abschnitt mit zumindest der bestimmten Grösse verweist, und Zuteilen dieses Abschnittes als Speicherblock und Löschen dieses Eintrages, sowie, bei einer Anforderung einer Applikation nach Freigabe eines bestimmten Speicherblockes, Erstellen eines Eintrages für diesen Speicherblock in der Zuteilungstabelle. 



   Auf diese Weise wird ein Speicherverwaltungssystem geschaffen, das im dynamischen Betrieb äusserst geringe Antwortzeiten für Speicheranforderungen von als Benutzer auftretenden Applikationen aufweist. Eine Applikation fordert bei der Initialisierung einmal einen Speicherbereich vom Betriebssystem über Betriebsystemroutinen an, und dieser Speicherbereich wird anschliessend im dynamischen Betrieb mit Hilfe der applikationsspezifischen Zuteilungstabelle rasch und ökonomisch portioniert und verwaltet. 



   Eine bevorzugte Ausführungsform des erfindungsgemässen Verfahrens besteht darin, dass für einen Eintrag, der auf einen grösseren Abschnitt als für die bestimmte Grösse erforderlich verweist, für den die bestimmte Grösse übersteigenden Teil des Abschnittes ein neuer Eintrag eingerichtet oder der genannte Eintrag anstelle seiner Löschung modifiziert wird. Dadurch 

 <Desc/Clms Page number 3> 

 können auch allfällig verbleibende Lücken im Speicherbereich ausgenützt werden. Aus demselben Grund werden bevorzugt Einträge, die auf aneinandergrenzende Abschnitte verweisen, zu einem einzigen neuen Eintrag vereinigt, welcher auf die Vereinigung dieser Abschnitte verweist. 



   In jedem Fall ist es besonders günstig, wenn gemäss einem weiterem Merkmal der Erfindung bei jedem Erstellen, Löschen oder Modifizieren eines Eintrages die Einträge in der Zuteilungstabelle der Grösse ihrer Abschnitte nach sortiert werden und das Durchsuchen der Zuteilungstabelle dieser Grösse nach aufsteigen erfolgt. Dadurch kann das Durchsuchen der Zuteilungstabelle wesentlich vereinfacht werden. 



   Eine weitere vorteilhafte Variante des erfindungsgemässen Verfahrens für Betriebssysteme, die Speicherbereiche in Speicherseiten unterteilt zur Verfügung stellen, besteht darin, dass der Applikation vom Betriebssystem zusätzliche Speicherseiten für einen Speicherbereich zur Verfügung gestellt werden, wenn ein vorgegebenes erstes Kriterium für die Belegung ihrer Speicherseiten überschritten wird, und diese dem Betriebssystem retourniert werden, wenn ein vorgegebenes zweites Kriterium für die Belegung unterschritten wird. Auf diese Weise werden langsame Speicherverwaltungsroutinen des Betriebssystems im Hintergrund abgewickelt. Das System kann den sich ändernden Anforderungen der Applikationen Rechnung tragen, ohne die dynamischen Reaktionszeiten für die Applikation zu beeinträchtigen. 

 <Desc/Clms Page number 4> 

 



   Die Erfindung schafft ferner eine Programmlogik, die das genannte Verfahren implementiert. Zur Beschreibung des Ablaufs der Programmlogik wird auf die Verfahrensbeschreibung verwiesen. 



   Die Erfindung wird nachstehend anhand eines Ausführungsbeispieles unter Bezugnahme auf die Zeichnung näher beschrieben. In der Zeichnung zeigt Fig. 1 den vom Betriebssystem einer bestimmten Applikation zur Verfügung gestellten Speicherbereich in Form von zwei beispielhaften dargestellten Speicherseiten und Fig. 2 schematisch den Aufbau der Zuteilungstabelle für diesen Speicherbereich. 



   Eine Applikationssoftware (im   weiteren "Applikation" ge-   nannt) registriert sich zur Initialisierungszeit im Betriebssystem als "Benutzer" und erhält die nötigen Ressourcen sowie eine eindeutige Benutzerkennung zugewiesen. Sobald die Initialisierung abgeschlossen ist, können Applikationen zweierlei Anfragen stellen : 
 EMI4.1 
 wünschten Speicherblocks. 



     Rückgabeparameter :   Pointer auf einen Speicherblock. 



   2. Speicherrückgabe ("return") :
Eingangsparameter : Benutzerkennung und Pointer auf den zurückzugebenden Speicherblock. 



   Für den Aufbau der Datenstrukturen wird nun auf die Fig. 1 und 2 verwiesen. Das Betriebssystem stellt jeder Applikation 

 <Desc/Clms Page number 5> 

 einen Speicherbereich 1 zur Verfügung. Der Speicherbereich 1 kann in Speicherseiten ("pages") unterteilt sein, wie in der Technik bekannt. Zwei Speicherseiten 2,3 sind beispielhaft dargestellt. 



   Der Speicherbereich 1 wird zur Initialisierungszeit einer Applikation dieser zugewiesen. Optional können weitere Speicherseiten 2,3 dem Speicherbereich 1 einer Applikation im Zuge eines Hintergrundprozesses zugewiesen bzw. zurückgenommen werden, wie später noch beschrieben wird. 



   Die Speicherbereiche 1 sind in Zellen 4 konstanter Grösse aufgeteilt, um eine interne Verwaltung zu erleichtern. Die Grösse der Zellen 4 entspricht mindestens der durch das System vorgegebenen Grenze für Speicherzugriffe ("alignment") und beträgt beispielsweise 16 oder 32 bit. Eine Speicheranforderung, deren Grösse von der Applikation in Bit oder Byte angegeben wird, wird intern in eine Anzahl von Zellen 4 umgerechnet (aufgerundet). 



   Innerhalb des Speicherbereiches 1 werden der Applikation Speicherblöcke 5 zugeteilt, die jeweils aus mehreren Zellen 4 bestehen. Jeder Speicherblock 5 beginnt mit einer bestimmten Anzahl (z. B. 1 oder 2) von Kopfzellen ("header"), die einerseits die Anzahl der verwendbaren Zellen 4 innerhalb des Speicherblocks 5 und andererseits eine Kennung enthalten. Die Kopfzellen 4 können auch Informationen zur Behandlung des Speicherblockes durch Überprüfungsprogramme   ("audits")   enthalten. 

 <Desc/Clms Page number 6> 

 



   Für jeden Speicherbereich 1 wird eine Zuteilungstabelle 7 errichtet (Fig. 2). Die Zuteilungstabelle 7 enthält einen Eintrag 8 für jeden nicht von einem Speicherblock 5 belegten zusammenhängenden Abschnitt 9 im Speicherbereich 1. Wie ersichtlich, gibt es   z. B.   auch einen solchen Eintrag 8 für die unbelegte Speicherseite 2.

   Jeder Eintrag 8 der Zuteilungstabelle 7 umfasst die folgenden Elemente :
Einen Index 10, welcher die jeweilige Speicherseite
2,3 im Speicherbereich 1 kennzeichnet   ("l" steht   hier für den Speicherbereich 2   und "0" für   den Spei- cherbereich 3), eine Angabe 11 über die Anzahl der freien Zellen 4 des Abschnittes 9 ("Grösse"), einen Index 12, welcher auf die erste Zelle 4 des Ab- schnittes 9 verweist, und (zwecks Übersichtlichkeit) einen Index 13, welcher auf die letzte Zelle 4 des Abschnittes 9 verweist. 



   Die Einträge 8 sind zu jedem Zeitpunkt nach der Grösse 11 des Abschnittes 9, auf den sie verweisen, geordnet und werden nachsortiert, sobald eine Änderung erfolgt,   d. h.   ein Eintrag 8 erstellt, gelöscht oder modifiziert wird. 



   Der Ablauf einer Speicherzuteilung bzw. Speicherfreigabe zu/von einer Applikation ist wie folgt. 



   1. Zuteilung eines Speicherblockes ("get")
Die Zuteilungstabelle 7 wird, mit dem Eintrag 8 beginnend, der auf den kleinsten Abschnitt 9 verweist, nach jenem Eintrag 

 <Desc/Clms Page number 7> 

 8 durchsucht, der mindestens der von der Applikation gewünschten Grösse für einen Speicherblock 5 entspricht. Spätestens der Eintrag 8 am Ende der Zuteilungstabelle 7, welche auf die erste völlig freie Speicherseite 2 verweist, sollte diese Anforderung erfüllen. Ist ein passender Eintrag 8 gefunden, gibt es 
 EMI7.1 
 zellen) genau der angeforderten Grösse, oder, im allgemeinen Fall, die Anzahl der freien Zellen 4 übersteigt die angeforderte Grösse. 



   Im ersten Fall wird der Eintrag 8 in der Zuteilungstabelle 7 vollständig entfernt und die   darüberliegenden "kleineren"   Einträge 8 werden nachgerückt, um die Lücke zu füllen. 



   Im zweiten Fall wird aus den überschüssigen Zellen 4 ein neuer Abschnitt 9 und damit ein neuer Eintrag 8 gebildet. Zu diesem Zweck wird die Grösse 11 des bestehenden Eintrags 8 um das Ausmass der vergebenen Zellen 4 verringert (inklusive Kopfzelle), und der Index 12 des Eintrages 8 wird auf die Zellen 4 oberhalb des vergebenen Abschnittes 9 gesetzt. Anschliessend wird die Zuteilungstabelle 7 neu sortiert. 



   Falls die Anzahl der verbleibenden Zellen 4 kleiner oder gleich der vorgegebenen Anzahl von Kopfzellen ist, wird der Eintrag wie im ersten Fall gelöscht und der der Applikation zugewiesene Speicherblock 5 ist tatsächlich etwas grösser als angefordert   (z. B.   um etwa 1 oder 2 Zellen). 

 <Desc/Clms Page number 8> 

 



   An den Beginn des zugeteilten Speicherblockes 5 werden nun die nötigen Headerinformationen gestellt,   d. h.   die Kopfzellen 6 eingerichtet, und ein Pointer auf den nutzbaren Speicherbe- 
 EMI8.1 
 
Die Applikation übergibt einen Pointer auf den freizugebenden Speicherblock 5,   d. h.   auf die erste Zelle 4 nach den Kopfzellen 6. Anhand dieses Pointers werden der Index 12 des Speicherblockes 5 und daraus die Adresse der ersten Kopfzelle 6 berechnet. Da jede Speicherseite 2,3 ein Teil des Speicherbereiches 1 ist, ergibt sich der Index 12 aus dem übergebenen Pointer abzüglich des Pointers auf den Anfang der Speicherseite, geteilt durch die Grösse der Zellen 4, in der Einheit der Speicherpointer. 



   Die so gefundene erste Kopfzelle 6 enthält die Grösse des Speicherblockes 5, welche zu einem unbelegten Abschnitt 9 werden soll. Die ermittelte Grösse wird dazu benutzt, um an der entsprechenden Stelle in der Zuteilungstabelle 7 einen neuen oder modifizierten Eintrag 8 für den Abschnitt 9 zu erstellen. 



   Falls sich unmittelbar   ober-und/oder   unterhalb des frei gewordenen Abschnittes 9 weitere Abschnitte 9 befinden, werden alle Einträge 8, die auf diese Abschnitte 9 verweisen, zu einem   einzigen "grösseren" Eintrag   8 zusammengefasst. Solche allfällige angrenzende Abschnitte 9 werden über ihre Kopfzellen 6 

 <Desc/Clms Page number 9> 

 und/oder die Einträge 8 in der Zuteilungstabelle 7 identifiziert. 



   Für Grösse und Begrenzung dieses neuen bzw. modifizierten Eintrages 8 ergeben sich folgende Möglichkeiten :
1. Keiner der Einträge 8 verweist auf einen unmittelbar angrenzenden Abschnitt 9 :
Die Grösse 11 ist gleich dem frei gewordenen Abschnittes 9 (abzüglich Kopfzellen) und es wird ein neuer Eintrag 8 erzeugt. 



   2. Einer der Einträge 8 verweist auf einen unmittelbar ober- oder unterhalb angrenzenden Abschnitt 9 :
Die Grösse 11 ist gleich der Summe der Grössen der beiden benachbarten Abschnitte 9 (abzüglich eines Satzes von Kopfzellen 6). Es wird der für den angrenzenden Abschnitt 9 bestehende Eintrag 8 modifiziert (Grösse und untere/obere Begrenzung werden geändert). Die Zuteilungstabelle 7 wird neu sortiert. 



   3. Einer der Einträge 8 verweist auf einen unmittelbar oberhalb angrenzenden Abschnitt 9, ein anderer Eintrag 8 auf einen unmittelbar unterhalb angrenzenden Abschnitt 9 :
Die Grösse 11 ist gleich der Summe der Grössen aller drei Abschnitte 9 (abzüglich zweier Sätzen von Kopfzellen 6). Einer der beiden bestehenden Einträge 8 wird gelöscht und der andere wird wie unter Punkt 2 modifiziert. Zusätzlich zur Umsortierung des modifizierten Eintrages muss hier auch die Lücke 

 <Desc/Clms Page number 10> 

 in der Zuteilungstabelle 7 geschlossen werden, die der gelöschte Eintrag 8 hinterlassen hat. 



   Die Zusammenlegung von Einträgen 8 bei der Speicherblockrückgabe garantiert, dass die Gesamtzahl der Einträge 8 in der Zuteilungstabelle 7 gegenüber der Gesamtzahl vergebener Datenblöcke 5 gering bleibt. Damit bleibt auch der Zeitaufwand für das Einsortieren neuer/modifizierter Einträge 8 in vertretbaren Grenzen. 



   Zusätzlich zu den genannten Basisfunktionen der Speicherverwaltung   ("get"und"return")   können folgende Funktionen erfüllt werden :
1. Reservierung/Rückgabe weiterer Speicherseiten 2,3
Um Veränderungen in der Auslastung Rechnung zu tragen, kann in einem Hintergrundprozess stets zumindest eine zusätzliche Speicherseite 2,3 reserviert werden. Sobald diese Speicherseite (hier : die Speicherseite 2) durch eine Speicheranforderung angetastet wird (=erstes Kriterium), wird dem Hintergrundprozess der Auftrag zur Reservierung einer neuen Speicherseite erteilt.

   Die Anzahl der zu reservierenden Speicherseiten hängt vom ungünstigsten Fall des Verhältnisses zweier Zeitspannen   ab :   Einerseits der Zeit, die der Hintergrundprozess benötigt, um über Routinen des Betriebsystems eine Speicherseite zu reservieren, und andererseits der Zeit, die die Applikation minimal benötigt, um eine Speicherseite mit Speicherblöcken 5 vollständig zu füllen. Die Rückgabe von Spei-   cherseiten 2.   3 an das System   erfnlat     durch den Hintercrrund-   

 <Desc/Clms Page number 11> 

 prozess, sobald der letzte Speicherblock 5 einer Speicherseite 2,3 durch eine Speicherrückgabe vollständig frei wird (=zweites Kriterium). 



   2. Kontrollprozeduren   ("audits")  
Die vergebenen Speicherblöcke 5 können   z. B.   periodisch nach benutzerspezifischen Vorgaben überprüft werden. Diese Vorgaben sind beispielsweise eine zwangsweise Begrenzung der Lebensdauer der Speicherblöcke 5 oder Manipulationen daran nach bestimmten Kriterien. Die Art und das Ausmass der Eingriffe durch einen Audit werden bei der Registrierung der Applikation für alle ihr zugeteilten Speicherblöcke 5 festgelegt und schlagen sich auch in der Gestaltung der Kopfzellen 6 wieder. 



   Die nötigen Parameter für die Registrierung einer Applikation zur Initialisierungszeit des System ergeben sich damit wie folgt :
1. Grösse der Speicherblöcke 5 oder Speicherseiten 2, 3 : z. B. Auswahl aus einem begrenzten Wertebereich,   z. B.   klein, mittel, gross. 



   2. Anzahl der zur Sicherheit zu reservierenden Speicher- seiten 2,3 (im allgemeinen ein bis zwei). 



   3. Verhalten von Audits : In Form einer Prozedur, die vom
Audit für einen Speicherblock 5 nach bestimmten Kri- terien aufgerufen wird, oder anhand einer Auswahl festgelegter Verhaltensweisen. Die Kopfzellen 6 der
Speicherblöcke 5 können dazu entsprechende Informa- 

 <Desc/Clms Page number 12> 

 tionen enthalten (Lebensdauer, Art der Behandlung, usw.)
Die Erfindung ist selbstverständlich nicht auf die dargestellten Ausführungsformen beschränkt sondern umfasst alle Varianten, die in den Rahmen der angeschlossenen Ansprüche fallen.



   <Desc / Clms Page number 1>
 



   The present invention relates to a method and a program logic for the dynamically requested allocation and release of memory blocks to / from applications, each of which at least temporarily requires several memory blocks, within the scope of an operating system that provides memory areas for memory blocks.



   In general, operating systems provide routines that handle dynamic memory requests. In practice, these routines react very slowly due to various management mechanisms, so that they cannot be used in time-critical applications.



   The aim of the invention is to create a memory management mechanism which allows application software (“users”) to request memory blocks of any size without system-related delays. This goal is achieved with a procedure of the type mentioned in the introduction, which comprises the following steps:

  
Providing at least one memory area for several memory blocks by the operating system to an application during the initialization of the same and
Set up an allocation table for this storage area that does not have an entry for everyone from a storage

 <Desc / Clms Page number 2>

 contains a block-occupied contiguous section of a memory area, and, when an application requests an allocation of a memory block of a certain size, searching the allocation table for an entry which refers to a section of at least the certain size, and allocating this section as a memory block and deleting this entry , as well as, when an application is requested after the release of a specific memory block, an entry for this memory block is created in the allocation table.



   In this way, a memory management system is created which, in dynamic operation, has extremely short response times for memory requests from applications which appear as users. During initialization, an application requests a memory area from the operating system via operating system routines, and this memory area is then portioned and managed quickly and economically in dynamic operation using the application-specific allocation table.



   A preferred embodiment of the method according to the invention consists in that for an entry which refers to a larger section than is required for the specific size, a new entry is set up for the part of the section which exceeds the specific size or the entry mentioned is modified instead of being deleted. Thereby

 <Desc / Clms Page number 3>

 any remaining gaps in the storage area can also be exploited. For the same reason, entries that reference adjacent sections are preferably merged into a single new entry that refers to the union of these sections.



   In any case, it is particularly advantageous if, according to a further feature of the invention, each time an entry is created, deleted or modified, the entries in the allocation table are sorted according to the size of their sections and the allocation table is searched in ascending order of this size. This makes it much easier to search the allocation table.



   A further advantageous variant of the method according to the invention for operating systems which make memory areas available divided into memory pages consists in the application being made available to the application by the operating system additional memory pages for a memory area if a predetermined first criterion for the allocation of its memory pages is exceeded, and these are returned to the operating system if a predefined second criterion for the assignment is undershot. In this way, slow memory management routines of the operating system are processed in the background. The system can take into account the changing requirements of the applications without affecting the dynamic response times for the application.

 <Desc / Clms Page number 4>

 



   The invention also provides program logic that implements the aforementioned method. For a description of the sequence of the program logic, reference is made to the description of the method.



   The invention is described below using an exemplary embodiment with reference to the drawing. In the drawing, FIG. 1 shows the memory area made available by the operating system for a specific application in the form of two exemplary memory pages and FIG. 2 shows schematically the structure of the allocation table for this memory area.



   Application software (hereinafter referred to as "application") registers as a "user" in the operating system at initialization time and is assigned the necessary resources and a unique user ID. Once initialization is complete, applications can make two requests:
 EMI4.1
 wanted blocks of memory.



     Return parameters: pointer to a block of memory.



   2. Memory return ("return"):
Input parameters: user ID and pointer to the memory block to be returned.



   For the structure of the data structures, reference is now made to FIGS. 1 and 2. The operating system provides every application

 <Desc / Clms Page number 5>

 a memory area 1 available. The memory area 1 can be divided into pages as known in the art. Two memory pages 2, 3 are shown as examples.



   Memory area 1 is assigned to an application at the initialization time. Optionally, additional memory pages 2, 3 can be assigned to memory area 1 of an application or withdrawn as part of a background process, as will be described later.



   The memory areas 1 are divided into cells 4 of constant size in order to facilitate internal management. The size of the cells 4 corresponds at least to the limit for memory access ("alignment") specified by the system and is, for example, 16 or 32 bits. A memory request, the size of which is specified by the application in bits or bytes, is converted internally into a number of cells 4 (rounded up).



   Within the memory area 1, the application is allocated memory blocks 5, each consisting of several cells 4. Each memory block 5 begins with a certain number (eg 1 or 2) of header cells ("header"), which on the one hand contain the number of usable cells 4 within the memory block 5 and on the other hand contain an identifier. The head cells 4 can also contain information on the treatment of the memory block by checking programs (“audits”).

 <Desc / Clms Page number 6>

 



   An allocation table 7 is set up for each memory area 1 (FIG. 2). The allocation table 7 contains an entry 8 for each contiguous section 9 in the memory area 1 which is not occupied by a memory block 5. B. also such an entry 8 for the unused memory page 2.

   Each entry 8 of the allocation table 7 comprises the following elements:
An index 10, which is the respective memory page
2, 3 in storage area 1 ("l" stands for storage area 2 and "0" for storage area 3), an indication 11 about the number of free cells 4 of section 9 ("size"), an index 12, which refers to the first cell 4 of section 9, and (for the sake of clarity) an index 13, which refers to the last cell 4 of section 9.



   The entries 8 are at all times sorted according to the size 11 of the section 9 to which they refer and are sorted again as soon as a change occurs, i. H. an entry 8 is created, deleted or modified.



   The process of allocating or releasing memory to / from an application is as follows.



   1. Allocation of a memory block ("get")
The allocation table 7 is, starting with the entry 8, which refers to the smallest section 9, after that entry

 <Desc / Clms Page number 7>

 8 searched, which corresponds at least to the size desired by the application for a memory block 5. The entry 8 at the end of the allocation table 7, which refers to the first completely free memory page 2, should meet this requirement at the latest. If a suitable entry 8 is found, there is
 EMI7.1
 cells) exactly the requested size, or, in general, the number of free cells 4 exceeds the requested size.



   In the first case, the entry 8 in the allocation table 7 is completely removed and the overlying “smaller” entries 8 are moved in to fill the gap.



   In the second case, a new section 9 and thus a new entry 8 is formed from the excess cells 4. For this purpose, the size 11 of the existing entry 8 is reduced by the size of the allocated cells 4 (including the header cell), and the index 12 of the entry 8 is set on the cells 4 above the allocated section 9. The allocation table 7 is then re-sorted.



   If the number of remaining cells 4 is less than or equal to the specified number of header cells, the entry is deleted as in the first case and the memory block 5 assigned to the application is actually somewhat larger than requested (e.g. by about 1 or 2 cells) ,

 <Desc / Clms Page number 8>

 



   At the beginning of the allocated memory block 5, the necessary header information is now placed, i. H. the head cells 6 are set up, and a pointer to the usable memory area
 EMI8.1
 
The application transfers a pointer to the memory block 5 to be released, i. H. to the first cell 4 after the header cells 6. Using this pointer, the index 12 of the memory block 5 and from this the address of the first header cell 6 are calculated. Since each memory page 2, 3 is part of the memory area 1, the index 12 results from the pointer passed minus the pointer to the beginning of the memory page, divided by the size of the cells 4, in the unit of the memory pointer.



   The first header cell 6 found in this way contains the size of the memory block 5, which is to become an unoccupied section 9. The determined size is used to create a new or modified entry 8 for the section 9 at the corresponding location in the allocation table 7.



   If there are further sections 9 immediately above and / or below the section 9 that has become free, all the entries 8 that refer to these sections 9 are combined into a single “larger” entry 8. Any adjacent sections 9 of this type are connected via their head cells 6

 <Desc / Clms Page number 9>

 and / or the entries 8 in the allocation table 7 are identified.



   The following options exist for the size and limitation of this new or modified entry 8:
1. None of the entries 8 refers to an immediately adjacent section 9:
The size 11 is equal to the section 9 that has become free (minus head cells) and a new entry 8 is generated.



   2. One of the entries 8 refers to a section 9 immediately above or below:
The size 11 is equal to the sum of the sizes of the two adjacent sections 9 (minus a set of head cells 6). The entry 8 existing for the adjacent section 9 is modified (size and lower / upper limit are changed). The allocation table 7 is re-sorted.



   3. One of the entries 8 refers to a section 9 immediately above, another entry 8 to a section 9 immediately below:
The size 11 is equal to the sum of the sizes of all three sections 9 (minus two sets of head cells 6). One of the two existing entries 8 is deleted and the other is modified as in point 2. In addition to rearranging the modified entry, the gap must also be entered here

 <Desc / Clms Page number 10>

 be closed in the allocation table 7 that the deleted entry 8 has left.



   The combination of entries 8 when the memory block is returned guarantees that the total number of entries 8 in the allocation table 7 remains small compared to the total number of data blocks 5 allocated. This also keeps the time required for sorting new / modified entries 8 within reasonable limits.



   In addition to the basic functions of memory management ("get" and "return"), the following functions can be performed:
1. Reservation / return of additional storage pages 2,3
In order to take changes in the utilization into account, at least one additional memory page 2, 3 can always be reserved in a background process. As soon as this memory page (here: memory page 2) is touched by a memory request (= first criterion), the background process is instructed to reserve a new memory page.

   The number of memory pages to be reserved depends on the worst case of the relationship between two time periods: on the one hand, the time that the background process takes to reserve a memory page via routines of the operating system and, on the other hand, the time that the application requires minimally to store a memory page Fill memory blocks 5 completely. The return of memory pages 2. 3 to the system is carried out by the background

 <Desc / Clms Page number 11>

 Process as soon as the last memory block 5 of a memory page 2, 3 becomes completely free by returning memory (= second criterion).



   2. Control procedures ("audits")
The allocated memory blocks 5 can e.g. B. periodically checked according to user-specific specifications. These specifications are, for example, a compulsory limitation of the lifespan of the memory blocks 5 or manipulations thereon according to certain criteria. The type and the extent of the interventions by an audit are determined when the application is registered for all memory blocks 5 allocated to it and are also reflected in the design of the header cells 6.



   The parameters required for registering an application at system initialization time are as follows:
1. Size of the memory blocks 5 or memory pages 2, 3: z. B. Selection from a limited range of values, e.g. B. small, medium, large.



   2. Number of memory pages 2, 3 to be reserved for security (generally one to two).



   3. Behavior of audits: In the form of a procedure that is carried out by the
Audit for a memory block 5 is called up according to certain criteria, or based on a selection of defined behaviors. The head cells 6 of the
For this purpose, memory blocks 5 can

 <Desc / Clms Page number 12>

 ions included (lifespan, type of treatment, etc.)
The invention is of course not limited to the illustrated embodiments, but includes all variants that fall within the scope of the attached claims.


    

Claims (6)

Ansprüche 1. Verfahren zum dynamisch angeforderten Zuteilen und Freigeben von Speicherblöcken zu/von Applikationen, die jeweils zumindest zeitweise mehrere Speicherblöcke benötigen, im Rahmen eines Betriebssystems, das in Speicherseiten unterteilte Speicherbereiche für Speicherblöcke zur Verfügung stellt, gekennzeichnet durch die Kombination der an sich bekannten Schritte :  Expectations 1. A method for the dynamically requested allocation and release of memory blocks to / from applications, each of which at least temporarily requires several memory blocks, within the framework of an operating system which provides memory areas divided into memory pages for memory blocks, characterized by the combination of the steps known per se: Zurverfügungstellen zumindest eines Speicherbereiches (1) durch das Betriebssystem an eine Applikation bei der Initialisierung derselben, dynamisches Verwalten des Speicherbereiches (1) durch die Applikation selbst mittels Zuteilen und Freigeben von Speicherblöcken (5) aus dem Speicherbereich (1) zu und von der Applikation, und - Zurverfügungstellen von zusätzlichen Speicherseiten (2,3) durch das Betriebssystem an die Applikation, wenn ein vorgegebenes erstes Kriterium für die Belegung der Speicherseiten (2,3) überschritten wird, und diese dem Betriebssystem retourniert werden, wenn ein vorgegebenes zweites Kriterium für die Belegung unterschritten wird. <Desc/Clms Page number 14>    Providing at least one memory area (1) by the operating system to an application during the initialization thereof, dynamic management of the memory area (1) by the application itself by allocating and releasing memory blocks (5) from the memory area (1) to and from the application, and - making additional memory pages (2, 3) available to the application by the operating system if a predetermined first criterion for the allocation of the memory pages (2,3) is exceeded, and these are returned to the operating system if a predetermined second criterion for the Occupancy is undercut.  <Desc / Clms Page number 14>   2. Verfahren nach Anspruch 1, dadurch gekennzeichnet, dass die dynamische Verwaltung des Speicherbereiches (1) durch die Applikation selbst in an sich bekannter Weise mittels der folgenden Schritte erfolgt : Einrichten einer Zuteilungstabelle (7) für diesen Speicherbereich (1), die einen Eintrag (8) für jeden nicht von einem Speicherblock (5) belegten zusammenhängenden Abschnitt (9) eines Speicherbereiches enthält, und, bei einer Anforderung einer Applikation nach Zuteilung eines Speicherblockes (5) bestimmter Grösse, Durchsuchen der Zuteilungstabelle (7) nach einem Eintrag (8), der auf einen Abschnitt (9) mit zumindest der bestimmten Grösse verweist, und Zuteilen dieses Abschnittes (9) als Speicherblock (5) und Löschen dieses Eintrages (8), sowie, bei einer Anforderung einer Applikation nach Freigabe eines bestimmten Speicherblockes (5), Erstellen eines Eintrages (8)  2. The method according to claim 1, characterized in that the dynamic management of the memory area (1) by the application itself is carried out in a manner known per se using the following steps: Setting up an allocation table (7) for this memory area (1), which contains an entry (8) for each contiguous section (9) of a memory area not occupied by a memory block (5), and, when an application is requested, after allocation of a memory block ( 5) of a certain size, searching the allocation table (7) for an entry (8) which refers to a section (9) with at least the certain size, and allocating this section (9) as a memory block (5) and deleting this entry (8 ), and, when an application is requested after the release of a specific memory block (5), an entry (8) is created für diesen Speicherblock (5) in der Zuteilungstabelle (7).  for this memory block (5) in the allocation table (7). 3. Verfahren nach Anspruch 2, dadurch gekennzeichnet, dass für einen Eintrag (8), der auf einen grösseren Abschnitt (9) als für die bestimmte Grösse erforderlich verweist, für den die bestimmte Grösse übersteigenden Teil des Abschnittes (9) ein neuer Eintrag (8) eingerichtet oder der genannte Eintrag (8) anstelle seiner Löschung modifiziert wird.  3. The method according to claim 2, characterized in that for an entry (8) which refers to a larger section (9) than required for the specific size, for the part of the section (9) exceeding the specific size, a new entry ( 8) is set up or said entry (8) is modified instead of being deleted. 4. Verfahren nach Anspruch 2 oder 3, dadurch gekennzeichnet, dass Einträge (8), die auf aneinandergrenzende <Desc/Clms Page number 15> Abschnitte (9) verweisen, zu einem einzigen neuen Eintrag (8) vereinigt werden, welcher auf die Vereinigung dieser Abschnitte (9) verweist.  4. The method according to claim 2 or 3, characterized in that entries (8) on adjacent  <Desc / Clms Page number 15>  Sections (9) refer to be merged into a single new entry (8), which refers to the union of these sections (9). 5. Verfahren nach einem der Ansprüche 2 bis 4, dadurch gekennzeichnet, dass bei jedem Erstellen, Löschen oder Modifizieren eines Eintrages (8) die Einträge in der Zuteilungstabelle (7) der Grösse ihrer Abschnitte (9) nach sortiert werden und das Durchsuchen der Zuteilungstabelle (7) dieser Grösse nach aufsteigend erfolgt.  5. The method according to any one of claims 2 to 4, characterized in that each time an entry (8) is created, deleted or modified, the entries in the allocation table (7) are sorted according to the size of their sections (9) and the search of the allocation table (7) ascending in size. 6. Programmlogik, implementierend ein Verfahren nach einem der Ansprüche 1 bis 5.  6. Program logic implementing a method according to one of claims 1 to 5.
AT0081500U 2000-11-08 2000-11-08 METHOD AND PROGRAM LOGIC FOR THE DYNAMICALLY REQUIRED ALLOCATION AND RELEASE OF MEMORY BLOCKS AT5729U1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
AT0081500U AT5729U1 (en) 2000-11-08 2000-11-08 METHOD AND PROGRAM LOGIC FOR THE DYNAMICALLY REQUIRED ALLOCATION AND RELEASE OF MEMORY BLOCKS

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
AT0081500U AT5729U1 (en) 2000-11-08 2000-11-08 METHOD AND PROGRAM LOGIC FOR THE DYNAMICALLY REQUIRED ALLOCATION AND RELEASE OF MEMORY BLOCKS

Publications (1)

Publication Number Publication Date
AT5729U1 true AT5729U1 (en) 2002-10-25

Family

ID=3500358

Family Applications (1)

Application Number Title Priority Date Filing Date
AT0081500U AT5729U1 (en) 2000-11-08 2000-11-08 METHOD AND PROGRAM LOGIC FOR THE DYNAMICALLY REQUIRED ALLOCATION AND RELEASE OF MEMORY BLOCKS

Country Status (1)

Country Link
AT (1) AT5729U1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112860423A (en) * 2019-11-28 2021-05-28 深圳云天励飞技术有限公司 Video memory management method and related product

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112860423A (en) * 2019-11-28 2021-05-28 深圳云天励飞技术有限公司 Video memory management method and related product

Similar Documents

Publication Publication Date Title
DE60034170T2 (en) Protocol for coordinating the distribution of shared memory
DE69822935T2 (en) Apparatus and method for dynamically controlling resource allocation in a computer system
DE68927621T2 (en) Real time database
DE2131066C3 (en) Arrangement for addressing a table memory
DE69033064T2 (en) Procedure for assigning real pages to virtual pages with different page sizes
EP1228432B1 (en) Method for dynamic memory management
DE2431379B2 (en) Data processing device
DE2912738A1 (en) SYSTEM WITH DIRECT TRANSFER BETWEEN SUBSYSTEMS
DE102007015535A1 (en) Method for digital storage of data on a data storage with limited available storage space
DE1499182A1 (en) Electrical data processing system
DE3586447T2 (en) COMPRESSION OF BINARY NUMBERS FOR YOUR STORAGE.
DE2047062A1 (en) Method and device for measuring the effectiveness of a data processing system with a virtual address
DE2054941C2 (en) Arrangement for the selection of data sets
DE19933584A1 (en) Process for the compact presentation of information packets and their storage or transmission
DE2558417A1 (en) DATA PROCESSING SYSTEM
DE10120615B4 (en) Dynamic memory management for objects of different sizes
DE19905541B4 (en) A method of controlling memory access in a machine having a non-uniform memory and a machine for performing such method
DE2062164A1 (en) Method for generating a multi-level index for stored data units
AT5729U1 (en) METHOD AND PROGRAM LOGIC FOR THE DYNAMICALLY REQUIRED ALLOCATION AND RELEASE OF MEMORY BLOCKS
DE102008000649B4 (en) Memory management device and method for this
EP2102766A1 (en) Method for reading out data from a storage medium
WO1998049622A1 (en) Chip card with memory access maximisation and logging
DE69226683T2 (en) Method for efficient access of data in a link table
DE69217408T2 (en) Method and apparatus for message selection which can be used by a local unit connected to a digital transmission system
EP1325412B1 (en) Method for accessing a memory unit in which sequences of notes are stored, corresponding memory unit and corresponding program

Legal Events

Date Code Title Description
MN9K Cancelled due to lapse of time