Semphorenkonzept Stack Code

Description

Betriebssysteme Note on Semphorenkonzept Stack Code, created by Marc Faulhaber on 18/09/2016.
Marc Faulhaber
Note by Marc Faulhaber, updated more than 1 year ago
Marc Faulhaber
Created by Marc Faulhaber about 8 years ago
6
0

Resource summary

Page 1

public Stack{Object[] stack;int topOfStack;Semaphor mutex = new Semaphor(1);Semaphor sPush;Semaphor sPop;public Stack(int max){Stack = new Stack(max);sPush = new Semaphor(max);sPop = new Semaphor(0);}public void push(Object el){sPush.p();mutex.p();Stack[topOfStack] = el;topOfStack++;mutex.v();sPop.v();}public Object pop(){sPop.p();mutex.p();Object o1 = Stack[topOfStack];sPush.v();mutex.v();return o1;}}

Show full summary Hide full summary

Similar

Java
info3027
Klausurvorbereitung Betriebssysteme
Sergej Seifert
Java Grundlagen Fragen Semester 2
Fabian M.
Betriebssystem Zusammenfassung
Sophia S
Einführung Programmieren
Aaron Welther
ASCII Code | Ziffern, Buchstaben, Sonderzeichen
Alexander T
Quiz Betriebssysteme
Marc Faulhaber
EĞİTİMDE YENİ YAKLAŞIMLAR VE CODE EĞİTİMİ
hakan ölmez
Programmieren Karteikarten
Steffi Kirsche
Ziffern-Konsonanten-Code
Tahir Celikkol
Software Grundlagen
Dynamia Verlag