• 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
      • Eingebettete Systemsoftware
      • 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 2024/25
      • Betriebssysteme
      • Middleware – Cloud Computing
      • Systemprogrammierung 2
      • Verlässliche Echtzeitsysteme
      • Virtuelle Maschinen
      • Web-basierte Systeme
    Portal Lehre
  • Examensarbeiten
  1. Startseite
  2. Extern

Extern

Bereichsnavigation: Lehre
  • Betriebssystemtechnik
    • Vorlesung
      • Folien
      • Glossar
    • Übung
      • Aufgaben
      • Dokumentation
        • Blog
          • Entwicklungsumgebung
            • Assembler Crashkurs
              • C++ Crashkurs
                • 🔗 Testrechnerverwaltung
                • Kontakt
              • Evaluation

              Dokumentation

              Assignment 7: Extended Paging

              Especially fork requires copying a lot of pages – although some of them will stay the same on both parent and child and therefore can be shared. This sharing not only saves memory but improves the performance as well.

              Copy-On-Write (COW)

              Pages to be copied while using fork (and, when possible, send-receive-reply) should be displayed (mapped) in the other address space unless a write access occurs – only then they will be physically copied.

              To detect a write access, the pages concerned have to be mapped as read-only. Thus, the page fault handler is triggered on a write operation. A shadow page table for all affected physical page addresses should count the number of references on COW pages. On a write operation, the reference gets decremented and the page needs to be copied (unless there is only this one reference left). Additionally, the page mapping of the process needs to be adjusted (don't forget to invalidate those pages in the translation lookaside buffer (TLB)).

              Note
              Pages originally marked as read-only should (obviously) not become writable after such a copy operation. However, reference counting might be required for such pages as well (for example, if the parent process exits, the text segment has to be available still until the child exits).

              For send-recv or reply-send the contents of the buffers can only be copied using COW if the message size is at least equal to the page size (leftovers have to be copied physically) and the alignment of both buffers are identical. To fulfill the latter requirement, the buffers are best placed at page borders. This can be achieved using the C++ specifier alignas(x) (or the GCC/LLVM extension __attribute__((aligned (x)))), whereas the constant x defines the alignment in bytes. However, StuBS IPC should still be able to handle buffers with different alignments and fall back on the previous copy mechanism when COW is not applicable.

              Test Application

              Again, you should extensively test your implementation. The application of the previous assignment can be re-used with a few adjustments (alignment) as mentioned above.

              The forkapp has to be changed accordingly:

              alignas(4096) char sbuf[8194];
              alignas(4096) char rbuf[8194];
              void main() {
              fork();
              fork();
              if (fork() == 0) {
              sbuf[0] = 3;
              char d = sbuf[8192] = getppid() % 22;
              sbuf[8193] = 1;
              send(getppid(), sbuf, 8193, rbuf, 8193);
              char m[] = "Reply A=A bad!\ngood";
              m[6] += rbuf[0] + sbuf[8193];
              m[8] += 4 + d;
              for(size_t i = 0; m[6] == m[8] && i < 4; i++)
              m[i + 10] = m[i + 15];
              write(0, m, 15);
              } else {
              int X = recv(rbuf, 8193);
              rbuf[0] = rbuf[0] + rbuf[8192];
              rbuf[8193] = 7;
              reply(X, rbuf, 8193);
              }
              exit();
              }

              Demonstrate the advantages of COW regarding the memory usage by printing the available page frames:

              • Before Scheduler::schedule() in main()
              • In IdleThread::action()
              Friedrich-Alexander-Universität
              Erlangen-Nürnberg

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