Αρχική ΑΕΠΠ - Δομές Δεδομένων Λειτουργικά Συστήματα Δίκτυα Υπολογιστών ΙΙ Βάσεις Δεδομένων Παιδαγωγικά - Διδακτική

Εισαγωγικά

Εισαγωγή στα Λ.Σ. Βασικές Δομές Η/Υ Βασικές Δομές Λ.Σ

Διεργασίες

Διεργασίες Χρονοπρογραμματισμός Συγχρονισμός

Αδιέξοδα

Μνήμη

Μονοπρογραμματισμός Εναλλαγή Εικονική Μνήμη Κατάτμηση

Είσοδος / Έξοδος

Σύστημα Αρχείων

Διεπαφή Υλοποίηση

 Ιστορικό Πρόσφατες αλλαγές Εκτύπωση Αναζήτηση

Ιστορικό: OS.Deadlocks

Απόκρυψη μικρών αλλαγών - Αλλαγές περιεχομένου

05-09-2008 (16:25) από Άρης -
Αλλαγή σειρών 444-445 από:
Ψάχνουμε να βρούμε μία γραμμή της οποίας οι επιπλέον απαιτήσεις σε πόρους είναι μικρότερες ή ίσες από το Availabe. Αν φτιάξουμε τον πίνακα Need από τη σχέση @@Need[i,j] = Max[i,j] – Allocation [i,j]@@, έχουμε.
σε:
Ψάχνουμε να βρούμε μία γραμμή της οποίας οι επιπλέον απαιτήσεις σε πόρους είναι μικρότερες ή ίσες από το Availabe. Αν φτιάξουμε τον πίνακα Request από τη σχέση @@Request[i,j] = Max[i,j] – Allocation [i,j]@@, έχουμε.
24-08-2008 (19:29) από Άρης -
Αλλαγή σειρών 100-101 από:

σε:
Για να μην υπάρξει αδιέξοδο πρέπει κάθε διεργασία να έχει δεσμεύσει ένα πόρο R και να υπάρχει ένας ακόμη ελεύθερος ώστε μία από αυτές να μπορέσει να δεσμεύσει το μέγιστο των 2 πόρων. Έτσι, το μέγιστο για το οποίο δεν υπάρχει αδιέξοδο είναι Ρ=R-1. Προφανός για οτιδήποτε μικρότερο δεν υπάρχει αδιέξοδο. Έτσι, έχουμε τη συνθήκη P<=R-1.
Αλλαγή σειρών 114-115 από:

σε:
Κάθε διεργασία θα έχει δεσμεύσει έναν πόρο. Για να μην υπάρξει αδιέξοδο θα πρέπει να υπάρχουν 2 μονάδες ακόμη του R, έτσι ώστε μία διεργασία να μπορεί να φτάσει το μέγιστό της. Αυτό μας δίνει τη σχέση N<=M-2.
24-08-2008 (19:14) από 194.63.239.168 -
Αλλαγή σειρών 618-652 από:
>><<

----

!!! Ερώτηση



>>answer<<

!!! Απάντηση



>><<

----



----

!!! Ερώτηση



>>answer<<

!!! Απάντηση



>><<

----
σε:
>><<
24-08-2008 (19:13) από 194.63.239.168 -
Αλλαγή σειρών 165-174 από:

! Γράφοι Εκχώρησης Πόρων

||width=60%
||Διεργασία || http://users.sch.gr/fergadis/images/OS/Deadlock/proccess.jpg ||
||Τύπος Πόρου με 4 Στιγμιότυπα || http://users.sch.gr/fergadis/images/OS/Deadlock/resource.jpg ||
||Η διεργασία P'_i_' ζητάει ένα στιγμιότυπο του πόρου R'_j_' || http://users.sch.gr/fergadis/images/OS/Deadlock/proccess-resource-request.jpg ||
||Η διεργασία P'_i_' δεσμεύει ένα στιγμιότυπο του πόρου R'_j_' || http://users.sch.gr/fergadis/images/OS/Deadlock/proccess-resource-get.jpg ||
||Η διεργασία P'_i_' απελευθερώνει ένα στιγμιότυπο του πόρου R'_j_' || http://users.sch.gr/fergadis/images/OS/Deadlock/proccess-resource-release.jpg ||
σε:
----
Αλλαγή σειρών 169-177 από:
Να σχεδιάσετε ένα γράφο εκχώρησης πόρων για τα παρακάτω:
*Η διεργασία P1 απαιτεί τον πόρο R1
*Η διεργασία P2 απαιτεί τον πόρο R3
*Ο πόρος R1 είναι δεσμευμένος από τη διεργασία P2
*Ο πόρος R2 είναι δεσμευμένος από τη διεργασία P1
*Ο πόρος R3 είναι δεσμευμένος από τη διεργασία P3

Υπάρχει αδιέξοδο; Θεωρείστε ότι κάθε πόρος έχει ένα στιγμιότυπο.
σε:
A distributed system using mailboxes has two IPC primitives, send and receive. The latter primitive specifies a process to receive from and blocks if no message from that process is available, even though messages may be waiting from other processes. There are no shared resources, but processes need to communicate frequently about other matters. Is deadlock possible? Discuss.
Αλλαγή σειρών 175-182 από:
Ο γράφος είναι ως εξής:

http://users.sch.gr/fergadis/images/OS/Deadlock/exercise1.png

Όπως φαίνεται από το γράφο δεν υπάρχει κύκλος, άρα δεν υπάρχει αδιέξοδο.

Ο πόρος R1 θα ελευθερωθεί κάποια στιγμή από την P2 και η Ρ1 θα μπορέσει να ολοκληρώσει. Επίσης, ο πόρος R3 θα ελευθερωθεί όταν ολοκληρώσει η Ρ3 και θα μπορέσει να ολοκληρώσει και η Ρ2.
σε:
Yes. Suppose that all the mailboxes are empty. Now A sends to B and waits for a reply, B sends to C and waits for a reply, and C sends to A and waits for a reply. All the conditions for deadlock are now fulfilled.
Αλλαγή σειρών 183-190 από:
Ένα σύστημα αποτελείται από 4 διεργασίες, (Ρ1, Ρ2, Ρ3, Ρ4), και 3 τύπους από σειριακά επαναχρησιμοποιούμενους πόρους, (R1, R2, R3). Ο αριθμός των μονάδων των πόρων είναι E=<3,2,2>.
*Η διεργασία P1 κρατά 1 μονάδα του R1 και απαιτεί 1 μονάδα του R2
*Η διεργασία P2 κρατά 2 μονάδες του R2 και απαιτεί 1 μονάδα καθενός από τους R1 και R3.
*Η διεργασία P3 κρατά 1 μονάδα του R1 και απαιτεί 1 μονάδα του R2
*Η διεργασία P4 κρατά 2 μονάδες του R3 και απαιτεί 1 μονάδα του R1

Φτιάξτε το γράφο. Υπάρχει αδιέξοδο;
σε:
Two processes, A and B, each need three records, 1, 2. and 3, in a database. If A asks for them in the order 1, 2, 3, and B asks for them in the same order, deadlock is not possible. However, if B asks for them in the order 3, 2, 1, then deadlock is possible. With three resources, there are 3! or 6 possible combinations each process can request the resources. What fraction of all the combinations are guaranteed to be deadlock free?
Αλλαγή σειρών 189-202 από:
Ο γράφος είναι ως εξής:

http://users.sch.gr/fergadis/images/OS/Deadlock/exercise2.png

Όπως φαίνεται παρακάτω υπάρχουν τρεις κύκλοι.

http://users.sch.gr/fergadis/images/OS/Deadlock/exercise2a.png

http://users.sch.gr/fergadis/images/OS/Deadlock/exercise2b.png

http://users.sch.gr/fergadis/images/OS/Deadlock/exercise2c.png

Όλοι οι κύκλοι περνούν υποχρεωτικά από τον πόρο R1 ο οποίος έχει ένα στιγμιότυπο ελεύθερο. Το αν θα υπάρξει αδιέξοδο εξαρτάται σε ποια διεργασία θα δοθεί αυτός ο πόρος. Αν δοθεί στην Ρ2, τότε έχουμε αδιέξοδο διότι τότε όλες οι διεργασίες θα αιτούνται ένα ακόμη στιγμιότυπο άλλου πόρου το οποίο δεν είναι ελεύθερο. Αν δοθεί την Ρ4, τότε αυτή έχει όλους τους πόρους που χρειάζεται και μπορεί να ολοκληρώσει. Έτσι, αφήνει ελεύθερα τα δύο στιγμιότυπα που πόρου R3 και το ένα του R1. Αυτό δίνει τη δυνατότητα στην Ρ2 να δεσμεύσει τους πόρους που χρειάζεται και να ολοκληρώσει. Στη συνέχεια ολοκληρώνουν και οι Ρ1 και Ρ3 που έχουν χρειάζονταν τα στιγμιότυπα του πόρου R2.
σε:
Suppose that process A requests the records in the order a, b, c. If process B also asks for a first, one of them will get it and the other will block. This situation is always deadlock free since the winner can now run to completion without interference. Of the four other combinations, some may lead to deadlock and some are deadlock free. The six cases are as follows:

* abc: deadlock free
* acb: deadlock free
* bac: possible deadlock
* bca: possible deadlock
* cab: possible deadlock
* cba: possible deadlock

Since four of the six may lead to deadlock, there is a 1/3 chance of avoiding a deadlock and a 2/3 chance of getting one.
Αλλαγή σειρών 202-213 από:
! Δομές Δεδομένων για τον Αλγόριθμο του Τραπεζίτη

* @@'''n'''@@ = το πλήθος των διεργασιών,
* @@'''m'''@@ = το πλήθος τύπων πόρων
* @@'''Existence'''@@: Διάνυσμα μήκους @@m@@. Το @@Existence[j]@@ δίνει το μέγιστο πλήθος στιγμιότυπων του πόρου @@R'_j_'@@.
* @@'''Available'''@@: Διάνυσμα μήκους @@m@@. Αν @@Available[j] = k@@, υπάρχουν @@k@@ στιγμιότυπα του τύπου πόρου @@R'_j_'@@ διαθέσιμα.
* @@'''Max'''@@: @@n x m@@ πίνακας. Αν @@Max[i,j] = k@@, τότε η διεργασία @@P'_i_'@@ μπορεί να απαιτήσει κατά μέγιστο @@k@@ στιγμιότυπα του τύπου πόρου @@R'_j_'@@.
* @@'''Allocation'''@@: @@n x m@@ πίνακας. Αν @@Allocation[i,j] = k@@ τότε στη διεργασία @@P'_i_'@@ εκχωρούνται @@k@@ στιγμιότυπα του πόρου @@R'_j_'@@.
* @@'''Request'''@@: @@n x m@@ πίνακας. Αν @@Request[i,j] = k@@, τότε η διεργασία @@P'_i_'@@ μπορεί να χρειαστεί @@k@@ επιπλέον στιγμιότυπα του πόρου @@R'_j_'@@ για να ολοκληρωθεί.

%center%@@Request[i,j] = Max[i,j] – Allocation [i,j]@@
σε:
----
Αλλαγή σειρών 206-211 από:
Υπάρχουν 3 τύποι πόρων με πλήθος: R1 = 9, R2 = 3, R3 = 6. Είναι η παρακάτω κατάσταση ασφαλής;

(:table cellpadding=2px align=center:)
(:cell:)
(:table:)
(:caption:)Total
σε:
Now reconsider the above problem, but using two-phase locking. Will that eliminate the potential for deadlock? Does it have any other undesirable characteristics, however? If so, which ones?

>>answer<<

!!! Απάντηση

Two-phase locking eliminates deadlocks, but introduces potential starvation. A process has to keep trying and failing to acquire all of its records. There is no upper bound on how long it may take.

>><<
Αλλαγή σειρών 217-228 από:
(:row align=center:)
(:head:)R1
(:head:)R2
(:head:)R3
(:row align=center :)
(:cell:)9
(:cell:)3
(:cell:)6
(:tableend:)
(:cell:)
(:table:)
(:caption:)Available
σε:

!!! Ερώτηση

In an electronic funds transfer system, there are hundreds of identical processes that work as follows. Each process reads an input line specifying an amount of money, the account to be credited, and the account to be debited. Then it locks both accounts and transfers the money, releasing the locks when done. With many processes running in parallel, there is a very real danger that having locked account x it will be unable to lock y because y has been locked by a process now waiting for x. Devise a scheme that avoids deadlocks. Do not release an account record until you have completed the transactions. (In other words, solutions that lock one account and then release it immediately if the other is locked are not allowed.)

>>answer<<

!!! Απάντηση

To avoid circular wait, number the resources (the accounts) with their account numbers. After reading an input line, a process locks the lower-numbered account first, then when it gets the lock (which may entail waiting), it locks the other one. Since no process ever waits for an account lower than what it already has, there is never a circular wait, hence never a deadlock.

>><<
Αλλαγή σειρών 231-241 από:
(:head:)R1
(:head:)R2
(:head:)R3
(:row align=center :)
(:cell:)0
(:cell:)1
(:cell:)1
(:tableend:)
(:cell:)
(:table:)
(:caption:)Max
σε:

!!! Ερώτηση

One way to prevent deadlocks is to eliminate the hold-and-wait condition. In the text it was proposed that before asking for a new resource, a process must first release whatever resources it already holds (assuming that is possible). However, doing so introduces the danger that it may get the new resource but lose some of the existing ones to competing processes. Propose an improvement to this scheme.

>>answer<<

!!! Απάντηση

Change the semantics of requesting a new resource as follows. If a process asks for a new resource and it is available, it gets the resource and keeps what it already has. If the new resource is not available, all existing resources are released. With this scenario, deadlock is impossible and there is no danger that the new resource is acquired but existing ones lost. Of course, the process only works if releasing a resource is possible (you can release a scanner between pages or a CD recorder between CDs).

