02.11.2013 Views

Systemsoftware

Systemsoftware

Systemsoftware

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Semantik von Signal()<br />

(1) {B∧(CV'=∅)} CV.Signal ( ) {B∧(CV=∅)}<br />

• Variante I: kein Besitzwechsel, Befreiung höchstens eines Threads aus CV<br />

(2) {B∧(CV'≠∅)} CV.Signal ( ) {B∧(CV=CV'-{P x },P x ∈CV')∧(P=P'∪{P x })}<br />

• Variante II: kein Besitzwechsel, Befreiung aller Threads aus CV<br />

(2') {B∧(CV'≠∅)} CV.Signal ( ) {B∧(CV=∅)∧(P=P'∪CV')}<br />

• Variante III: Besitzwechsel vom signalisierenden auf einen signalisierten<br />

Thread (Hoare 1974)<br />

(2'') {B∧(CV'≠∅)} CV.Signal ( ) {B∧(P=P'∪{P r }∧(P r =Blocked) ∧(CV=CV'- {P x },<br />

P x ∈CV')∧(P x =Ready)}<br />

<strong>Systemsoftware</strong> - Lektion X 7<br />

Programmierregeln<br />

• Signal-Varianten I und II<br />

– keine Garantie, dass die Bedingung B nach Wait erfüllt ist, deshalb<br />

Benutzung von Wait immer in der while-Schleife:<br />

while (!B) Conditionvariable.Wait();<br />

• Signal-Variante III:<br />

– war B unmittelbar vor Signal erfüllt, dann ist B auch garantiert nach Wait<br />

erfüllt, deshalb ist die Benutzung von Wait auch in if-Anweisung sicher:<br />

if (!B) Conditionvariable.Wait();<br />

<strong>Systemsoftware</strong> - Lektion X 8

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!