• 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 6: Message Passing

              Your isolated processes lack efficient primitives for Inter Process Communication (IPC). One such mechanism for synchronous notification is provided by send-receive-reply, which has a clear hierarchy and therefore avoids deadlock situations with two threads sending each other at the same time.

              System Calls for Synchronous Inter Process Communication

              You have to implement the following system calls:

              • void send(int pid, const void *sbuffer, size_t ssize, void *rbuffer, size_t rsize);
                sends the message in sbuffer with the length ssize synchronously to the process with the PID pid. This operation blocks until the recipient has received the message with recv(), processed and sent an answer using reply(). This response is stored in rbuffer, with the maximum buffer size rsize.
              • int recv(void *buffer, size_t size);
                blocks the current process until it receives a message. The message is stored in buffer up to a maximum length of size bytes. The return value contains the process identification (PID) of the sender.
              • void reply(int pid, const void *buffer, size_t size);
                sends a response message to the process identified by pid. This function should not block and only success if the target process has already performed a corresponding send() to this process and is waiting for its completion.

              Test Application

              You should extensively test your implementation. The fork system call can be an important assistant for this purpose.

              Nevertheless, we provide an additional test case for you – since your StuBS might have a slightly different syscall naming scheme/semantic (e.g. the first parameter of write) you have to adapt the code accordingly:

              #define BUFSIZE (8194)
              char sbuf[BUFSIZE];
              char rbuf[BUFSIZE];
              void main() {
              fork();
              fork();
              if (fork() == 0) {
              /* child */
              sbuf[0] = 3;
              // last byte: is neither sent nor should it change
              sbuf[BUFSIZE - 1] = 1;
              char d = getppid() % (26-sbuf[0]-sbuf[BUFSIZE-1]);
              sbuf[BUFSIZE - 2] = d;
              // we do not send last byte
              send(getppid(), sbuf, BUFSIZE - 1, rbuf, BUFSIZE - 1);
              char control_data = 4 + d;
              char transmission = rbuf[0] + sbuf[BUFSIZE - 1];
              char m[] = "Reply A=A bad!\ngood";
              m[6] += tranmission;
              m[8] += control_data;
              for(size_t i = 0; m[6] == m[8] && i < 4; i++) {
              m[i + 10] = m[i + 15];
              }
              write(0, m, 15);
              } else {
              /* parent */
              int X = recv(rbuf, BUFSIZE - 1);
              // should now be equal to 3 + d
              rbuf[0] += rbuf[BUFSIZE - 2];
              // overwrite last byte (locally, should not be sent)
              rbuf[BUFSIZE - 1] = 7;
              reply(X, rbuf, BUFSIZE - 1);
              }
              exit();
              }

              Due to the fork() calls, this application will split into four pairs of threads. In each pair, one thread (parent) will wait for a message while the other thread (child) sends the message. The parent thread then calculates a value from the message and sends the buffer back.

              On correct implementation of the system calls above, the output of this test application should be similar to:

              Reply F=F good
              Reply K=K good
              Reply M=M good
              Reply L=L good

              The lines can appear in any order. The two letters following Reply depend on your implementation of the process identification assignment. However, on a single line those two letters must be equal (in this case good will be appended), otherwise you have an incomplete implementation (bad!)

              Friedrich-Alexander-Universität
              Erlangen-Nürnberg

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