>><<
Αλλαγή σειρών 245-272 από:
(:head:)
(:head:)R1
(:head:)R2
(:head:)R3
(:row align=center:)
(:head:)P1
(:cell:)3
(:cell:)2
(:cell:)2
(:row align=center:)
(:head:)P2
(:cell:)6
(:cell:)1
(:cell:)3
(:row align=center:)
(:head:)P3
(:cell:)3
(:cell:)1
(:cell:)4
(:row align=center:)
(:head:)P4
(:cell:)4
(:cell:)2
(:cell:)2
(:tableend:)
(:cell:)
(:table:)
(:caption:)Allocated
σε:

!!! Ερώτηση

A computer science student assigned to work on deadlocks thinks of the following brilliant way to eliminate deadlocks. When a process requests a resource, it specifies a time limit. If the process blocks because the resource is not available, a timer is started. If the time limit is exceeded, the process is released and allowed to run again. If you were the professor, what grade would you give this proposal and why.

>>answer<<

!!! Απάντηση

I’d give it an F (failing) grade. What does the process do? Since it clearly needs the resource, it just asks again and blocks again. This is no better than staying blocked. In fact, it may be worse since the system may keep track of how long competing processes have been waiting and assign a newly freed resource to the process that has been waiting longest. By periodically timing out and trying again, a process loses its seniority.

>><<
Αλλαγή σειρών 259-285 από:
(:head:)
(:head:)R1
(:head:)R2
(:head:)R3
(:row align=center:)
(:head:)P1
(:cell:)1
(:cell:)0
(:cell:)0
(:row align=center:)
(:head:)P2
(:cell:)6
(:cell:)1
(:cell:)2
(:row align=center:)
(:head:)P3
(:cell:)2
(:cell:)1
(:cell:)1
(:row align=center:)
(:head:)P4
(:cell:)0
(:cell:)0
(:cell:)2
(:tableend:)
(:tableend:)
σε:

!!! Ερώτηση

Cinderella and the Prince are getting divorced. To divide their property, they have agreed on the following algorithm. Every morning, each one may send a letter to the other’s lawyer requesting one item of property. Since it takes a day for letters to be delivered, they have agreed that if both discover that they have requested the same item on the same day, the next day they will send a letter canceling the request. Among their property is their dog. Woofer. Woofer’s doghouse, their canary. Tweeter, and Tweeter’s cage. The animals love their houses, so it has been agreed that any division of property separating an animal from its house is invalid, requiring the whole division to start over from scratch. Both Cinderella and the Prince desperately want Woofer. So they can go on (separate) vacations, each spouse has programmed a personal computer to handle the negotiation. When they come back from vacation, the computers are still negotiating. Why? Is deadlock possible? Is starvation possible? Discuss.
Αλλαγή σειρών 268-271 από:
Ψάχνουμε να βρούμε μία γραμμή της οποίας οι επιπλέον απαιτήσεις σε πόρους είναι μικρότερες ή ίσες από το Availabe. Αν φτιάξουμε τον πίνακα Need από τη σχέση @@Need[i,j] = Max[i,j] – Allocation [i,j]@@, έχουμε.

(:table:)
(:caption:)Request
σε:
If both programs ask for Woofer first, the computers will starve with the endless sequence: request Woofer, cancel request, request Woofer, cancel request, etc. If one of them asks for the doghouse and the other asks for the dog, we have a deadlock, which is detected by both parties and then broken, but it is just repeated on the next cycle. Either way, if both computers have been programmed to go after the dog or the doghouse first, either starvation or deadlock ensues. There is not really much difference between the two here. In most deadlock problems, starvation does not seem serious because introducing random delays will usually make it very unlikely. That approach does not work here.

>><<

! Γράφοι Εκχώρησης Πόρων

||width=60%
||Διεργασία || http://users.sch.gr/fergadis/images/OS/Deadlock/proccess.jpg ||
||Τύπος Πόρου με 4 Στιγμιότυπα || http://users.sch.gr/fergadis/images/OS/Deadlock/resource.jpg ||
||Η διεργασία P'_i_' ζητάει ένα στιγμιότυπο του πόρου R'_j_' || http://users.sch.gr/fergadis/images/OS/Deadlock/proccess-resource-request.jpg ||
||Η διεργασία P'_i_' δεσμεύει ένα στιγμιότυπο του πόρου R'_j_' || http://users.sch.gr/fergadis/images/OS/Deadlock/proccess-resource-get.jpg ||
||Η διεργασία P'_i_' απελευθερώνει ένα στιγμιότυπο του πόρου R'_j_' || http://users.sch.gr/fergadis/images/OS/Deadlock/proccess-resource-release.jpg ||

!!! Ερώτηση

Να σχεδιάσετε ένα γράφο εκχώρησης πόρων για τα παρακάτω:
*Η διεργασία P1 απαιτεί τον πόρο R1
*Η διεργασία P2 απαιτεί τον πόρο R3
*Ο πόρος R1 είναι δεσμευμένος από τη διεργασία P2
*Ο πόρος R2 είναι δεσμευμένος από τη διεργασία P1
*Ο πόρος R3 είναι δεσμευμένος από τη διεργασία P3

Υπάρχει αδιέξοδο; Θεωρείστε ότι κάθε πόρος έχει ένα στιγμιότυπο.

>>answer<<

!!! Απάντηση

Ο γράφος είναι ως εξής:

http://users.sch.gr/fergadis/images/OS/Deadlock/exercise1.png

Όπως φαίνεται από το γράφο δεν υπάρχει κύκλος, άρα δεν υπάρχει αδιέξοδο.

Ο πόρος R1 θα ελευθερωθεί κάποια στιγμή από την P2 και η Ρ1 θα μπορέσει να ολοκληρώσει. Επίσης, ο πόρος R3 θα ελευθερωθεί όταν ολοκληρώσει η Ρ3 και θα μπορέσει να ολοκληρώσει και η Ρ2.

>><<
Αλλαγή σειρών 307-359 από:
(:head:)
σε:

!!! Ερώτηση

Ένα σύστημα αποτελείται από 4 διεργασίες, (Ρ1, Ρ2, Ρ3, Ρ4), και 3 τύπους από σειριακά επαναχρησιμοποιούμενους πόρους, (R1, R2, R3). Ο αριθμός των μονάδων των πόρων είναι E=<3,2,2>.
*Η διεργασία P1 κρατά 1 μονάδα του R1 και απαιτεί 1 μονάδα του R2
*Η διεργασία P2 κρατά 2 μονάδες του R2 και απαιτεί 1 μονάδα καθενός από τους R1 και R3.
*Η διεργασία P3 κρατά 1 μονάδα του R1 και απαιτεί 1 μονάδα του R2
*Η διεργασία P4 κρατά 2 μονάδες του R3 και απαιτεί 1 μονάδα του R1

Φτιάξτε το γράφο. Υπάρχει αδιέξοδο;

>>answer<<

!!! Απάντηση

Ο γράφος είναι ως εξής:

http://users.sch.gr/fergadis/images/OS/Deadlock/exercise2.png

Όπως φαίνεται παρακάτω υπάρχουν τρεις κύκλοι.

http://users.sch.gr/fergadis/images/OS/Deadlock/exercise2a.png

http://users.sch.gr/fergadis/images/OS/Deadlock/exercise2b.png

http://users.sch.gr/fergadis/images/OS/Deadlock/exercise2c.png

Όλοι οι κύκλοι περνούν υποχρεωτικά από τον πόρο R1 ο οποίος έχει ένα στιγμιότυπο ελεύθερο. Το αν θα υπάρξει αδιέξοδο εξαρτάται σε ποια διεργασία θα δοθεί αυτός ο πόρος. Αν δοθεί στην Ρ2, τότε έχουμε αδιέξοδο διότι τότε όλες οι διεργασίες θα αιτούνται ένα ακόμη στιγμιότυπο άλλου πόρου το οποίο δεν είναι ελεύθερο. Αν δοθεί την Ρ4, τότε αυτή έχει όλους τους πόρους που χρειάζεται και μπορεί να ολοκληρώσει. Έτσι, αφήνει ελεύθερα τα δύο στιγμιότυπα που πόρου R3 και το ένα του R1. Αυτό δίνει τη δυνατότητα στην Ρ2 να δεσμεύσει τους πόρους που χρειάζεται και να ολοκληρώσει. Στη συνέχεια ολοκληρώνουν και οι Ρ1 και Ρ3 που έχουν χρειάζονταν τα στιγμιότυπα του πόρου R2.

>><<

! Δομές Δεδομένων για τον Αλγόριθμο του Τραπεζίτη

* @@'''n'''@@ = το πλήθος των διεργασιών,
* @@'''m'''@@ = το πλήθος τύπων πόρων
* @@'''Existence'''@@: Διάνυσμα μήκους @@m@@. Το @@Existence[j]@@ δίνει το μέγιστο πλήθος στιγμιότυπων του πόρου @@R'_j_'@@.
* @@'''Available'''@@: Διάνυσμα μήκους @@m@@. Αν @@Available[j] = k@@, υπάρχουν @@k@@ στιγμιότυπα του τύπου πόρου @@R'_j_'@@ διαθέσιμα.
* @@'''Max'''@@: @@n x m@@ πίνακας. Αν @@Max[i,j] = k@@, τότε η διεργασία @@P'_i_'@@ μπορεί να απαιτήσει κατά μέγιστο @@k@@ στιγμιότυπα του τύπου πόρου @@R'_j_'@@.
* @@'''Allocation'''@@: @@n x m@@ πίνακας. Αν @@Allocation[i,j] = k@@ τότε στη διεργασία @@P'_i_'@@ εκχωρούνται @@k@@ στιγμιότυπα του πόρου @@R'_j_'@@.
* @@'''Request'''@@: @@n x m@@ πίνακας. Αν @@Request[i,j] = k@@, τότε η διεργασία @@P'_i_'@@ μπορεί να χρειαστεί @@k@@ επιπλέον στιγμιότυπα του πόρου @@R'_j_'@@ για να ολοκληρωθεί.

%center%@@Request[i,j] = Max[i,j] – Allocation [i,j]@@

!!! Ερώτηση

Υπάρχουν 3 τύποι πόρων με πλήθος: R1 = 9, R2 = 3, R3 = 6. Είναι η παρακάτω κατάσταση ασφαλής;

(:table cellpadding=2px align=center:)
(:cell:)
(:table:)
(:caption:)Total
----
(:row align=center:)
Αλλαγή σειρών 363-376 από:
(:row align=center:)
(:head:)P1
(:cell:)2
(:cell:)2
(:cell:)2
(:row align=center style='background-color: lightyellow;':)
(:head:)P2
(:cell:)0
(:cell:)0
(:cell:)1
(:row align=center:)
(:head:)P3
(:cell:)1
(:cell:)0
σε:
(:row align=center :)
(:cell:)9
Αλλαγή σειρών 366-370 από:
(:row align=center:)
(:head:)P4
(:cell:)4
(:cell:)2
(:cell:)0
σε:
(:cell:)6
Διαγραφή σειρών 367-372:

Βλέπουμε ότι η Ρ2 έχει μικρότερες απαιτήσεις από τις διαθέσιμες στο Available. Έτσι, δεσμεύει τους πόρους που χρειάζεται και αφού ολοκληρώσει τους ελευθερώνει. Οι πίνακες τώρα είναι όπως παρακάτω.

Προσέχουμε στον πίνακα Available. Η Ρ2 δεσμεύοντας το ένα στιγμιότυπο του πόρου R3, έχει Allocated: 6 1 3 και ο Availabe: 0 1 0. Ο Availabe μετά την ολοκλήρωση της Ρ2 είναι το άθροισμα των παραπάνω.

(:table cellpadding=2px:)
Αλλαγή σειρών 376-378 από:
(:cell:)6
(:cell:)2
(:cell:)3
σε:
(:cell:)0
(:cell:)1
(:cell:)1
Αλλαγή σειρών 424-426 από:
(:cell:)0
(:cell:)0
(:cell:)0
σε:
(:cell:)6
(:cell:)1
(:cell:)2
Αλλαγή σειρών 438-445 από:
(:cell:)
σε:
(:tableend:)

>>answer<<

!!! Απάντηση

Ψάχνουμε να βρούμε μία γραμμή της οποίας οι επιπλέον απαιτήσεις σε πόρους είναι μικρότερες ή ίσες από το Availabe. Αν φτιάξουμε τον πίνακα Need από τη σχέση @@Need[i,j] = Max[i,j] – Allocation [i,j]@@, έχουμε.
Αλλαγή σειράς 458 από:
(:row align=center:)
σε:
(:row align=center style='background-color: lightyellow;':)
Αλλαγή σειράς 462 από:
(:cell:)0
σε:
(:cell:)1
Αλλαγή σειρών 474-480 από:
(:tableend:)

Απ' αυτό το σημείο οποιαδήποτε από τις διεργασίες που παραμένουν μπορεί να ολοκληρώσει αφού υπάρχουν οι διαθέσιμοι πόροι.

>><<

σε:

Βλέπουμε ότι η Ρ2 έχει μικρότερες απαιτήσεις από τις διαθέσιμες στο Available. Έτσι, δεσμεύει τους πόρους που χρειάζεται και αφού ολοκληρώσει τους ελευθερώνει. Οι πίνακες τώρα είναι όπως παρακάτω.

Προσέχουμε στον πίνακα Available. Η Ρ2 δεσμεύοντας το ένα στιγμιότυπο του πόρου R3, έχει Allocated: 6 1 3 και ο Availabe: 0 1 0. Ο Availabe μετά την ολοκλήρωση της Ρ2 είναι το άθροισμα των παραπάνω.

(:table cellpadding=2px:)
(:cell:)
(:table:)
(:caption:)Available
Αλλαγή σειρών 484-516 από:

!!! Ερώτηση

A system has four processes and five allocatable resources. The current allocation and maximum needs are as follows:

[@
Process Allocated Maximum Availabe
A 1 0 2 1 1 1 1 2 1 3 0 0 x 1 1
B 2 0 1 1 0 2 2 2 1 0
C 1 1 0 1 0 2 1 3 1 0
D 1 1 1 1 0 1 1 2 2 1
@]


What is the smallest value of x for which this is a safe state?

