DE102016214584A1 - Method and device for time control in a system - Google Patents
Method and device for time control in a system Download PDFInfo
- Publication number
- DE102016214584A1 DE102016214584A1 DE102016214584.3A DE102016214584A DE102016214584A1 DE 102016214584 A1 DE102016214584 A1 DE 102016214584A1 DE 102016214584 A DE102016214584 A DE 102016214584A DE 102016214584 A1 DE102016214584 A1 DE 102016214584A1
- Authority
- DE
- Germany
- Prior art keywords
- procedure
- priority
- priority request
- following features
- hypervisor
- 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.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/48—Program initiating; Program switching, e.g. by interrupt
- G06F9/4806—Task transfer initiation or dispatching
- G06F9/4812—Task transfer initiation or dispatching by interrupt, e.g. masked
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Pharmaceuticals Containing Other Organic And Inorganic Compounds (AREA)
Abstract
Verfahren (10) zur Zeitablaufsteuerung in einem System, gekennzeichnet durch folgende Merkmale: – ein Prozess in dem System (20) legt eine Prioritätsanforderung (11) in dem Direktzugriffsspeicher ab, – wird eine Unterbrechung des Prozesses angefordert, so liest das System (20) die Prioritätsanforderung (11) aus dem Direktzugriffsspeicher aus (12) und – abhängig (13) von der Prioritätsanforderung (11) behandelt (14) oder unterdrückt (15) das System (20) fallweise (Y, N) die Unterbrechung.Method (10) for scheduling in a system, characterized by the following features: a process in the system (20) stores a priority request (11) in the random access memory, - if an interruption of the process is requested, the system (20) reads the priority request (11) from the random access memory (12) and dependent (13) from the priority request (11) handles (14) or suppresses (15) the system (20) case by case (Y, N) the interruption.
Description
Die vorliegende Erfindung betrifft ein Verfahren zur Zeitablaufsteuerung in einem System. Die vorliegende Erfindung betrifft darüber hinaus eine entsprechende Vorrichtung, ein entsprechendes Computerprogramm sowie ein entsprechendes Speichermedium.The present invention relates to a method for timing control in a system. The present invention also relates to a corresponding device, a corresponding computer program and a corresponding storage medium.
Stand der TechnikState of the art
In der Betriebssystemtheorie wird die Zuteilung von Verarbeitungszeit an verschiedene Prozesse – in einigen Betriebssystemen auch Aufgaben (tasks) genannt – als Zeitablaufsteuerung (scheduling) bezeichnet. Eine Herausforderung der Zeitablaufsteuerung liegt darin, dass die benötigten Betriebsmittel für einzelne Prozesse nicht vor deren Ausführung bekannt sind. Es lässt sich also im Allgemeinen kein optimaler Zeitablauf vorab bestimmen, sondern die Zeitablaufsteuerung muss auf veränderliche Anforderungen zur Laufzeit reagieren. Dabei können verschiedene Zuteilungsstrategien zum Einsatz kommen. Ein nach dem Stand der Technik häufig zur Zeitablaufsteuerung angewendetes Verfahren ist das sogenannte Prioritätsscheduling, das jedem Prozess eine Priorität zuweist und jeweils den lauffähigen Prozess mit der höchsten Priorität im System zur Ausführung bringt.In operating system theory, the allocation of processing time to various processes - also called tasks in some operating systems - is referred to as scheduling. One challenge of timing control is that the resources required for individual processes are not known prior to their execution. In general, therefore, it is not possible to predetermine an optimal timing in advance, but the timing control has to react to changing requirements at runtime. Different allocation strategies can be used. One prior art technique often used for scheduling is so-called priority scheduling, which prioritizes each process and each executes the highest priority executable process in the system.
Offenbarung der ErfindungDisclosure of the invention
Die Erfindung stellt ein Verfahren zur Zeitablaufsteuerung in einem System, eine entsprechende Vorrichtung, ein entsprechendes Computerprogramm sowie ein maschinenlesbares Speichermedium gemäß den unabhängigen Ansprüchen bereit.The invention provides a method for scheduling in a system, a corresponding device, a corresponding computer program and a machine-readable storage medium according to the independent claims.
Ein Vorzug dieser Lösung liegt in der verbesserten Effizienz des Anwendercodes beim Setzen von Prioritäten in Betriebssystemen und Hypervisors für den Fall, dass Betriebssystem oder Hypervisor den Anwendercode in einem nichtprivilegierten Modus ausführen, in welchem der Code das Betriebssystem bzw. den Hypervisor ersuchen muss, die Priorität zu wechseln, und dass Prioritätswechsel im Hinblick auf bestimmte Operationen wie Sperrung und Behandlung von Unterbrechungen (interrupt handling) sehr häufig auftreten.A merit of this approach is the improved efficiency of the user code in prioritizing operating systems and hypervisors in the event that the operating system or hypervisor is to execute the user code in a nonprivileged mode in which the code must request the operating system or hypervisor and that priority switching occurs very frequently with respect to certain operations such as interrupt handling and interrupt handling.
Dem vorgeschlagenen Ansatz liegt die Erkenntnis zugrunde, dass ein eingebettetes Betriebssystem oder ein entsprechender Hypervisor häufig eine Unterscheidung zwischen zwei Modi vornimmt: einem privilegierten und einem nichtprivilegierten Modus. Im nichtprivilegierten Modus ist es Code typischerweise verboten, die Priorität des Prozessors zu ändern. Wenn ein solcher Anwendercode wünscht, die Priorität zu ändern, dann stellt er eine Anforderung an das Betriebssystem oder den Hypervisor, das bzw. der dann den Wechsel vor dem Rücksprung durchführt. Dieser Mechanismus gemäß dem Schema „Anfrage-Prioritätswechsel-Rücksprung“ bindet im Vergleich zu einem bloßen Prioritätswechsel oft deutlich mehr Betriebsmittel. Jedoch ist er typischerweise der einzig verfügbare Mechanismus und muss somit verwendet werden.The proposed approach is based on the recognition that an embedded operating system or a corresponding hypervisor often makes a distinction between two modes: a privileged mode and a nonprivileged mode. In nonprivileged mode, code is typically forbidden to change the priority of the processor. If such a user code wishes to change the priority, then it makes a request to the operating system or hypervisor, which then performs the change before the return. This mechanism according to the scheme "request-priority-change-return" often binds significantly more resources compared to a mere change of priorities. However, it is typically the only available mechanism and thus must be used.
Der Prioritätswechselmechanismus wird typischerweise verwendet, um kritische Abschnitte im Benutzercode zu implementieren. Wenn Daten (oder ein bestimmtes Gerät) vor gleichzeitigem Zugriff geschützt werden müssen, wird die Priorität angehoben, um andere Abschnitte des Codes an der Ausführung zu hindern, auf die Daten oder das Gerät wird zugegriffen und dann wird die Priorität wiederhergestellt. So muss jeder kritische Abschnitt die Priorität mindestens zweimal ändern.The priority switching mechanism is typically used to implement critical sections in user code. If data (or a particular device) needs to be protected from concurrent access, the priority is raised to prevent other portions of the code from executing, the data or device is accessed, and then priority is restored. So every critical section needs to change the priority at least twice.
Gleichzeitige Zugriffe erfolgen in der Regel aufgrund von Unterbrechungsroutinen (interrupt handler, interrupt service routine, ISR). Die Anhebung der Priorität des Prozessors beschränkt die Unterbrechungen, die in den kritischen Abschnitten auftreten können.Simultaneous accesses are usually based on interrupt routines (interrupt service routine, ISR). Increasing the priority of the processor limits the disruptions that can occur in the critical sections.
In einigen Anwendungen treten kritische Abschnitte selten auf, und so können die Kosten für den beschriebenen Anfrage-Prioritätswechsel-Rücksprung-Mechanismus akzeptiert werden. Jedoch umfassen andere Anwendungen kritische Abschnitte, die viele tausend Mal pro Sekunde ausgeführt werden – viel öfter als die Unterbrechungen, gegen die sie sich schützen. In diesen Fällen können, wenn der Code (zum Beispiel aus Sicherheitsgründen) von einem privilegierten System zu einem nichtprivilegierten System migriert wird, die zusätzlichen Mehraufwände inakzeptabel werden, weil ein erheblicher Teil der verfügbaren Prozessorkapazität benötigt wird.In some applications, critical sections rarely occur, and thus the cost of the described request-priority-change-return mechanism can be accepted. However, other applications include critical sections that are executed many thousands of times per second - much more often than the interruptions they protect against. In these cases, if the code is migrated from a privileged system to a nonprivileged system (for security, for example), the additional overhead can become unacceptable because a significant portion of the available processor capacity is needed.
Ein erfindungsgemäßes Verfahren stellt daher einen Mechanismus bereit, der es nichtprivilegiertem Code ermöglicht, die Priorität in Systemen sehr schnell zu ändern, in denen die Anzahl der kritischen Abschnitte (und somit die Zahl der Prioritätswechsel) viel höher ist als die Anzahl der Unterbrechungen.A method according to the invention therefore provides a mechanism that allows nonprivileged code to quickly change the priority in systems where the number of critical ones is high Sections (and thus the number of priority changes) is much higher than the number of interrupts.
Durch die in den abhängigen Ansprüchen aufgeführten Maßnahmen sind vorteilhafte Weiterbildungen und Verbesserungen des im unabhängigen Anspruch angegebenen Grundgedankens möglich. So kann vorgesehen sein, dass beim Unterdrücken einer Unterbrechung das System einen Statusindikator (flag) im Direktzugriffsspeicher (random access memory, RAM) des Systems setzt. Sobald der Prozess die Prioritätsanforderung löscht, führt er in dieser Ausführungsform eine Abfrage des Statusindikators aus. Im gewöhnlichen Fall wird, da der Eintritt in den und Austritt aus dem kritischen Abschnitt das Auftreten von Unterbrechungen dominieren, der diesbezügliche Code sehr schnell sein und lediglich folgende Laufzeitanweisungen ausführen: das Setzen einer Variablen im RAM beim Eintritt und das Rücksetzen der Variablen im RAM gefolgt von der negativen Prüfung einer weiteren Booleschen Variablen beim Austritt.The measures listed in the dependent claims advantageous refinements and improvements of the independent claim basic idea are possible. Thus, it can be provided that when suppressing an interruption, the system sets a status indicator (flag) in the random access memory (RAM) of the system. As soon as the process deletes the priority request, it executes a query of the status indicator in this embodiment. In the ordinary case, since the entry into and exit from the critical section will dominate the occurrence of interrupts, the code involved will be very fast and will only execute the following runtime instructions: setting a variable in RAM upon entry and resetting the variables in RAM from the negative check of another Boolean variable on exit.
Gemäß einem weiteren Aspekt kann für den Fall, dass der Statusindikator bei der Abfrage gesetzt ist, vorgesehen sein, dass der Prozess das System aufruft und letzteres die unterdrückte Unterbrechung behandelt sowie den Statusindikator aus dem Direktzugriffsspeicher löscht. Im ungewöhnlichen Fall, dass eine Unterbrechung in einem kritischen Abschnitt eintritt, entstehen somit zusätzliche Mehraufwände im Code der Unterbrechungsroutine und jenem für den Austritt aus dem kritischen Abschnitt, da die Prüfung der Booleschen Variablen positiv verläuft und ein Abfangen (trap) durch das Betriebssystem oder Hypervisor einen gewissen systeminternen Rechenaufwand verursacht. Da jedoch dieser Fall sehr selten eintritt, sollten besagte Mehraufwände akzeptabel sein.According to a further aspect, in the event that the status indicator is set at the query, it may be provided that the process calls the system and the latter handles the suppressed interrupt and deletes the status indicator from random access memory. Thus, in the unusual case that a break occurs in a critical section, additional overhead in the interrupt routine code and the critical section exit code arises because the Boolean variable check is positive and a trap by the operating system or hypervisor caused a certain system-internal computational effort. However, since this case occurs very rarely, said additional expenses should be acceptable.
Kurze Beschreibung der ZeichnungenBrief description of the drawings
Ausführungsbeispiele der Erfindung sind in den Zeichnungen dargestellt und in der nachfolgenden Beschreibung näher erläutert. Es zeigt:Embodiments of the invention are illustrated in the drawings and explained in more detail in the following description. It shows:
Ausführungsformen der ErfindungEmbodiments of the invention
Hinsichtlich der Speicherkonfiguration der Umsetzung sei angenommen, dass der privilegierte Code (des Betriebssystems oder Hypervisors) und jedweder nichtprivilegierte Code ein RAM gemeinsam nutzen, das für alle Prozesse lesbar und beschreibbar ist. Zumindest zwei Variablen werden in diesem RAM verwaltet: die Prioritätsanforderung (
Um die Priorität zu erhöhen, schreibt der nichtprivilegierte Code die neue Prioritätsanforderung (
Sollte eine Unterbrechung auftreten, während die beanspruchte Priorität erhöht ist, so vollzieht das Programm, das als Schnittstelle zur Unterbrechungsroutine dient (wrapper) und somit vor der Unterbrechungsroutine ausgeführt wird, folgende Schritte: Es überprüft (Schritt
Wenn die Unterbrechung hingegen nicht erlaubt ist (Zweig N), dann wird die Priorität des Prozessors gemäß der Prioritätsanforderung (
Eine Senkung der Unterbrechungspriorität erfolgt in zwei Schritten: Die neue Prioritätsanforderung (
Auf diese Trap-Anweisung löscht das Betriebssystem oder der Hypervisor, das bzw. der zuvor vermerkt hatte, welche Unterbrechung unterdrückt wurde, den Vermerk der anstehenden Unterbrechung, leitet die gespeicherte Unterbrechungsanforderung an die Unterbrechungsroutine weiter und kehrt zum aufrufenden Prozess zurück.Upon this trap instruction, the operating system or hypervisor that had previously noted which interrupt has been suppressed clears the pending interrupt indication, forwards the stored interrupt request to the interrupt routine, and returns to the calling process.
Ausgestaltungen des beschriebenen Systems können für eine Vielzahl von Umständen vorgenommen werden. So mag der „Prioritätsraum“ einer bestimmten virtuellen Maschine (virtual machine, VM), Aufgabe oder Unterbrechungsroutine aus zwei diskreten Werten bestehen (Unterbrechungen aktiviert oder deaktiviert), die einen zusammenhängenden Wertebereich gleichsam maskieren, oder unmittelbar aus einem zusammenhängenden Wertebereich (zum Beispiel jenem der ganzen Zahlen von 0 bis 15). Dieses Konzept funktioniert gleichermaßen gut in Systemen mit zwei oder mehr vom Prioritätsraum umfassten Werten.
- 1. In einem Betriebssystem etwa mögen die Aufgaben und Unterbrechungsroutinen Zugriff auf den gesamten Prioritätsraum haben. Ein typisches kraftfahrzeugtechnisches Betriebssystem offener Architektur (automotive open system architecture, AUTOSAR) – obgleich das vorliegende Konzept nicht auf ein solches beschränkt ist – ermöglicht ausgewählten Funktionseinheiten den Betrieb in einem nichtprivilegierten Modus, in welchem der Eintritt in kritische Abschnitte aufwändig und ein Zugriff auf das gesamte Spektrum der Prioritäten erforderlich ist.
- 2. In einem Hypervisor ist das Spektrum der Prioritäten, auf welche eine (ein Gast-Betriebssystem oder eine Anwendung ausführende) VM Zugriff hat, typischerweise auf eine Teilmenge des durch den Prozessor zur Verfügung gestellten Spektrums begrenzt.
a. In dem Fall, dass nur Aktivieren und Deaktivieren unterstützt werden, obliegt es dem Hypervisor, die Prioritätsanforderung (
11 ) in einen zum Unterdrücken von Unterbrechungen geeigneten Wert aus dem zusammenhängenden Bereich umzusetzen. b. In dem Fall, dass ein zusammenhängender Wertebereich unmittelbar zur Verfügung steht, prüft der Hypervisor die Gültigkeit der Prioritätsanforderung (11 ) erst, wenn die Ausführung an den Hypervisor übergeben wird.
- 1. In an operating system, for example, the tasks and interrupt routines may have access to the entire priority space. A typical automotive open system architecture (AUTOSAR) - although not limited to the present concept - allows selected functional units to operate in a nonprivileged mode in which entry into critical sections is laborious and access to the entire Range of priorities is required.
- 2. In a hypervisor, the range of priorities to which a VM (executing a guest operating system or application) has access is typically limited to a subset of the spectrum provided by the processor. a. In the case that only enable and disable are supported, it is up to the hypervisor to fulfill the priority request (
11 ) into a value suitable for suppressing interruptions from the contiguous area. b. In the event that a contiguous range of values is immediately available, the hypervisor checks the validity of the priority request (11 ) only when the execution is passed to the hypervisor.
Dieses Verfahren (
ZITATE ENTHALTEN IN DER BESCHREIBUNG QUOTES INCLUDE IN THE DESCRIPTION
Diese Liste der vom Anmelder aufgeführten Dokumente wurde automatisiert erzeugt und ist ausschließlich zur besseren Information des Lesers aufgenommen. Die Liste ist nicht Bestandteil der deutschen Patent- bzw. Gebrauchsmusteranmeldung. Das DPMA übernimmt keinerlei Haftung für etwaige Fehler oder Auslassungen.This list of the documents listed by the applicant has been generated automatically and is included solely for the better information of the reader. The list is not part of the German patent or utility model application. The DPMA assumes no liability for any errors or omissions.
Zitierte PatentliteraturCited patent literature
- DE 19744230 A [0003] DE19744230A [0003]
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
DE102016214584.3A DE102016214584A1 (en) | 2016-08-05 | 2016-08-05 | Method and device for time control in a system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
DE102016214584.3A DE102016214584A1 (en) | 2016-08-05 | 2016-08-05 | Method and device for time control in a system |
Publications (1)
Publication Number | Publication Date |
---|---|
DE102016214584A1 true DE102016214584A1 (en) | 2018-02-08 |
Family
ID=60996382
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
DE102016214584.3A Pending DE102016214584A1 (en) | 2016-08-05 | 2016-08-05 | Method and device for time control in a system |
Country Status (1)
Country | Link |
---|---|
DE (1) | DE102016214584A1 (en) |
Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
DE19744230A1 (en) | 1997-10-07 | 1999-04-08 | Bosch Gmbh Robert | Control system with variable priority e.g. for vehicle IC engine or transmission |
-
2016
- 2016-08-05 DE DE102016214584.3A patent/DE102016214584A1/en active Pending
Patent Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
DE19744230A1 (en) | 1997-10-07 | 1999-04-08 | Bosch Gmbh Robert | Control system with variable priority e.g. for vehicle IC engine or transmission |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
DE102015002191A1 (en) | Security hypervisor function | |
EP1794680A1 (en) | Method for running a computer program on a computer system | |
DE112019005584T5 (en) | ARITHMETIC CONTROL DEVICE | |
DE102014103139B4 (en) | Parallelized execution of single-core control software on multi-core vehicle control units | |
DE112015007104T5 (en) | Data processing apparatus, data processing method and data processing program | |
DE102004057490B4 (en) | Device and method for processing a program code | |
WO2006032585A1 (en) | Method for executing a computer program on a computer system | |
DE112012004468B4 (en) | Application-level speculative processing | |
DE102015100566A1 (en) | Method and light mechanism for mixed critical applications | |
DE102016214584A1 (en) | Method and device for time control in a system | |
DE102013202961A1 (en) | Method for monitoring stack memory in operating system of control unit of motor vehicle, involves carrying out predefined action if characteristic parameters of stack memory before and after execution of program codes are not identical | |
DE102016224206A1 (en) | VEHICLE CONTROL DEVICE | |
DE102015211458A1 (en) | A method and apparatus for securing a program counter structure of a processor system and for monitoring the handling of an interrupt request | |
WO2015177226A1 (en) | Method for creating a hypervisor unit for embedded systems | |
DE102005037216A1 (en) | Method and device for controlling a computer system | |
WO2024046731A1 (en) | Method for the computer-supported restricting of persistent memory for a container-based application | |
DE102016219202A1 (en) | Method and device for protecting a working memory | |
DE102019216226A1 (en) | Method for operating a computing system and computing system | |
WO2023066627A1 (en) | Prioritizing access by a container instance to a file in a file system resource | |
DE102016206592A1 (en) | Method and device for securing a one-chip system | |
WO2023099132A1 (en) | Method for enforcing integrity conditions of a first container-based application | |
DE102013005971B3 (en) | Malware secure data processing system | |
DE102020210375A1 (en) | Method for creating an executable program code for software from a source code | |
DE102015218386A1 (en) | A method and apparatus for monitoring a program flow of a processor executable program and processor device | |
WO2023134910A1 (en) | Automatic, security-induced relocation of at least one container instance |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
R012 | Request for examination validly filed |