• Navigation überspringen
  • Zur Navigation
  • Zum Seitenende
Organisationsmenü öffnen Organisationsmenü schließen
Friedrich-Alexander-Universität Lehrstuhl für Informatik 4 (Systemsoftware)
  • FAUZur zentralen FAU Website
  1. Friedrich-Alexander-Universität
  2. Technische Fakultät
  3. Department Informatik
Suche öffnen
  • English
  • Campo
  • StudOn
  • FAUdir
  • Stellenangebote
  • Lageplan
  • Hilfe im Notfall
  1. Friedrich-Alexander-Universität
  2. Technische Fakultät
  3. Department Informatik
Friedrich-Alexander-Universität Lehrstuhl für Informatik 4 (Systemsoftware)
Menu Menu schließen
  • Lehrstuhl
    • Team
    • Aktuelles
    • Kontakt und Anfahrt
    • Leitbild
    • 50-jähriges Jubiläum
    Portal Lehrstuhl
  • Forschung
    • Forschungsbereiche
      • Betriebssysteme
      • Confidential Computing
      • Embedded Systems Software
      • Verteilte Systeme
    • Projekte
      • AIMBOS
      • BALu
      • BFT2Chain
      • DOSS
      • Mirador
      • NEON
      • PAVE
      • ResPECT
      • Watwa
    • Projektkampagnen
      • maRE
    • Seminar
      • Systemsoftware
    Portal Forschung
  • Publikationen
  • Lehre
    • Sommersemester 2025
      • Applied Software Architecture
      • Ausgewählte Kapitel der Systemsoftware
      • Betriebssystemtechnik
      • Projekt angewandte Systemsoftwaretechnik
      • System-Level Programming
      • Systemnahe Programmierung in C
      • Systemprogrammierung 1
      • Verteilte Systeme
    • Wintersemester 2025/26
      • Systemprogrammierung 2
      • Betriebssysteme
      • Middleware – Cloud Computing
      • Echtzeitsysteme
      • Virtuelle Maschinen
      • Web-basierte Systeme
      • Projekt angewandte Systemsoftwaretechnik
      • Aktuelle Entwicklung in Verteilten und Objektorientierten Betriebssystemen (für Bachelor-/Masterarbeit)
    Portal Lehre
  • Examensarbeiten
  1. Startseite
  2. Extern

Extern

Bereichsnavigation: Lehre
  • Betriebssysteme
    • Vorlesung
      • Folien
    • Übung
      • Seminar
      • Aufgaben
      • Aufgabe 0: C++ Streams
        • Aufgabe 1: Ein-/Ausgabe
          • Aufgabe 2: Unterbrechungen
            • Aufgabe 3: Pro-/Epilog
              • Aufgabe 4: Kontextwechsel
                • Aufgabe 5: Zeitscheiben
                  • Aufgabe 6: Synchronisation
                    • Assembler Crashkurs
                      • C++ Crashkurs
                        • Entwicklungsumgebung
                          • FAQ
                            • Ruhmeshalle

                          Aufgabe 6: Synchronisation

                          Classes | Functions
                          Context Switch

                          Low-Level functionality required for context switching. More...

                          Classes

                          struct  StackPointer
                           Structure for saving the stack pointer when switching coroutines. More...
                           

                          Functions

                          void * prepareContext (void *tos, void(*kickoff)(void *), void *param1=nullptr)
                           Prepares a context for its first activation. More...
                           
                          void context_switch (StackPointer &current, StackPointer &next)
                           Executes the context switch. More...
                           

                          Detailed Description

                          Low-Level functionality required for context switching.


                          Class Documentation

                          struct StackPointer

                          Structure for saving the stack pointer when switching coroutines.

                          Class Members
                          void * kernel Current kernel stack pointer of the thread.

                          Function Documentation

                          void * prepareContext ( void *  tos,
                          void(*)(void *)  kickoff,
                          void *  param1 = nullptr 
                          )

                          Prepares a context for its first activation.

                          To allow the execution to start in Thread::kickoff during the first activation, the stack must be initialized such that it contains all the information required. This is, most importantly, the function to be called (typically the respective implementation of Thread::kickoff) and any parameters required by this function.

                          prepareContext() can be implemented in the high-level programming language C++ (in file context.cc).

                          Parameters
                          tosPointer to the top of stack (= address of first byte beyond the memory reserved for the stack)
                          kickoffPointer to the Thread::kickoff function
                          param1first parameter for Thread::kickoff function
                          Returns
                          Pointer to the latest data (which will be popped first) on the prepared stack
                          void context_switch ( StackPointer &  current,
                          StackPointer &  next 
                          )

                          Executes the context switch.

                          For a clean context switch, the current register values must be stored to the currently active stack and the stack pointer must be stored to the current StackPointer structure. Subsequently, these values must be restored accordingly from the next stack.

                          This function must be implemented in assembler in the file context.asm. It must be declared as extern "C", as assembler functions are not C++ name mangled.

                          Parameters
                          currentPointer to the structure that the current stack pointer will be stored in
                          nextPointer to the structure that the next stack pointer will be read from
                          Friedrich-Alexander-Universität
                          Erlangen-Nürnberg

                          Schlossplatz 4
                          91054 Erlangen
                          • Impressum
                          • Datenschutz
                          • Barrierefreiheit
                          • Facebook
                          • RSS Feed
                          • Xing
                          Nach oben