>>answer<<

!!! Απάντηση

The request matix is as follows:

[@
0 1 0 0 2
0 2 1 0 0
1 0 3 0 0
0 0 1 1 1
@]

If x is 0, we have a deadlock immediately. If x is 1, process D can run to completion. When it is finished, the available vector is 1 1 2 2 1. Unfortunately we are now deadlocked. If x is 2, after D runs, the available vector is @@1 1 3 2 1@@ and C can run. After it finishes and returns its resources the available vector is @@2 2 3 3 1@@, which will allow B to run and complete, and then A to run and complete. Therefore, the smallest value of x that avoids a deadlock is 2.

>><<
σε:
(:head:)R1
(:head:)R2
(:head:)R3
(:row align=center :)
(:cell:)6
(:cell:)2
(:cell:)3
(:tableend:)
(:cell:)
(:table:)
(:caption:)Max
Αλλαγή σειρών 496-508 από:

!!! Ερώτηση



>>answer<<

!!! Απάντηση



>><<
σε:
(:head:)
(:head:)R1
(:head:)R2
(:head:)R3
(:row align=center:)
(:head:)P1
(:cell:)3
(:cell:)2
(:cell:)2
(:row align=center:)
(:head:)P2
(:cell:)6
(:cell:)1
(:cell:)3
(:row align=center:)
(:head:)P3
(:cell:)3
(:cell:)1
(:cell:)4
(:row align=center:)
(:head:)P4
(:cell:)4
(:cell:)2
(:cell:)2
(:tableend:)
(:cell:)
(:table:)
(:caption:)Allocated
Αλλαγή σειρών 525-527 από:


σε:
(:head:)
(:head:)R1
(:head:)R2
(:head:)R3
(:row align=center:)
(:head:)P1
(:cell:)1
(:cell:)0
(:cell:)0
(:row align=center:)
(:head:)P2
(:cell:)0
(:cell:)0
(:cell:)0
(:row align=center:)
(:head:)P3
(:cell:)2
(:cell:)1
(:cell:)1
(:row align=center:)
(:head:)P4
(:cell:)0
(:cell:)0
(:cell:)2
(:tableend:)
(:cell:)
(:table:)
(:caption:)Request
Αλλαγή σειρών 554-587 από:
σε:
(:head:)
(:head:)R1
(:head:)R2
(:head:)R3
(:row align=center:)
(:head:)P1
(:cell:)2
(:cell:)2
(:cell:)2
(:row align=center:)
(:head:)P2
(:cell:)0
(:cell:)0
(:cell:)0
(:row align=center:)
(:head:)P3
(:cell:)1
(:cell:)0
(:cell:)3
(:row align=center:)
(:head:)P4
(:cell:)4
(:cell:)2
(:cell:)0
(:tableend:)
(:tableend:)

Απ' αυτό το σημείο οποιαδήποτε από τις διεργασίες που παραμένουν μπορεί να ολοκληρώσει αφού υπάρχουν οι διαθέσιμοι πόροι.

>><<


----
Αλλαγή σειρών 590-591 από:

σε:
A system has four processes and five allocatable resources. The current allocation and maximum needs are as follows:

[@
Process Allocated Maximum Availabe
A 1 0 2 1 1 1 1 2 1 3 0 0 x 1 1
B 2 0 1 1 0 2 2 2 1 0
C 1 1 0 1 0 2 1 3 1 0
D 1 1 1 1 0 1 1 2 2 1
@]


What is the smallest value of x for which this is a safe state?
Αλλαγή σειρών 607-608 από:

σε:
The request matix is as follows:

[@
0 1 0 0 2
0 2 1 0 0
1 0 3 0 0
0 0 1 1 1
@]

If x is 0, we have a deadlock immediately. If x is 1, process D can run to completion. When it is finished, the available vector is 1 1 2 2 1. Unfortunately we are now deadlocked. If x is 2, after D runs, the available vector is @@1 1 3 2 1@@ and C can run. After it finishes and returns its resources the available vector is @@2 2 3 3 1@@, which will allow B to run and complete, and then A to run and complete. Therefore, the smallest value of x that avoids a deadlock is 2.
Πρόσθεση σειρών 620-651:
----

!!! Ερώτηση



>>answer<<

!!! Απάντηση



>><<

----



----

!!! Ερώτηση



>>answer<<

!!! Απάντηση



>><<
24-08-2008 (18:51) από Άρης -
Αλλαγή σειρών 486-493 από:
||class='tabtable'
||! Process ||! Allocated ||||||||||! Maximum ||||||||||! Availabe ||||||||||
|| A || 1 || 0 || 2 || 1 || 1 || 1 || 1 || 2 || 1 || 3 || 0 || 0 || x || 1 || 1 ||
|| B || 2 || 0 || 1 || 1 || 0 || 2 || 2 || 2 || 1 || 0 || || || || || ||
|| C || 1 || 1 || 0 || 1 || 0 || 2 || 1 || 3 || 1 || 0 || || || || || ||
|| D || 1 || 1 || 1 || 1 || 0 || 1 || 1 || 2 || 2 || 1 || || || || || ||

σε:
[@
Process Allocated Maximum Availabe
A 1 0 2 1 1 1 1 2 1 3 0 0 x 1 1
B 2 0 1 1 0 2 2 2 1 0
C 1 1 0 1 0 2 1 3 1 0
D 1 1 1 1 0 1 1 2 2 1
@]

Αλλαγή σειρών 501-502 από:

σε:
The request matix is as follows:

[@
0 1 0 0 2
0 2 1 0 0
1 0 3 0 0
0 0 1 1 1
@]

If x is 0, we have a deadlock immediately. If x is 1, process D can run to completion. When it is finished, the available vector is 1 1 2 2 1. Unfortunately we are now deadlocked. If x is 2, after D runs, the available vector is @@1 1 3 2 1@@ and C can run. After it finishes and returns its resources the available vector is @@2 2 3 3 1@@, which will allow B to run and complete, and then A to run and complete. Therefore, the smallest value of x that avoids a deadlock is 2.
24-08-2008 (18:43) από 194.63.237.23 -
Αλλαγή σειρών 489-493 από:
|| B || 2 || 0 || 1 || 1 || 0 || 2 || 2 || 2 || 1 || 0 ||||||||||||
|| C || 1 || 1 || 0 || 1 || 0 || 2 || 1 || 3 || 1 || 0 ||||||||||||
|| D || 1 || 1 || 1 || 1 || 0 || 1 || 1 || 2 || 2 || 1 ||||||||||||

σε:
|| B || 2 || 0 || 1 || 1 || 0 || 2 || 2 || 2 || 1 || 0 || || || || || ||
|| C || 1 || 1 || 0 || 1 || 0 || 2 || 1 || 3 || 1 || 0 || || || || || ||
|| D || 1 || 1 || 1 || 1 || 0 || 1 || 1 || 2 || 2 || 1 || || || || || ||

24-08-2008 (18:42) από 194.63.237.23 -
Αλλαγή σειρών 484-485 από:

σε:
A system has four processes and five allocatable resources. The current allocation and maximum needs are as follows:

||class='tabtable'
||! Process ||! Allocated ||||||||||! Maximum ||||||||||! Availabe ||||||||||
|| A || 1 || 0 || 2 || 1 || 1 || 1 || 1 || 2 || 1 || 3 || 0 || 0 || x || 1 || 1 ||
|| B || 2 || 0 || 1 || 1 || 0 || 2 || 2 || 2 || 1 || 0 ||||||||||||
|| C || 1 || 1 || 0 || 1 || 0 || 2 || 1 || 3 || 1 || 0 ||||||||||||
|| D || 1 || 1 || 1 || 1 || 0 || 1 || 1 || 2 || 2 || 1 ||||||||||||


What is the smallest value of x for which this is a safe state?
24-08-2008 (18:17) από Άρης -
Αλλαγή σειρών 78-79 από:

σε:
Μπορούμε να πάρουμε περιπτώσεις και να τις μελετήσουμε.

* Με 3 διεργασίες κάθε μία μπορεί να έχει 2 drives. Δεν έχουμε αδιέξοδο.

* Με 4 διεργασίες η κατανομή των drives είναι (2, 2, 1, 1). Οι δύο διεργασίες έχουν το πλήθος που απαιτούν. Ελευθερώνουν τα στιγμιότυπα και οι άλλες δύο μπορούν να τα δεσμεύσουν. Δεν έχουμε αδιέξοδο.

* Με 5 διεργασίες η κατανομή των drives είναι (2, 1, 1, 1, 1). Η μία διεργασία το πλήθος που απαιτεί. Όταν το ελευθερώσει έχουμε την παραπάνω περίπτωση (4 διεργασίες). Δεν έχουμε αδιέξοδο.

* Με 6 διεργασίες η κατανομή των drives είναι (1, 1, 1, 1, 1, 1). Εδώ κάθε διεργασία περιμένει για ένα ακόμη drive. Σ' αυτήν την περίπτωση έχουμε αδιέξοδο.
24-08-2008 (18:08) από Άρης -
Αλλαγή σειρών 228-229 από:
* @@'''Available'''@@: Διάνυσμα μήκους @@m@@. Αν @@Available[j] = k@@, υπάρχουν @@k@@ στιγμιότυπα του τύπου πόρου @@R'_j_'@@ διαθέσιμα.
σε:
* @@'''Existence'''@@: Διάνυσμα μήκους @@m@@. Το @@Existence[j]@@ δίνει το μέγιστο πλήθος στιγμιότυπων του πόρου @@R'_j_'@@.
* @@'''Available'''@@: Διάνυσμα μήκους @@m@@. Αν @@Available[j] = k@@, υπάρχουν @@k@@ στιγμιότυπα του τύπου πόρου @@R'_j_'@@ διαθέσιμα.
Αλλαγή σειρών 232-235 από:
* @@'''Need'''@@: @@n x m@@ πίνακας. Αν @@Need[i,j] = k@@, τότε η διεργασία @@P'_i_'@@ μπορεί να χρειαστεί @@k@@ επιπλέον στιγμιότυπα του πόρου @@R'_j_'@@ για να ολοκληρωθεί.

%center%@@Need[i,j] = Max[i,j] – Allocation [i,j]@@
σε:
* @@'''Request'''@@: @@n x m@@ πίνακας. Αν @@Request[i,j] = k@@, τότε η διεργασία @@P'_i_'@@ μπορεί να χρειαστεί @@k@@ επιπλέον στιγμιότυπα του πόρου @@R'_j_'@@ για να ολοκληρωθεί.

%center%@@Request[i,j] = Max[i,j] – Allocation [i,j]@@
Αλλαγή σειράς 333 από:
(:caption:)Need
σε:
(:caption:)Request
Αλλαγή σειράς 438 από:
(:caption:)Need
σε:
(:caption:)Request
24-08-2008 (17:38) από Άρης -
24-08-2008 (17:31) από Άρης -
Αλλαγή σειράς 443 από:
(:row align=center style='background-color: lightyellow;':)
σε:
(:row align=center:)
Αλλαγή σειρών 466-468 από:
Σ' αυτό το σημείο μόνο η Ρ1 μπορεί να δεσμεύσει τους πόρους που χρειάζεται. Ολοκληρώνοντας έχουμε.

σε:
Απ' αυτό το σημείο οποιαδήποτε από τις διεργασίες που παραμένουν μπορεί να ολοκληρώσει αφού υπάρχουν οι διαθέσιμοι πόροι.
24-08-2008 (17:25) από Άρης -
Πρόσθεση σειρών 362-363:
Προσέχουμε στον πίνακα Available. Η Ρ2 δεσμεύοντας το ένα στιγμιότυπο του πόρου R3, έχει Allocated: 6 1 3 και ο Availabe: 0 1 0. Ο Availabe μετά την ολοκλήρωση της Ρ2 είναι το άθροισμα των παραπάνω.
Αλλαγή σειράς 375 από:
(:cell:)4
σε:
(:cell:)3
24-08-2008 (17:20) από Άρης -
Αλλαγή σειράς 373 από:
(:cell:)3
σε:
(:cell:)4
Αλλαγή σειράς 459 από:
(:cell:)4
σε:
(:cell:)2
24-08-2008 (17:16) από Άρης -
Αλλαγή σειρών 360-361 από:
σε:
Βλέπουμε ότι η Ρ2 έχει μικρότερες απαιτήσεις από τις διαθέσιμες στο Available. Έτσι, δεσμεύει τους πόρους που χρειάζεται και αφού ολοκληρώσει τους ελευθερώνει. Οι πίνακες τώρα είναι όπως παρακάτω.
Πρόσθεση σειρών 464-466:
Σ' αυτό το σημείο μόνο η Ρ1 μπορεί να δεσμεύσει τους πόρους που χρειάζεται. Ολοκληρώνοντας έχουμε.

24-08-2008 (17:11) από Άρης -
Αλλαγή σειράς 356 από:
(:cell:)4
σε:
(:cell:)2
Αλλαγή σειράς 449 από:
(:cell:)1
σε:
(:cell:)0
24-08-2008 (17:09) από Άρης -
Αλλαγή σειράς 382 από:
(:row align=center style='background-color: lightyellow;':)
σε:
(:row align=center:)
Αλλαγή σειράς 440 από:
(:row align=center:)
σε:
(:row align=center style='background-color: lightyellow;':)
Αλλαγή σειράς 445 από:
(:row align=center style='background-color: lightyellow;':)
σε:
(:row align=center:)
24-08-2008 (17:07) από Άρης -
Αλλαγή σειράς 361 από:
(:table cellpadding=2px align=center:)
σε:
(:table cellpadding=2px:)
Αλλαγή σειρών 370-372 από:
(:cell:)0
(:cell:)1
(:cell:)1
σε:
(:cell:)6
(:cell:)2
(:cell:)3
Αλλαγή σειράς 382 από:
(:row align=center:)
σε:
(:row align=center style='background-color: lightyellow;':)
Αλλαγή σειρών 418-420 από:
(:cell:)6
(:cell:)1
(:cell:)2
σε:
(:cell:)0
(:cell:)0
(:cell:)0
Πρόσθεση σειράς 432:
(:cell:)
24-08-2008 (17:04) από Άρης -
Αλλαγή σειρών 360-362 από:
>><<

