Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/VDM/VDMPP/DiningPP/     Datei vom 13.4.2020 mit Größe 520 B image not shown  

Quelle  philosopher.vdmpp   Sprache: VDM

 

\begin{vdm_al}
class Philosopher

instance variables
  theTable : Table;
  turns : nat := 2

operations
  public Philosopher : Table ==> Philosopher
  Philosopher (pt) == theTable := pt;

  Think: () ==> ()
  Think () == skip;

  Eat: () ==> ()
  Eat () == turns := turns - 1;

thread
  ( while (turns > 0) do
      ( Think();
        theTable.takeFork();
        theTable.takeFork();
        Eat();
        theTable.releaseFork();
        theTable.releaseFork() );
    theTable.IamDone() )

end Philosopher
\end{vdm_al}

Messung
CHZG
999710098

¤ Dauer der Verarbeitung: 0.1 Sekunden  (vorverarbeitet am  2026-11-24) ¤

*© Formatika GbR, Deutschland