Name_______________________________________ section ___________________
Here are two processes (actually, two copies of the same program). Show a sequence of steps such that, if both processes run on the same machine that has only 2 CDR drives, deadlock will occur. List all steps until deadlock has happened. Circle the earliest step in the sequence that guarantees deadlock will eventually occur.
|
A1. get name of CD to copy A2. While not((available (CDR-1) and available(CDR-2)) A3. Wait 5 seconds A4. Get control of a CDR A5. Get control of a CDR A6. Mount the original disk on 1st CDR A7. Read the first record A8. Mount a blank disk in second CDR A9. While there are more records to copy A10. Write the record to 2nd CDR A11. Read another record from 1st CDR A12. Close the copy on 2nd CDR A13. Release 2nd CDR A14. Release 1st CDR |
B1. get name of CD to copy B2. While not((available (CDR-1) and available(CDR-2)) B3. Wait 5 seconds B4. Get control of a CDR B5. Get control of a CDR B6. Mount the original disk on 1st CDR B7. Read the first record B8. Mount a blank disk in second CDR B9. While there are more records to copy B10. Write the record to 2nd CDR B11. Read another record from 1st CDR B12. Close the copy on 2nd CDR B13. Release 2nd CDR B14. Release 1st CDR |
If the computer system has three CDR drives, is it still possible for the processes above to be involved in deadlock over the CDR drives? If so, show a sequence that results in deadlock. If not, clearly explain why not.