σε:

(:table cellpadding=2px align=center:)
(:cell:)
(:table:)
(:caption:)Available
Αλλαγή σειρών 366-378 από:

!!! Ερώτηση



>>answer<<

!!! Απάντηση



>><<
σε:
(:head:)R1
(:head:)R2
(:head:)R3
(:row align=center :)
(:cell:)0
(:cell:)1
(:cell:)1
(:tableend:)
(:cell:)
(:table:)
(:caption:)Max
Αλλαγή σειρών 378-390 από:

!!! Ερώτηση



>>answer<<

!!! Απάντηση



>><<
σε:
(:head:)
(:head:)R1
(:head:)R2
(:head:)R3
(:row align=center:)
(:head:)P1
(:cell:)3
(:cell:)2
(:cell:)2
(:row align=center:)
(:head:)P2
(:cell:)6
(:cell:)1
(:cell:)3
(:row align=center:)
(:head:)P3
(:cell:)3
(:cell:)1
(:cell:)4
(:row align=center:)
(:head:)P4
(:cell:)4
(:cell:)2
(:cell:)2
(:tableend:)
(:cell:)
(:table:)
(:caption:)Allocated
Αλλαγή σειρών 407-409 από:


σε:
(:head:)
(:head:)R1
(:head:)R2
(:head:)R3
(:row align=center:)
(:head:)P1
(:cell:)1
(:cell:)0
(:cell:)0
(:row align=center:)
(:head:)P2
(:cell:)6
(:cell:)1
(:cell:)2
(:row align=center:)
(:head:)P3
(:cell:)2
(:cell:)1
(:cell:)1
(:row align=center:)
(:head:)P4
(:cell:)0
(:cell:)0
(:cell:)2
(:tableend:)
(:table:)
(:caption:)Need
Αλλαγή σειρών 435-466 από:
σε:
(:head:)
(:head:)R1
(:head:)R2
(:head:)R3
(:row align=center:)
(:head:)P1
(:cell:)2
(:cell:)2
(:cell:)2
(:row align=center style='background-color: lightyellow;':)
(:head:)P2
(:cell:)0
(:cell:)0
(:cell:)1
(:row align=center:)
(:head:)P3
(:cell:)1
(:cell:)0
(:cell:)3
(:row align=center:)
(:head:)P4
(:cell:)4
(:cell:)4
(:cell:)0
(:tableend:)
(:tableend:)

>><<


----
Πρόσθεση σειρών 479-510:
----

!!! Ερώτηση



>>answer<<

!!! Απάντηση



>><<

----



----

!!! Ερώτηση



>>answer<<

!!! Απάντηση



>><<
24-08-2008 (17:00) από Άρης -
24-08-2008 (16:51) από Άρης -
Αλλαγή σειρών 329-333 από:


>><<

σε:
Ψάχνουμε να βρούμε μία γραμμή της οποίας οι επιπλέον απαιτήσεις σε πόρους είναι μικρότερες ή ίσες από το Availabe. Αν φτιάξουμε τον πίνακα Need από τη σχέση @@Need[i,j] = Max[i,j] – Allocation [i,j]@@, έχουμε.

(:table:)
(:caption:)Need
Αλλαγή σειρών 334-364 από:
σε:
(:head:)
(:head:)R1
(:head:)R2
(:head:)R3
(:row align=center:)
(:head:)P1
(:cell:)2
(:cell:)2
(:cell:)2
(:row align=center style='background-color: lightyellow;':)
(:head:)P2
(:cell:)0
(:cell:)0
(:cell:)1
(:row align=center:)
(:head:)P3
(:cell:)1
(:cell:)0
(:cell:)3
(:row align=center:)
(:head:)P4
(:cell:)4
(:cell:)4
(:cell:)0
(:tableend:)

>><<


----
24-08-2008 (16:27) από Άρης -
Αλλαγή σειρών 239-240 από:
-----------------------------------
σε:
(:table cellpadding=2px align=center:)
(:cell:)
Διαγραφή σειράς 241:
-----------------------------------
Αλλαγή σειρών 243-244 από:
-----------------------------------
(headnr:)R1
σε:
----
(:row align=center:)
(:head:)R1
Αλλαγή σειράς 248 από:
-----------------------------------
σε:
(:row align=center :)
Διαγραφή σειράς 251:
-----------------------------------
Αλλαγή σειρών 253-286 από:
-----------------------------------


||! Available ||||||
|| R1 || R2 || R3 ||
|| 0 || 1 || 1 ||


||! Max ||||||||
|| || R1 || R2 || R3 ||
||! P1 || 3 || 2 || 2 ||
||! P2 || 6 || 1 || 3 ||
||! P3 || 3 || 1 || 4 ||
||! P1 || 4 || 2 || 2 ||


||! Allocated ||||||||
|| || R1 || R2 || R3 ||
||! P1 || 1 || 0 || 0 ||
||! P2 || 6 || 1 || 2 ||
||! P3 || 2 || 1 || 1 ||
||! P1 || 0 || 0 || 2 ||



>>answer<<

!!! Απάντηση



>><<

σε:
(:cell:)
(:table:)
(:caption:)Available
Αλλαγή σειρών 257-269 από:

!!! Ερώτηση



>>answer<<

!!! Απάντηση



>><<
σε:
(:head:)R1
(:head:)R2
(:head:)R3
(:row align=center :)
(:cell:)0
(:cell:)1
(:cell:)1
(:tableend:)
(:cell:)
(:table:)
(:caption:)Max
Αλλαγή σειρών 269-281 από:

!!! Ερώτηση



>>answer<<

!!! Απάντηση



>><<
σε:
(:head:)
(:head:)R1
(:head:)R2
(:head:)R3
(:row align=center:)
(:head:)P1
(:cell:)3
(:cell:)2
(:cell:)2
(:row align=center:)
(:head:)P2
(:cell:)6
(:cell:)1
(:cell:)3
(:row align=center:)
(:head:)P3
(:cell:)3
(:cell:)1
(:cell:)4
(:row align=center:)
(:head:)P4
(:cell:)4
(:cell:)2
(:cell:)2
(:tableend:)
(:cell:)
(:table:)
(:caption:)Allocated
Αλλαγή σειρών 298-306 από:



----

!!! Ερώτηση


σε:
(:head:)
(:head:)R1
(:head:)R2
(:head:)R3
(:row align=center:)
(:head:)P1
(:cell:)1
(:cell:)0
(:cell:)0
(:row align=center:)
(:head:)P2
(:cell:)6
(:cell:)1
(:cell:)2
(:row align=center:)
(:head:)P3
(:cell:)2
(:cell:)1
(:cell:)1
(:row align=center:)
(:head:)P4
(:cell:)0
(:cell:)0
(:cell:)2
(:tableend:)
(:tableend:)
Πρόσθεση σειρών 333-379:

----

!!! Ερώτηση



>>answer<<

!!! Απάντηση



>><<

----

!!! Ερώτηση



>>answer<<

!!! Απάντηση



>><<

----



----

!!! Ερώτηση



>>answer<<

!!! Απάντηση



>><<
24-08-2008 (14:03) από Άρης -
Αλλαγή σειρών 239-240 από:
||
||! Total ||||||
σε:
-----------------------------------
(:table:)
-----------------------------------
(:caption:)Total
-----------------------------------
(headnr:)R1
(:head:)R2
(:head:)R3
-----------------------------------
(:cell:)9
(:cell:)3
(:cell:)6
-----------------------------------
(:tableend:)
-----------------------------------


||! Available ||||||
Διαγραφή σειρών 257-260:
|| 9 || 3 || 6 ||
||
||! Available ||||||
|| R1 || R2 || R3 ||
Αλλαγή σειρών 259-260 από:
||
σε:

Αλλαγή σειρών 267-268 από:
||
||! Max ||||||||
σε:


||! Allocated ||||||||
Αλλαγή σειρών 275-276 από:
(:tableend:)
σε:


24-08-2008 (13:34) από Άρης -
Αλλαγή σειράς 239 από:
(:table:)
σε:
||
Αλλαγή σειράς 243 από:
(:cell:)
σε:
||
Αλλαγή σειράς 247 από:
(:cell:)
σε:
||
Αλλαγή σειράς 254 από:
(:cell:)
σε:
||
24-08-2008 (13:29) από Άρης -
Πρόσθεση σειράς 239:
(:table:)
Αλλαγή σειράς 243 από:
σε:
(:cell:)
Αλλαγή σειρών 247-249 από:


σε:
(:cell:)
||! Max ||||||||
|| || R1 || R2 || R3 ||
||! P1 || 3 || 2 || 2 ||
||! P2 || 6 || 1 || 3 ||
||! P3 || 3 || 1 || 4 ||
||! P1 || 4 || 2 || 2 ||
(:cell:)
||! Max ||||||||
|| || R1 || R2 || R3 ||
||! P1 || 1 || 0 || 0 ||
||! P2 || 6 || 1 || 2 ||
||! P3 || 2 || 1 || 1 ||
||! P1 || 0 || 0 || 2 ||
(:tableend:)
24-08-2008 (13:22) από Άρης -
Αλλαγή σειρών 239-241 από:


σε:
||! Total ||||||
|| R1 || R2 || R3 ||
|| 9 || 3 || 6 ||

||! Available ||||||
|| R1 || R2 || R3 ||
|| 0 || 1 || 1 ||


24-08-2008 (13:14) από Άρης -
Αλλαγή σειρών 224-225 από:
----
σε:
! Δομές Δεδομένων για τον Αλγόριθμο του Τραπεζίτη

* @@'''n'''@@ = το πλήθος των διεργασιών,
* @@'''m'''@@ = το πλήθος τύπων πόρων
* @@'''Available'''@@: Διάνυσμα μήκους @@m@@. Αν @@Available[j] = k@@, υπάρχουν @@k@@ στιγμιότυπα του τύπου πόρου @@R'_j_'@@ διαθέσιμα.
* @@'''Max'''@@: @@n x m@@ πίνακας. Αν @@Max[i,j] = k@@, τότε η διεργασία @@P'_i_'@@ μπορεί να απαιτήσει κατά μέγιστο @@k@@ στιγμιότυπα του τύπου πόρου @@R'_j_'@@.
* @@'''Allocation'''@@: @@n x m@@ πίνακας. Αν @@Allocation[i,j] = k@@ τότε στη διεργασία @@P'_i_'@@ εκχωρούνται @@k@@ στιγμιότυπα του πόρου @@R'_j_'@@.
* @@'''Need'''@@: @@n x m@@ πίνακας. Αν @@Need[i,j] = k@@, τότε η διεργασία @@P'_i_'@@ μπορεί να χρειαστεί @@k@@ επιπλέον στιγμιότυπα του πόρου @@R'_j_'@@ για να ολοκληρωθεί.

%center%@@Need[i,j] = Max[i,j] – Allocation [i,j]@@
Αλλαγή σειρών 237-238 από:

σε:
Υπάρχουν 3 τύποι πόρων με πλήθος: R1 = 9, R2 = 3, R3 = 6. Είναι η παρακάτω κατάσταση ασφαλής;



24-08-2008 (13:05) από Άρης -
Αλλαγή σειρών 72-76 από:
Consider a computer system that runs 5000 jobs per month with no deadlock-prevention or deadlock-avoidance scheme. Deadlocks occur about twice per month, and the operator must terminate and rerun about 10 jobs per deadlock. Each job is worth about $2 (in CPU time), and the jobs terminated tend to be about half-done when they are aborted. A systems programmer has estimated that a deadlock-avoidance algorithm (such as the banker’s algorithm) could be installed in the system with an increase in the average execution time per job of about 10 percent. Since the machine currently has 30-percent idle time, all 5000 jobs per month could still be run, although turnaround time would increase by about 20 percent on average.

#%alpha% What are the arguments for installing the deadlock-avoidance algorithm?
# What are the arguments against installing the deadlock-avoidance algorithm?
σε:
Ένα σύστημα διαθέτει 6 όμοια tape drives και n σε πλήθος διεργασίες που ανταγωνίζονται για τη χρήση τους. Κάθε διεργασία μπορεί να απαιτήσει 2 tape drives. Για ποια τιμή του n το σύστημα είναι απαλλαγμένο από αδιέξοδα;
Αλλαγή σειρών 78-81 από:
#%alpha% In order to effectively determine whether or not a deadlock has occurred in this particular environment it is necessary to install either a deadlock prevention or avoidance scheme. By installing the deadlock avoidance algorithm, the variance in average waiting time would be reduced.

# If there is little priority placed on minimizing waiting time variance, then not installing this scheme would mean a reduction in constant cost.
σε:

Αλλαγή σειρών 86-87 από:
Students working at individual PCs in a computer laboratory send their files to be printed by a server which spools the files on its hard disk. Under what conditions may a deadlock occur if the disk space for the print spool is limited? How may the deadlock be avoided?
σε:
Υποθέστε ένα σύστημα με P διεργασίες και R όμοιους επαναχρησιμοποιήσιμους πόρους. Αν κάθε διεργασία μπορεί να απαιτήσει κατά μέγιστο 2 μονάδες πόρων, να αποδείξετε ότι δεν μπορεί να υπάρξει αδιέξοδο μόνον όταν ισχύει η συνθήκη P<=R-1.
Αλλαγή σειρών 92-93 από:
If the printer starts to print a file before the entire file has been received (this is often allowed to speed response), the disk may fill with other requests that can’t be printed until the first file is done, but which use up disk space needed to receive the file currently being printed. If the spooler does not start to print a file until the entire file has been spooled it can reject a request that is too big. Starting to print a file is equivalent to reserving the printer; if the reservation is deferred until it is known that the entire file can be received, a deadlock of the entire system can be avoided. The user with the file that won’t fit is still deadlocked of course, and must go to another facility that permits printing bigger files.
σε:

Αλλαγή σειρών 100-101 από:
In the preceding question which resources are preemptable and which are nonpreemptable?
σε:
Σε ένα σύστημα υπάρχουν N σε πλήθος ενεργές διεργασίες που διαμοιράζονται Μ μονάδες ενός επαναχρησιμοποιήσιμου πόρου R. Κάθε διεργασία μπορεί να απαιτήσει κατά μέγιστο 3 μονάδες του πόρου R. Να βρείτε ποια σχέση πρέπει να έχουν οι παράμετροι N και Μ ώστε να μην υπάρχει κίνδυνος αδιεξόδου.
Αλλαγή σειρών 106-107 από:
The printer is nonpreemptable; the system cannot start printing another job until the previous one is complete. The spool disk is preemptable; you can delete an incomplete file that is growing too large and have the user send it later, assuming the protocol allows that
σε:

Αλλαγή σειρών 114-115 από:
Ένα σύστημα διαθέτει 6 όμοια tape drives και n σε πλήθος διεργασίες που ανταγωνίζονται για τη χρήση τους. Κάθε διεργασία μπορεί να απαιτήσει 2 tape drives. Για ποια τιμή του n το σύστημα είναι απαλλαγμένο από αδιέξοδα;
σε:
Consider a computer system that runs 5000 jobs per month with no deadlock-prevention or deadlock-avoidance scheme. Deadlocks occur about twice per month, and the operator must terminate and rerun about 10 jobs per deadlock. Each job is worth about $2 (in CPU time), and the jobs terminated tend to be about half-done when they are aborted. A systems programmer has estimated that a deadlock-avoidance algorithm (such as the banker’s algorithm) could be installed in the system with an increase in the average execution time per job of about 10 percent. Since the machine currently has 30-percent idle time, all 5000 jobs per month could still be run, although turnaround time would increase by about 20 percent on average.

#%alpha% What are the arguments for installing the deadlock-avoidance algorithm?
# What are the arguments against installing the deadlock-avoidance algorithm?
Αλλαγή σειρών 123-124 από:

σε:
#%alpha% In order to effectively determine whether or not a deadlock has occurred in this particular environment it is necessary to install either a deadlock prevention or avoidance scheme. By installing the deadlock avoidance algorithm, the variance in average waiting time would be reduced.

# If there is little priority placed on minimizing waiting time variance, then not installing this scheme would mean a reduction in constant cost.
Αλλαγή σειρών 133-134 από:
Υποθέστε ένα σύστημα με P διεργασίες και R όμοιους επαναχρησιμοποιήσιμους πόρους. Αν κάθε διεργασία μπορεί να απαιτήσει κατά μέγιστο 2 μονάδες πόρων, να αποδείξετε ότι δεν μπορεί να υπάρξει αδιέξοδο μόνον όταν ισχύει η συνθήκη P<=R-1.
σε:
Students working at individual PCs in a computer laboratory send their files to be printed by a server which spools the files on its hard disk. Under what conditions may a deadlock occur if the disk space for the print spool is limited? How may the deadlock be avoided?
Αλλαγή σειρών 139-140 από:

σε:
If the printer starts to print a file before the entire file has been received (this is often allowed to speed response), the disk may fill with other requests that can’t be printed until the first file is done, but which use up disk space needed to receive the file currently being printed. If the spooler does not start to print a file until the entire file has been spooled it can reject a request that is too big. Starting to print a file is equivalent to reserving the printer; if the reservation is deferred until it is known that the entire file can be received, a deadlock of the entire system can be avoided. The user with the file that won’t fit is still deadlocked of course, and must go to another facility that permits printing bigger files.
Αλλαγή σειρών 147-148 από:
Σε ένα σύστημα υπάρχουν N σε πλήθος ενεργές διεργασίες που διαμοιράζονται Μ μονάδες ενός επαναχρησιμοποιήσιμου πόρου R. Κάθε διεργασία μπορεί να απαιτήσει κατά μέγιστο 3 μονάδες του πόρου R. Να βρείτε ποια σχέση πρέπει να έχουν οι παράμετροι N και Μ ώστε να μην υπάρχει κίνδυνος αδιεξόδου.
σε:
In the preceding question which resources are preemptable and which are nonpreemptable?
Αλλαγή σειρών 153-154 από:

σε:
The printer is nonpreemptable; the system cannot start printing another job until the previous one is complete. The spool disk is preemptable; you can delete an incomplete file that is growing too large and have the user send it later, assuming the protocol allows that
Πρόσθεση σειράς 157:
24-08-2008 (13:01) από 194.63.237.22 -
Διαγραφή σειρών 10-18:
! Γράφοι Εκχώρησης Πόρων

||width=60%
||Διεργασία || http://users.sch.gr/fergadis/images/OS/Deadlock/proccess.jpg ||
||Τύπος Πόρου με 4 Στιγμιότυπα || http://users.sch.gr/fergadis/images/OS/Deadlock/resource.jpg ||
||Η διεργασία P'_i_' ζητάει ένα στιγμιότυπο του πόρου R'_j_' || http://users.sch.gr/fergadis/images/OS/Deadlock/proccess-resource-request.jpg ||
||Η διεργασία P'_i_' δεσμεύει ένα στιγμιότυπο του πόρου R'_j_' || http://users.sch.gr/fergadis/images/OS/Deadlock/proccess-resource-get.jpg ||
||Η διεργασία P'_i_' απελευθερώνει ένα στιγμιότυπο του πόρου R'_j_' || http://users.sch.gr/fergadis/images/OS/Deadlock/proccess-resource-release.jpg ||
Αλλαγή σειρών 13-21 από:
Να σχεδιάσετε ένα γράφο εκχώρησης πόρων για τα παρακάτω:
*Η διεργασία P1 απαιτεί τον πόρο R1
*Η διεργασία P2 απαιτεί τον πόρο R3
*Ο πόρος R1 είναι δεσμευμένος από τη διεργασία P2
*Ο πόρος R2 είναι δεσμευμένος από τη διεργασία P1
*Ο πόρος R3 είναι δεσμευμένος από τη διεργασία P3

Υπάρχει αδιέξοδο; Θεωρείστε ότι κάθε πόρος έχει ένα στιγμιότυπο.
σε:
List three examples of deadlocks that are not related to a computer-system environment.
Αλλαγή σειρών 19-26 από:
Ο γράφος είναι ως εξής:

http://users.sch.gr/fergadis/images/OS/Deadlock/exercise1.png

Όπως φαίνεται από το γράφο δεν υπάρχει κύκλος, άρα δεν υπάρχει αδιέξοδο.

Ο πόρος R1 θα ελευθερωθεί κάποια στιγμή από την P2 και η Ρ1 θα μπορέσει να ολοκληρώσει. Επίσης, ο πόρος R3 θα ελευθερωθεί όταν ολοκληρώσει η Ρ3 και θα μπορέσει να ολοκληρώσει και η Ρ2.
σε:
# Two cars crossing a single lane bridge from opposite directions.
# A person going down a ladder while another person is climbing up the ladder.
# Two trains traveling toward each other on the same track.
Αλλαγή σειρών 29-36 από:
Ένα σύστημα αποτελείται από 4 διεργασίες, (Ρ1, Ρ2, Ρ3, Ρ4), και 3 τύπους από σειριακά επαναχρησιμοποιούμενους πόρους, (R1, R2, R3). Ο αριθμός των μονάδων των πόρων είναι E=<3,2,2>.
*Η διεργασία P1 κρατά 1 μονάδα του R1 και απαιτεί 1 μονάδα του R2
*Η διεργασία P2 κρατά 2 μονάδες του R2 και απαιτεί 1 μονάδα καθενός από τους R1 και R3.
*Η διεργασία P3 κρατά 1 μονάδα του R1 και απαιτεί 1 μονάδα του R2
*Η διεργασία P4 κρατά 2 μονάδες του R3 και απαιτεί 1 μονάδα του R1

Φτιάξτε το γράφο. Υπάρχει αδιέξοδο;
σε:
Is it possible to have a deadlock involving only one single process? Explain your answer.
Αλλαγή σειρών 35-48 από:
Ο γράφος είναι ως εξής:

http://users.sch.gr/fergadis/images/OS/Deadlock/exercise2.png

Όπως φαίνεται παρακάτω υπάρχουν τρεις κύκλοι.

http://users.sch.gr/fergadis/images/OS/Deadlock/exercise2a.png

http://users.sch.gr/fergadis/images/OS/Deadlock/exercise2b.png

http://users.sch.gr/fergadis/images/OS/Deadlock/exercise2c.png

Όλοι οι κύκλοι περνούν υποχρεωτικά από τον πόρο R1 ο οποίος έχει ένα στιγμιότυπο ελεύθερο. Το αν θα υπάρξει αδιέξοδο εξαρτάται σε ποια διεργασία θα δοθεί αυτός ο πόρος. Αν δοθεί στην Ρ2, τότε έχουμε αδιέξοδο διότι τότε όλες οι διεργασίες θα αιτούνται ένα ακόμη στιγμιότυπο άλλου πόρου το οποίο δεν είναι ελεύθερο. Αν δοθεί την Ρ4, τότε αυτή έχει όλους τους πόρους που χρειάζεται και μπορεί να ολοκληρώσει. Έτσι, αφήνει ελεύθερα τα δύο στιγμιότυπα που πόρου R3 και το ένα του R1. Αυτό δίνει τη δυνατότητα στην Ρ2 να δεσμεύσει τους πόρους που χρειάζεται και να ολοκληρώσει. Στη συνέχεια ολοκληρώνουν και οι Ρ1 και Ρ3 που έχουν χρειάζονταν τα στιγμιότυπα του πόρου R2.
σε:
No. This follows directly from the hold-and-wait condition.
Αλλαγή σειρών 43-44 από:

σε:
People have said that proper spooling would eliminate deadlocks. Certainly, it eliminates from contention card readers, plotters, printers, and so on. It is even possible to spool tapes (called staging them), which would leave the resources of CPU time, memory, and disk space. Is it possible to have a deadlock involving these resources? If it is, how could
such a deadlock occur? If it is not, why not? What deadlock scheme would seem best to eliminate these deadlocks (if any are possible), or what condition is violated (if they are not possible)?
Αλλαγή σειρών 50-51 από:

σε:
It is possible to still have a deadlock. Process P1 holds memory pages that are required by process P2 , while P2 is holding the CPU that is required by P1.The best way to eliminate these types of deadlock is to use preemption.
Αλλαγή σειρών 58-59 από:
Ένα σύστημα διαθέτει 6 όμοια tape drives και n σε πλήθος διεργασίες που ανταγωνίζονται για τη χρήση τους. Κάθε διεργασία μπορεί να απαιτήσει 2 tape drives. Για ποια τιμή του n το σύστημα είναι απαλλαγμένο από αδιέξοδα;
σε:
Consider a system consisting of four resources of the same type that are shared by three processes, each of which needs at most two resources. Show that the system is deadlock-free.
Αλλαγή σειρών 64-65 από:

σε:
Suppose the system is deadlocked. This implies that each process is holding one resource and is waiting for one more. Since there are three processes and four resources, one process must be able to obtain two resources. This process requires no more resources and therefore it will return its resources when done.
Αλλαγή σειρών 72-73 από:
Υποθέστε ένα σύστημα με P διεργασίες και R όμοιους επαναχρησιμοποιήσιμους πόρους. Αν κάθε διεργασία μπορεί να απαιτήσει κατά μέγιστο 2 μονάδες πόρων, να αποδείξετε ότι δεν μπορεί να υπάρξει αδιέξοδο μόνον όταν ισχύει η συνθήκη P<=R-1.
σε:
Consider a computer system that runs 5000 jobs per month with no deadlock-prevention or deadlock-avoidance scheme. Deadlocks occur about twice per month, and the operator must terminate and rerun about 10 jobs per deadlock. Each job is worth about $2 (in CPU time), and the jobs terminated tend to be about half-done when they are aborted. A systems programmer has estimated that a deadlock-avoidance algorithm (such as the banker’s algorithm) could be installed in the system with an increase in the average execution time per job of about 10 percent. Since the machine currently has 30-percent idle time, all 5000 jobs per month could still be run, although turnaround time would increase by about 20 percent on average.

#%alpha% What are the arguments for installing the deadlock-avoidance algorithm?
# What are the arguments against installing the deadlock-avoidance algorithm?
Αλλαγή σειρών 81-82 από:

σε:
#%alpha% In order to effectively determine whether or not a deadlock has occurred in this particular environment it is necessary to install either a deadlock prevention or avoidance scheme. By installing the deadlock avoidance algorithm, the variance in average waiting time would be reduced.

# If there is little priority placed on minimizing waiting time variance, then not installing this scheme would mean a reduction in constant cost.
Αλλαγή σειρών 91-92 από:
Σε ένα σύστημα υπάρχουν N σε πλήθος ενεργές διεργασίες που διαμοιράζονται Μ μονάδες ενός επαναχρησιμοποιήσιμου πόρου R. Κάθε διεργασία μπορεί να απαιτήσει κατά μέγιστο 3 μονάδες του πόρου R. Να βρείτε ποια σχέση πρέπει να έχουν οι παράμετροι N και Μ ώστε να μην υπάρχει κίνδυνος αδιεξόδου.
σε:
Students working at individual PCs in a computer laboratory send their files to be printed by a server which spools the files on its hard disk. Under what conditions may a deadlock occur if the disk space for the print spool is limited? How may the deadlock be avoided?
Αλλαγή σειρών 97-98 από:

σε:
If the printer starts to print a file before the entire file has been received (this is often allowed to speed response), the disk may fill with other requests that can’t be printed until the first file is done, but which use up disk space needed to receive the file currently being printed. If the spooler does not start to print a file until the entire file has been spooled it can reject a request that is too big. Starting to print a file is equivalent to reserving the printer; if the reservation is deferred until it is known that the entire file can be received, a deadlock of the entire system can be avoided. The user with the file that won’t fit is still deadlocked of course, and must go to another facility that permits printing bigger files.
Αλλαγή σειρών 105-106 από:

σε:
In the preceding question which resources are preemptable and which are nonpreemptable?
Αλλαγή σειρών 111-112 από:

σε:
The printer is nonpreemptable; the system cannot start printing another job until the previous one is complete. The spool disk is preemptable; you can delete an incomplete file that is growing too large and have the user send it later, assuming the protocol allows that
Αλλαγή σειρών 119-120 από:

σε:
Ένα σύστημα διαθέτει 6 όμοια tape drives και n σε πλήθος διεργασίες που ανταγωνίζονται για τη χρήση τους. Κάθε διεργασία μπορεί να απαιτήσει 2 tape drives. Για ποια τιμή του n το σύστημα είναι απαλλαγμένο από αδιέξοδα;
Αλλαγή σειρών 133-134 από:
List three examples of deadlocks that are not related to a computer-system environment.
σε:
Υποθέστε ένα σύστημα με P διεργασίες και R όμοιους επαναχρησιμοποιήσιμους πόρους. Αν κάθε διεργασία μπορεί να απαιτήσει κατά μέγιστο 2 μονάδες πόρων, να αποδείξετε ότι δεν μπορεί να υπάρξει αδιέξοδο μόνον όταν ισχύει η συνθήκη P<=R-1.
Αλλαγή σειρών 139-142 από:
# Two cars crossing a single lane bridge from opposite directions.
# A person going down a ladder while another person is climbing up the ladder.
# Two trains traveling toward each other on the same track.
σε:

Αλλαγή σειρών 147-148 από:
Is it possible to have a deadlock involving only one single process? Explain your answer.
σε:
Σε ένα σύστημα υπάρχουν N σε πλήθος ενεργές διεργασίες που διαμοιράζονται Μ μονάδες ενός επαναχρησιμοποιήσιμου πόρου R. Κάθε διεργασία μπορεί να απαιτήσει κατά μέγιστο 3 μονάδες του πόρου R. Να βρείτε ποια σχέση πρέπει να έχουν οι παράμετροι N και Μ ώστε να μην υπάρχει κίνδυνος αδιεξόδου.
Αλλαγή σειρών 153-154 από:
No. This follows directly from the hold-and-wait condition.
σε:

Αλλαγή σειρών 157-158 από:
----
σε:
! Γράφοι Εκχώρησης Πόρων

||width=60%
||Διεργασία || http://users.sch.gr/fergadis/images/OS/Deadlock/proccess.jpg ||
||Τύπος Πόρου με 4 Στιγμιότυπα || http://users.sch.gr/fergadis/images/OS/Deadlock/resource.jpg ||
||Η διεργασία P'_i_' ζητάει ένα στιγμιότυπο του πόρου R'_j_' || http://users.sch.gr/fergadis/images/OS/Deadlock/proccess-resource-request.jpg ||
||Η διεργασία P'_i_' δεσμεύει ένα στιγμιότυπο του πόρου R'_j_' || http://users.sch.gr/fergadis/images/OS/Deadlock/proccess-resource-get.jpg ||
||Η διεργασία P'_i_' απελευθερώνει ένα στιγμιότυπο του πόρου R'_j_' || http://users.sch.gr/fergadis/images/OS/Deadlock/proccess-resource-release.jpg ||
Αλλαγή σειρών 168-170 από:
People have said that proper spooling would eliminate deadlocks. Certainly, it eliminates from contention card readers, plotters, printers, and so on. It is even possible to spool tapes (called staging them), which would leave the resources of CPU time, memory, and disk space. Is it possible to have a deadlock involving these resources? If it is, how could
such a deadlock occur? If it is not, why not? What deadlock scheme would seem best to eliminate these deadlocks (if any are possible), or what condition is violated (if they are not possible)?
σε:
Να σχεδιάσετε ένα γράφο εκχώρησης πόρων για τα παρακάτω:
*Η διεργασία P1 απαιτεί τον πόρο R1
*Η διεργασία P2 απαιτεί τον πόρο R3
*Ο πόρος R1 είναι δεσμευμένος από τη διεργασία P2
*Ο πόρος R2 είναι δεσμευμένος από τη διεργασία P1
*Ο πόρος R3 είναι δεσμευμένος από τη διεργασία P3

Υπάρχει αδιέξοδο; Θεωρείστε ότι κάθε πόρος έχει ένα στιγμιότυπο.
Αλλαγή σειρών 181-182 από:
It is possible to still have a deadlock. Process P1 holds memory pages that are required by process P2 , while P2 is holding the CPU that is required by P1.The best way to eliminate these types of deadlock is to use preemption.
σε:
Ο γράφος είναι ως εξής:

http://users.sch.gr/fergadis/images/OS/Deadlock/exercise1.png

Όπως φαίνεται από το γράφο δεν υπάρχει κύκλος, άρα δεν υπάρχει αδιέξοδο.

Ο πόρος R1 θα ελευθερωθεί κάποια στιγμή από την P2 και η Ρ1 θα μπορέσει να ολοκληρώσει. Επίσης, ο πόρος R3 θα ελευθερωθεί όταν ολοκληρώσει η Ρ3 και θα μπορέσει να ολοκληρώσει και η Ρ2.
Αλλαγή σειρών 195-196 από:
Consider a system consisting of four resources of the same type that are shared by three processes, each of which needs at most two resources. Show that the system is deadlock-free.
σε:
Ένα σύστημα αποτελείται από 4 διεργασίες, (Ρ1, Ρ2, Ρ3, Ρ4), και 3 τύπους από σειριακά επαναχρησιμοποιούμενους πόρους, (R1, R2, R3). Ο αριθμός των μονάδων των πόρων είναι E=<3,2,2>.
*Η διεργασία P1 κρατά 1 μονάδα του R1 και απαιτεί 1 μονάδα του R2
*Η διεργασία P2 κρατά 2 μονάδες του R2 και απαιτεί 1 μονάδα καθενός από τους R1 και R3.
*Η διεργασία P3 κρατά 1 μονάδα του R1 και απαιτεί 1 μονάδα του R2
*Η διεργασία P4 κρατά 2 μονάδες του R3 και απαιτεί 1 μονάδα του R1

Φτιάξτε το γράφο. Υπάρχει αδιέξοδο;
Αλλαγή σειρών 207-208 από:
Suppose the system is deadlocked. This implies that each process is holding one resource and is waiting for one more. Since there are three processes and four resources, one process must be able to obtain two resources. This process requires no more resources and therefore it will return its resources when done.
σε:
Ο γράφος είναι ως εξής:

http://users.sch.gr/fergadis/images/OS/Deadlock/exercise2.png

Όπως φαίνεται παρακάτω υπάρχουν τρεις κύκλοι.

http://users.sch.gr/fergadis/images/OS/Deadlock/exercise2a.png

http://users.sch.gr/fergadis/images/OS/Deadlock/exercise2b.png

http://users.sch.gr/fergadis/images/OS/Deadlock/exercise2c.png

Όλοι οι κύκλοι περνούν υποχρεωτικά από τον πόρο R1 ο οποίος έχει ένα στιγμιότυπο ελεύθερο. Το αν θα υπάρξει αδιέξοδο εξαρτάται σε ποια διεργασία θα δοθεί αυτός ο πόρος. Αν δοθεί στην Ρ2, τότε έχουμε αδιέξοδο διότι τότε όλες οι διεργασίες θα αιτούνται ένα ακόμη στιγμιότυπο άλλου πόρου το οποίο δεν είναι ελεύθερο. Αν δοθεί την Ρ4, τότε αυτή έχει όλους τους πόρους που χρειάζεται και μπορεί να ολοκληρώσει. Έτσι, αφήνει ελεύθερα τα δύο στιγμιότυπα που πόρου R3 και το ένα του R1. Αυτό δίνει τη δυνατότητα στην Ρ2 να δεσμεύσει τους πόρους που χρειάζεται και να ολοκληρώσει. Στη συνέχεια ολοκληρώνουν και οι Ρ1 και Ρ3 που έχουν χρειάζονταν τα στιγμιότυπα του πόρου R2.
Αλλαγή σειρών 227-231 από:
Consider a computer system that runs 5000 jobs per month with no deadlock-prevention or deadlock-avoidance scheme. Deadlocks occur about twice per month, and the operator must terminate and rerun about 10 jobs per deadlock. Each job is worth about $2 (in CPU time), and the jobs terminated tend to be about half-done when they are aborted. A systems programmer has estimated that a deadlock-avoidance algorithm (such as the banker’s algorithm) could be installed in the system with an increase in the average execution time per job of about 10 percent. Since the machine currently has 30-percent idle time, all 5000 jobs per month could still be run, although turnaround time would increase by about 20 percent on average.

#%alpha% What are the arguments for installing the deadlock-avoidance algorithm?
# What are the arguments against installing the deadlock-avoidance algorithm?
σε:

Αλλαγή σειρών 233-236 από:
#%alpha% In order to effectively determine whether or not a deadlock has occurred in this particular environment it is necessary to install either a deadlock prevention or avoidance scheme. By installing the deadlock avoidance algorithm, the variance in average waiting time would be reduced.

# If there is little priority placed on minimizing waiting time variance, then not installing this scheme would mean a reduction in constant cost.
σε:

Πρόσθεση σειράς 237:
Αλλαγή σειρών 242-243 από:
Students working at individual PCs in a computer laboratory send their files to be printed by a server which spools the files on its hard disk. Under what conditions may a deadlock occur if the disk space for the print spool is limited? How may the deadlock be avoided?
σε:

Αλλαγή σειρών 248-249 από:
If the printer starts to print a file before the entire file has been received (this is often allowed to speed response), the disk may fill with other requests that can’t be printed until the first file is done, but which use up disk space needed to receive the file currently being printed. If the spooler does not start to print a file until the entire file has been spooled it can reject a request that is too big. Starting to print a file is equivalent to reserving the printer; if the reservation is deferred until it is known that the entire file can be received, a deadlock of the entire system can be avoided. The user with the file that won’t fit is still deadlocked of course, and must go to another facility that permits printing bigger files.
σε:

Αλλαγή σειρών 256-257 από:
In the preceding question which resources are preemptable and which are nonpreemptable?
σε:

Αλλαγή σειρών 262-263 από:
The printer is nonpreemptable; the system cannot start printing another job until the previous one is complete. The spool disk is preemptable; you can delete an incomplete file that is growing too large and have the user send it later, assuming the protocol allows that
σε:

Πρόσθεση σειρών 268-271:


----
24-08-2008 (12:53) από 194.63.239.168 -
Αλλαγή σειρών 73-74 από:
Ωστόσο όλοι οι κύκλοι περνούν υποχρεωτικά από τον πόρο R1 ο οποίος έχει ένα στιγμιότυπο ελεύθερο. Συνεπώς δεν υπάρχει αδιέξοδο.
σε:
Όλοι οι κύκλοι περνούν υποχρεωτικά από τον πόρο R1 ο οποίος έχει ένα στιγμιότυπο ελεύθερο. Το αν θα υπάρξει αδιέξοδο εξαρτάται σε ποια διεργασία θα δοθεί αυτός ο πόρος. Αν δοθεί στην Ρ2, τότε έχουμε αδιέξοδο διότι τότε όλες οι διεργασίες θα αιτούνται ένα ακόμη στιγμιότυπο άλλου πόρου το οποίο δεν είναι ελεύθερο. Αν δοθεί την Ρ4, τότε αυτή έχει όλους τους πόρους που χρειάζεται και μπορεί να ολοκληρώσει. Έτσι, αφήνει ελεύθερα τα δύο στιγμιότυπα που πόρου R3 και το ένα του R1. Αυτό δίνει τη δυνατότητα στην Ρ2 να δεσμεύσει τους πόρους που χρειάζεται και να ολοκληρώσει. Στη συνέχεια ολοκληρώνουν και οι Ρ1 και Ρ3 που έχουν χρειάζονταν τα στιγμιότυπα του πόρου R2.
23-08-2008 (19:34) από 194.63.239.168 -
Αλλαγή σειρών 50-54 από:
*Η διεργασία p1 κρατά 1 μονάδα του R1 και απαιτεί 1 μονάδα του R2
*Η διεργασία p2 κρατά 2 μονάδες του R2 και απαιτεί 1 μονάδα καθενός από τους R1 και R3.
*Η διεργασία p3 κρατά 1 μονάδα του R1 και απαιτεί 1 μονάδα του R2
*Η διεργασία p4 κρατά 2 μονάδες του R3 και απαιτεί 1 μονάδα του R1
σε:
*Η διεργασία P1 κρατά 1 μονάδα του R1 και απαιτεί 1 μονάδα του R2
*Η διεργασία P2 κρατά 2 μονάδες του R2 και απαιτεί 1 μονάδα καθενός από τους R1 και R3.
*Η διεργασία P3 κρατά 1 μονάδα του R1 και απαιτεί 1 μονάδα του R2
*Η διεργασία P4 κρατά 2 μονάδες του R3 και απαιτεί 1 μονάδα του R1

Φτιάξτε το γράφο. Υπάρχει αδιέξοδο;
Αλλαγή σειρών 65-66 από:
Όπως φαίνεται από το γράφο υπάρχουν δύο κύκλοι.
σε:
Όπως φαίνεται παρακάτω υπάρχουν τρεις κύκλοι.

http://users.sch.gr/fergadis/images/OS/Deadlock/exercise2a.png

http://users.sch.gr/fergadis/images/OS/Deadlock/exercise2b.png

http://users.sch.gr/fergadis/images/OS/Deadlock/exercise2c.png

Ωστόσο όλοι οι κύκλοι περνούν υποχρεωτικά από τον πόρο R1 ο οποίος έχει ένα στιγμιότυπο ελεύθερο. Συνεπώς δεν υπάρχει αδιέξοδο.
23-08-2008 (19:19) από 194.63.237.23 -
Αλλαγή σειρών 50-54 από:
σε:
*Η διεργασία p1 κρατά 1 μονάδα του R1 και απαιτεί 1 μονάδα του R2
*Η διεργασία p2 κρατά 2 μονάδες του R2 και απαιτεί 1 μονάδα καθενός από τους R1 και R3.
*Η διεργασία p3 κρατά 1 μονάδα του R1 και απαιτεί 1 μονάδα του R2
*Η διεργασία p4 κρατά 2 μονάδες του R3 και απαιτεί 1 μονάδα του R1
Αλλαγή σειρών 71-72 από:
List three examples of deadlocks that are not related to a computer-system environment.
σε:

Αλλαγή σειρών 77-80 από:
# Two cars crossing a single lane bridge from opposite directions.
# A person going down a ladder while another person is climbing up the ladder.
# Two trains traveling toward each other on the same track.
σε:

Αλλαγή σειρών 85-86 από:
Is it possible to have a deadlock involving only one single process? Explain your answer.
σε:
Ένα σύστημα διαθέτει 6 όμοια tape drives και n σε πλήθος διεργασίες που ανταγωνίζονται για τη χρήση τους. Κάθε διεργασία μπορεί να απαιτήσει 2 tape drives. Για ποια τιμή του n το σύστημα είναι απαλλαγμένο από αδιέξοδα;
Αλλαγή σειρών 91-92 από:
No. This follows directly from the hold-and-wait condition.
σε:

Αλλαγή σειρών 99-101 από:
People have said that proper spooling would eliminate deadlocks. Certainly, it eliminates from contention card readers, plotters, printers, and so on. It is even possible to spool tapes (called staging them), which would leave the resources of CPU time, memory, and disk space. Is it possible to have a deadlock involving these resources? If it is, how could
such a deadlock occur? If it is not, why not? What deadlock scheme would seem best to eliminate these deadlocks (if any are possible), or what condition is violated (if they are not possible)?
σε:
Υποθέστε ένα σύστημα με P διεργασίες και R όμοιους επαναχρησιμοποιήσιμους πόρους. Αν κάθε διεργασία μπορεί να απαιτήσει κατά μέγιστο 2 μονάδες πόρων, να αποδείξετε ότι δεν μπορεί να υπάρξει αδιέξοδο μόνον όταν ισχύει η συνθήκη P<=R-1.
Αλλαγή σειρών 105-106 από:
It is possible to still have a deadlock. Process P1 holds memory pages that are required by process P2 , while P2 is holding the CPU that is required by P1.The best way to eliminate these types of deadlock is to use preemption.
σε:

Αλλαγή σειρών 113-114 από:
Consider a system consisting of four resources of the same type that are shared by three processes, each of which needs at most two resources. Show that the system is deadlock-free.
σε:
Σε ένα σύστημα υπάρχουν N σε πλήθος ενεργές διεργασίες που διαμοιράζονται Μ μονάδες ενός επαναχρησιμοποιήσιμου πόρου R. Κάθε διεργασία μπορεί να απαιτήσει κατά μέγιστο 3 μονάδες του πόρου R. Να βρείτε ποια σχέση πρέπει να έχουν οι παράμετροι N και Μ ώστε να μην υπάρχει κίνδυνος αδιεξόδου.
Αλλαγή σειρών 119-120 από:
Suppose the system is deadlocked. This implies that each process is holding one resource and is waiting for one more. Since there are three processes and four resources, one process must be able to obtain two resources. This process requires no more resources and therefore it will return its resources when done.
σε:

Αλλαγή σειρών 127-131 από:
Consider a computer system that runs 5000 jobs per month with no deadlock-prevention or deadlock-avoidance scheme. Deadlocks occur about twice per month, and the operator must terminate and rerun about 10 jobs per deadlock. Each job is worth about $2 (in CPU time), and the jobs terminated tend to be about half-done when they are aborted. A systems programmer has estimated that a deadlock-avoidance algorithm (such as the banker’s algorithm) could be installed in the system with an increase in the average execution time per job of about 10 percent. Since the machine currently has 30-percent idle time, all 5000 jobs per month could still be run, although turnaround time would increase by about 20 percent on average.

#%alpha% What are the arguments for installing the deadlock-avoidance algorithm?
# What are the arguments against installing the deadlock-avoidance algorithm?
σε:

Αλλαγή σειρών 133-136 από:
#%alpha% In order to effectively determine whether or not a deadlock has occurred in this particular environment it is necessary to install either a deadlock prevention or avoidance scheme. By installing the deadlock avoidance algorithm, the variance in average waiting time would be reduced.

# If there is little priority placed on minimizing waiting time variance, then not installing this scheme would mean a reduction in constant cost.
σε:

Αλλαγή σειρών 141-142 από:
Students working at individual PCs in a computer laboratory send their files to be printed by a server which spools the files on its hard disk. Under what conditions may a deadlock occur if the disk space for the print spool is limited? How may the deadlock be avoided?
σε:

Αλλαγή σειρών 147-148 από:
If the printer starts to print a file before the entire file has been received (this is often allowed to speed response), the disk may fill with other requests that can’t be printed until the first file is done, but which use up disk space needed to receive the file currently being printed. If the spooler does not start to print a file until the entire file has been spooled it can reject a request that is too big. Starting to print a file is equivalent to reserving the printer; if the reservation is deferred until it is known that the entire file can be received, a deadlock of the entire system can be avoided. The user with the file that won’t fit is still deadlocked of course, and must go to another facility that permits printing bigger files.
σε:

Αλλαγή σειρών 155-156 από:
In the preceding question which resources are preemptable and which are nonpreemptable?
σε:
List three examples of deadlocks that are not related to a computer-system environment.
Αλλαγή σειρών 161-162 από:
The printer is nonpreemptable; the system cannot start printing another job until the previous one is complete. The spool disk is preemptable; you can delete an incomplete file that is growing too large and have the user send it later, assuming the protocol allows that
σε:
# Two cars crossing a single lane bridge from opposite directions.
# A person going down a ladder while another person is climbing up the ladder.
# Two trains traveling toward each other on the same track.
Αλλαγή σειρών 171-172 από:

σε:
Is it possible to have a deadlock involving only one single process? Explain your answer.
Αλλαγή σειρών 177-178 από:

σε:
No. This follows directly from the hold-and-wait condition.
Πρόσθεση σειρών 181-270:
----

!!! Ερώτηση

People have said that proper spooling would eliminate deadlocks. Certainly, it eliminates from contention card readers, plotters, printers, and so on. It is even possible to spool tapes (called staging them), which would leave the resources of CPU time, memory, and disk space. Is it possible to have a deadlock involving these resources? If it is, how could
such a deadlock occur? If it is not, why not? What deadlock scheme would seem best to eliminate these deadlocks (if any are possible), or what condition is violated (if they are not possible)?

>>answer<<

!!! Απάντηση

It is possible to still have a deadlock. Process P1 holds memory pages that are required by process P2 , while P2 is holding the CPU that is required by P1.The best way to eliminate these types of deadlock is to use preemption.

>><<

----

!!! Ερώτηση

Consider a system consisting of four resources of the same type that are shared by three processes, each of which needs at most two resources. Show that the system is deadlock-free.

>>answer<<

!!! Απάντηση

Suppose the system is deadlocked. This implies that each process is holding one resource and is waiting for one more. Since there are three processes and four resources, one process must be able to obtain two resources. This process requires no more resources and therefore it will return its resources when done.

>><<

----

!!! Ερώτηση

Consider a computer system that runs 5000 jobs per month with no deadlock-prevention or deadlock-avoidance scheme. Deadlocks occur about twice per month, and the operator must terminate and rerun about 10 jobs per deadlock. Each job is worth about $2 (in CPU time), and the jobs terminated tend to be about half-done when they are aborted. A systems programmer has estimated that a deadlock-avoidance algorithm (such as the banker’s algorithm) could be installed in the system with an increase in the average execution time per job of about 10 percent. Since the machine currently has 30-percent idle time, all 5000 jobs per month could still be run, although turnaround time would increase by about 20 percent on average.

#%alpha% What are the arguments for installing the deadlock-avoidance algorithm?
# What are the arguments against installing the deadlock-avoidance algorithm?

>>answer<<

!!! Απάντηση

#%alpha% In order to effectively determine whether or not a deadlock has occurred in this particular environment it is necessary to install either a deadlock prevention or avoidance scheme. By installing the deadlock avoidance algorithm, the variance in average waiting time would be reduced.

# If there is little priority placed on minimizing waiting time variance, then not installing this scheme would mean a reduction in constant cost.

>><<

----

!!! Ερώτηση

Students working at individual PCs in a computer laboratory send their files to be printed by a server which spools the files on its hard disk. Under what conditions may a deadlock occur if the disk space for the print spool is limited? How may the deadlock be avoided?

>>answer<<

!!! Απάντηση

If the printer starts to print a file before the entire file has been received (this is often allowed to speed response), the disk may fill with other requests that can’t be printed until the first file is done, but which use up disk space needed to receive the file currently being printed. If the spooler does not start to print a file until the entire file has been spooled it can reject a request that is too big. Starting to print a file is equivalent to reserving the printer; if the reservation is deferred until it is known that the entire file can be received, a deadlock of the entire system can be avoided. The user with the file that won’t fit is still deadlocked of course, and must go to another facility that permits printing bigger files.

>><<

----

!!! Ερώτηση

In the preceding question which resources are preemptable and which are nonpreemptable?

>>answer<<

!!! Απάντηση

The printer is nonpreemptable; the system cannot start printing another job until the previous one is complete. The spool disk is preemptable; you can delete an incomplete file that is growing too large and have the user send it later, assuming the protocol allows that

>><<

----

!!! Ερώτηση



>>answer<<

!!! Απάντηση



>><<
23-08-2008 (19:13) από 194.63.237.23 -
Πρόσθεση σειρών 41-42:
Ο πόρος R1 θα ελευθερωθεί κάποια στιγμή από την P2 και η Ρ1 θα μπορέσει να ολοκληρώσει. Επίσης, ο πόρος R3 θα ελευθερωθεί όταν ολοκληρώσει η Ρ3 και θα μπορέσει να ολοκληρώσει και η Ρ2.
Αλλαγή σειρών 49-50 από:
List three examples of deadlocks that are not related to a computer-system environment.
σε:
Ένα σύστημα αποτελείται από 4 διεργασίες, (Ρ1, Ρ2, Ρ3, Ρ4), και 3 τύπους από σειριακά επαναχρησιμοποιούμενους πόρους, (R1, R2, R3). Ο αριθμός των μονάδων των πόρων είναι E=<3,2,2>.
Αλλαγή σειρών 55-58 από:
# Two cars crossing a single lane bridge from opposite directions.
# A person going down a ladder while another person is climbing up the ladder.
# Two trains traveling toward each other on the same track.
σε:
Ο γράφος είναι ως εξής:

http://users.sch.gr/fergadis/images/OS/Deadlock/exercise2.png

Όπως φαίνεται από το γράφο υπάρχουν δύο κύκλοι.
Αλλαγή σειρών 67-68 από:
Is it possible to have a deadlock involving only one single process? Explain your answer.
σε:
List three examples of deadlocks that are not related to a computer-system environment.
Αλλαγή σειρών 73-74 από:
No. This follows directly from the hold-and-wait condition.
σε:
# Two cars crossing a single lane bridge from opposite directions.
# A person going down a ladder while another person is climbing up the ladder.
# Two trains traveling toward each other on the same track.
Αλλαγή σειρών 83-85 από:
People have said that proper spooling would eliminate deadlocks. Certainly, it eliminates from contention card readers, plotters, printers, and so on. It is even possible to spool tapes (called staging them), which would leave the resources of CPU time, memory, and disk space. Is it possible to have a deadlock involving these resources? If it is, how could
such a deadlock occur? If it is not, why not? What deadlock scheme would seem best to eliminate these deadlocks (if any are possible), or what condition is violated (if they are not possible)?
σε:
Is it possible to have a deadlock involving only one single process? Explain your answer.
Αλλαγή σειρών 89-90 από:
It is possible to still have a deadlock. Process P1 holds memory pages that are required by process P2 , while P2 is holding the CPU that is required by P1.The best way to eliminate these types of deadlock is to use preemption.
σε:
No. This follows directly from the hold-and-wait condition.
Αλλαγή σειρών 97-98 από:
Consider a system consisting of four resources of the same type that are shared by three processes, each of which needs at most two resources. Show that the system is deadlock-free.
σε:
People have said that proper spooling would eliminate deadlocks. Certainly, it eliminates from contention card readers, plotters, printers, and so on. It is even possible to spool tapes (called staging them), which would leave the resources of CPU time, memory, and disk space. Is it possible to have a deadlock involving these resources? If it is, how could
such a deadlock occur? If it is not, why not? What deadlock scheme would seem best to eliminate these deadlocks (if any are possible), or what condition is violated (if they are not possible)?
Αλλαγή σειρών 104-105 από:
Suppose the system is deadlocked. This implies that each process is holding one resource and is waiting for one more. Since there are three processes and four resources, one process must be able to obtain two resources. This process requires no more resources and therefore it will return its resources when done.
σε:
It is possible to still have a deadlock. Process P1 holds memory pages that are required by process P2 , while P2 is holding the CPU that is required by P1.The best way to eliminate these types of deadlock is to use preemption.
Αλλαγή σειρών 112-116 από:
Consider a computer system that runs 5000 jobs per month with no deadlock-prevention or deadlock-avoidance scheme. Deadlocks occur about twice per month, and the operator must terminate and rerun about 10 jobs per deadlock. Each job is worth about $2 (in CPU time), and the jobs terminated tend to be about half-done when they are aborted. A systems programmer has estimated that a deadlock-avoidance algorithm (such as the banker’s algorithm) could be installed in the system with an increase in the average execution time per job of about 10 percent. Since the machine currently has 30-percent idle time, all 5000 jobs per month could still be run, although turnaround time would increase by about 20 percent on average.

#%alpha% What are the arguments for installing the deadlock-avoidance algorithm?
# What are the arguments against installing the deadlock-avoidance algorithm?
σε:
Consider a system consisting of four resources of the same type that are shared by three processes, each of which needs at most two resources. Show that the system is deadlock-free.
Αλλαγή σειρών 118-121 από:
#%alpha% In order to effectively determine whether or not a deadlock has occurred in this particular environment it is necessary to install either a deadlock prevention or avoidance scheme. By installing the deadlock avoidance algorithm, the variance in average waiting time would be reduced.

# If there is little priority placed on minimizing waiting time variance, then not installing this scheme would mean a reduction in constant cost.
σε:
Suppose the system is deadlocked. This implies that each process is holding one resource and is waiting for one more. Since there are three processes and four resources, one process must be able to obtain two resources. This process requires no more resources and therefore it will return its resources when done.
Αλλαγή σειρών 126-127 από:
Students working at individual PCs in a computer laboratory send their files to be printed by a server which spools the files on its hard disk. Under what conditions may a deadlock occur if the disk space for the print spool is limited? How may the deadlock be avoided?
σε:
Consider a computer system that runs 5000 jobs per month with no deadlock-prevention or deadlock-avoidance scheme. Deadlocks occur about twice per month, and the operator must terminate and rerun about 10 jobs per deadlock. Each job is worth about $2 (in CPU time), and the jobs terminated tend to be about half-done when they are aborted. A systems programmer has estimated that a deadlock-avoidance algorithm (such as the banker’s algorithm) could be installed in the system with an increase in the average execution time per job of about 10 percent. Since the machine currently has 30-percent idle time, all 5000 jobs per month could still be run, although turnaround time would increase by about 20 percent on average.

#%alpha% What are the arguments for installing the deadlock-avoidance algorithm?
# What are the arguments against installing the deadlock-avoidance algorithm?
Αλλαγή σειρών 135-136 από:
If the printer starts to print a file before the entire file has been received (this is often allowed to speed response), the disk may fill with other requests that can’t be printed until the first file is done, but which use up disk space needed to receive the file currently being printed. If the spooler does not start to print a file until the entire file has been spooled it can reject a request that is too big. Starting to print a file is equivalent to reserving the printer; if the reservation is deferred until it is known that the entire file can be received, a deadlock of the entire system can be avoided. The user with the file that won’t fit is still deadlocked of course, and must go to another facility that permits printing bigger files.
σε:
#%alpha% In order to effectively determine whether or not a deadlock has occurred in this particular environment it is necessary to install either a deadlock prevention or avoidance scheme. By installing the deadlock avoidance algorithm, the variance in average waiting time would be reduced.

# If there is little priority placed on minimizing waiting time variance, then not installing this scheme would mean a reduction in constant cost.
Αλλαγή σειρών 145-146 από:
In the preceding question which resources are preemptable and which are nonpreemptable?
σε:
Students working at individual PCs in a computer laboratory send their files to be printed by a server which spools the files on its hard disk. Under what conditions may a deadlock occur if the disk space for the print spool is limited? How may the deadlock be avoided?
Αλλαγή σειρών 151-152 από:
The printer is nonpreemptable; the system cannot start printing another job until the previous one is complete. The spool disk is preemptable; you can delete an incomplete file that is growing too large and have the user send it later, assuming the protocol allows that
σε:
If the printer starts to print a file before the entire file has been received (this is often allowed to speed response), the disk may fill with other requests that can’t be printed until the first file is done, but which use up disk space needed to receive the file currently being printed. If the spooler does not start to print a file until the entire file has been spooled it can reject a request that is too big. Starting to print a file is equivalent to reserving the printer; if the reservation is deferred until it is known that the entire file can be received, a deadlock of the entire system can be avoided. The user with the file that won’t fit is still deadlocked of course, and must go to another facility that permits printing bigger files.
Αλλαγή σειρών 159-160 από:

σε:
In the preceding question which resources are preemptable and which are nonpreemptable?
Αλλαγή σειρών 165-166 από:

σε:
The printer is nonpreemptable; the system cannot start printing another job until the previous one is complete. The spool disk is preemptable; you can delete an incomplete file that is growing too large and have the user send it later, assuming the protocol allows that
Πρόσθεση σειρών 169-182:
----

!!! Ερώτηση



>>answer<<

!!! Απάντηση



>><<
23-08-2008 (18:42) από 194.63.239.168 -
Πρόσθεση σειρών 11-19:
! Γράφοι Εκχώρησης Πόρων

||width=60%
||Διεργασία || http://users.sch.gr/fergadis/images/OS/Deadlock/proccess.jpg ||
||Τύπος Πόρου με 4 Στιγμιότυπα || http://users.sch.gr/fergadis/images/OS/Deadlock/resource.jpg ||
||Η διεργασία P'_i_' ζητάει ένα στιγμιότυπο του πόρου R'_j_' || http://users.sch.gr/fergadis/images/OS/Deadlock/proccess-resource-request.jpg ||
||Η διεργασία P'_i_' δεσμεύει ένα στιγμιότυπο του πόρου R'_j_' || http://users.sch.gr/fergadis/images/OS/Deadlock/proccess-resource-get.jpg ||
||Η διεργασία P'_i_' απελευθερώνει ένα στιγμιότυπο του πόρου R'_j_' || http://users.sch.gr/fergadis/images/OS/Deadlock/proccess-resource-release.jpg ||
Αλλαγή σειρών 22-23 από:

σε:
Να σχεδιάσετε ένα γράφο εκχώρησης πόρων για τα παρακάτω:
*Η διεργασία P1 απαιτεί τον πόρο R1
*Η διεργασία P2 απαιτεί τον πόρο R3
*Ο πόρος R1 είναι δεσμευμένος από τη διεργασία P2
*Ο πόρος R2 είναι δεσμευμένος από τη διεργασία P1
*Ο πόρος R3 είναι δεσμευμένος από τη διεργασία P3

Υπάρχει αδιέξοδο; Θεωρείστε ότι κάθε πόρος έχει ένα στιγμιότυπο.
Αλλαγή σειρών 35-36 από:

σε:
Ο γράφος είναι ως εξής:

http://users.sch.gr/fergadis/images/OS/Deadlock/exercise1.png

Όπως φαίνεται από το γράφο δεν υπάρχει κύκλος, άρα δεν υπάρχει αδιέξοδο.
22-08-2008 (19:23) από Άρης -
Αλλαγή σειρών 105-106 από:
We can obtain the banker’s algorithm for a single resource type from the general banker’s algorithm simply by reducing the dimensionality of the various arrays by 1. Show through an example that the multiple-resource-type banker’s scheme cannot be implemented by individual application of the single-resource-type scheme to each resource type.
σε:
Students working at individual PCs in a computer laboratory send their files to be printed by a server which spools the files on its hard disk. Under what conditions may a deadlock occur if the disk space for the print spool is limited? How may the deadlock be avoided?
Αλλαγή σειρών 111-127 από:
Consider a system with resource types A, B, C and 2 processes P0, P1 and the following snapshot of the system.

[@ A B C
Available: 1 1 1@]

||border=1px
|| ||! Allocation ||! Max ||! Need ||
|| || @@A B C@@ || @@A B C@@ || @@A B C@@ ||
||! P0 || @@1 2 2@@ || @@2 3 4@@ || @@1 1 2@@ ||
||! P1 || @@1 1 2@@ || @@2 2 3@@ || @@1 2 1@@ ||

The system is not in a safe state. However, if we apply the single resource type banker’s algorithm to each resource type individually we get the following:
* the sequence < P0,P1 > satisfies the safety requirement for resource A
* the sequence < P0,P1 > satisfies the safety requirement for resource B
* the sequence < P1,P0 > satisfies the safety requirement for resource C
and thus the system should be in a safe state.
σε:
If the printer starts to print a file before the entire file has been received (this is often allowed to speed response), the disk may fill with other requests that can’t be printed until the first file is done, but which use up disk space needed to receive the file currently being printed. If the spooler does not start to print a file until the entire file has been spooled it can reject a request that is too big. Starting to print a file is equivalent to reserving the printer; if the reservation is deferred until it is known that the entire file can be received, a deadlock of the entire system can be avoided. The user with the file that won’t fit is still deadlocked of course, and must go to another facility that permits printing bigger files.
Αλλαγή σειρών 119-120 από:

σε:
In the preceding question which resources are preemptable and which are nonpreemptable?
Αλλαγή σειρών 125-126 από:

σε:
The printer is nonpreemptable; the system cannot start printing another job until the previous one is complete. The spool disk is preemptable; you can delete an incomplete file that is growing too large and have the user send it later, assuming the protocol allows that
22-08-2008 (19:00) από Άρης -
Αλλαγή σειρών 86-87 από:

σε:
Consider a computer system that runs 5000 jobs per month with no deadlock-prevention or deadlock-avoidance scheme. Deadlocks occur about twice per month, and the operator must terminate and rerun about 10 jobs per deadlock. Each job is worth about $2 (in CPU time), and the jobs terminated tend to be about half-done when they are aborted. A systems programmer has estimated that a deadlock-avoidance algorithm (such as the banker’s algorithm) could be installed in the system with an increase in the average execution time per job of about 10 percent. Since the machine currently has 30-percent idle time, all 5000 jobs per month could still be run, although turnaround time would increase by about 20 percent on average.

#%alpha% What are the arguments for installing the deadlock-avoidance algorithm?
# What are the arguments against installing the deadlock-avoidance algorithm?
Αλλαγή σειρών 95-96 από:

σε:
#%alpha% In order to effectively determine whether or not a deadlock has occurred in this particular environment it is necessary to install either a deadlock prevention or avoidance scheme. By installing the deadlock avoidance algorithm, the variance in average waiting time would be reduced.

# If there is little priority placed on minimizing waiting time variance, then not installing this scheme would mean a reduction in constant cost.
Αλλαγή σειρών 105-106 από:

σε:
We can obtain the banker’s algorithm for a single resource type from the general banker’s algorithm simply by reducing the dimensionality of the various arrays by 1. Show through an example that the multiple-resource-type banker’s scheme cannot be implemented by individual application of the single-resource-type scheme to each resource type.
Αλλαγή σειρών 111-112 από:

σε:
Consider a system with resource types A, B, C and 2 processes P0, P1 and the following snapshot of the system.

[@ A B C
Available: 1 1 1@]

||border=1px
|| ||! Allocation ||! Max ||! Need ||
|| || @@A B C@@ || @@A B C@@ || @@A B C@@ ||
||! P0 || @@1 2 2@@ || @@2 3 4@@ || @@1 1 2@@ ||
||! P1 || @@1 1 2@@ || @@2 2 3@@ || @@1 2 1@@ ||

The system is not in a safe state. However, if we apply the single resource type banker’s algorithm to each resource type individually we get the following:
* the sequence < P0,P1 > satisfies the safety requirement for resource A
* the sequence < P0,P1 > satisfies the safety requirement for resource B
* the sequence < P1,P0 > satisfies the safety requirement for resource C
and thus the system should be in a safe state.
20-08-2008 (19:44) από Άρης -
Πρόσθεση σειρών 1-4:
%define=answer block bgcolor=#c4d4e7 border='1px dashed #31659c' padding-left='10px' padding-right='10px'%

! Αδιέξοδα
Αλλαγή σειρών 9-138 από:
Projects can involve simulation: create a list of jobs consisting of requests and releases of resources (single type or multiple types). Ask the students to allocate the resources to prevent deadlock. This basically involves programming the Banker’s Algorithm.
σε:
Projects can involve simulation: create a list of jobs consisting of requests and releases of resources (single type or multiple types). Ask the students to allocate the resources to prevent deadlock. This basically involves programming the Banker’s Algorithm.

!!! Ερώτηση



>>answer<<

!!! Απάντηση



>><<

----

!!! Ερώτηση

List three examples of deadlocks that are not related to a computer-system environment.

>>answer<<

!!! Απάντηση

# Two cars crossing a single lane bridge from opposite directions.
# A person going down a ladder while another person is climbing up the ladder.
# Two trains traveling toward each other on the same track.

>><<

----

!!! Ερώτηση

Is it possible to have a deadlock involving only one single process? Explain your answer.

>>answer<<

!!! Απάντηση

No. This follows directly from the hold-and-wait condition.

>><<

----

!!! Ερώτηση

People have said that proper spooling would eliminate deadlocks. Certainly, it eliminates from contention card readers, plotters, printers, and so on. It is even possible to spool tapes (called staging them), which would leave the resources of CPU time, memory, and disk space. Is it possible to have a deadlock involving these resources? If it is, how could
such a deadlock occur? If it is not, why not? What deadlock scheme would seem best to eliminate these deadlocks (if any are possible), or what condition is violated (if they are not possible)?

>>answer<<

!!! Απάντηση

It is possible to still have a deadlock. Process P1 holds memory pages that are required by process P2 , while P2 is holding the CPU that is required by P1.The best way to eliminate these types of deadlock is to use preemption.

>><<

----

!!! Ερώτηση

Consider a system consisting of four resources of the same type that are shared by three processes, each of which needs at most two resources. Show that the system is deadlock-free.

>>answer<<

!!! Απάντηση

Suppose the system is deadlocked. This implies that each process is holding one resource and is waiting for one more. Since there are three processes and four resources, one process must be able to obtain two resources. This process requires no more resources and therefore it will return its resources when done.

>><<

----

!!! Ερώτηση



>>answer<<

!!! Απάντηση



>><<

----

!!! Ερώτηση



>>answer<<

!!! Απάντηση



>><<

----

!!! Ερώτηση



>>answer<<

!!! Απάντηση



>><<

----

!!! Ερώτηση



>>answer<<

!!! Απάντηση



>><<

----
22-07-2008 (18:57) από Άρης -
Πρόσθεση σειρών 1-5:
Deadlock is a problem that can only arise in a system with multiple active asynchronous processes. It is important that the students learn the three basic approaches to deadlock: prevention, avoidance, and detection (although the terms prevention and avoidance are easy to confuse).

It can be useful to pose a deadlock problem in human terms and ask why human systems never deadlock. Can the students transfer this understanding of human systems to computer systems?

Projects can involve simulation: create a list of jobs consisting of requests and releases of resources (single type or multiple types). Ask the students to allocate the resources to prevent deadlock. This basically involves programming the Banker’s Algorithm.

Τελευταία ενημέρωση: 05-09-2008 (16:25)

Copyright 2008 - Άρης Φεργάδης