DOC PREVIEW
UMD CMSC 330 - Quiz #4

This preview shows page 1 out of 2 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 2 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 2 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

CMSC330 Fall 2009 Quiz #4 Name Discussion Time (circle one): 10am 11am 12pm 1pm 2pm 3pm Instructions • You have 15 minutes for this quiz. • For partial credit, show all of your work and clearly indicate your answers. • Write neatly. Credit cannot be given for illegible answers. 1. (4 pts) Describe one way to ensure a program has no deadlocks. (There are several possible answers) 2. (8 pts) List all possible outputs from the following program. Indicate next to each possible output whether all threads complete at the end, or, if they do not, which threads remain blocked. l = new ReentrantLock(); c = l.newCondition() Thread 1 l.lock(); System.out.print("a "); c.await(); System.out.print("b "); c.signalAll(); System.out.print("c "); l.unlock(); Thread 2 l.lock(); System.out.print("e "); c.signalAll(); System.out.print("f "); c.await(); System.out.print("g "); l.unlock();3. (8 pts) For the following program, give two schedules under which the final value of either i or j differs in the two schedules. Give the schedule as a list of line numbers, and in each case, also give the final value of i and j. l = new ReentrantLock(); m = new ReentrantLock(); i = 0 j = 0 Thread 1 1. l.lock(); 2. i = 3; 3. l.unlock() 4. m.lock(); 5. j = 4; 6. m.unlock(); Thread 2 7. l.lock(); 8. i = 5; 9. j = 6; 10.


View Full Document

UMD CMSC 330 - Quiz #4

Documents in this Course
Exam #1

Exam #1

6 pages

Quiz #1

Quiz #1

2 pages

Midterm 2

Midterm 2

12 pages

Exam #2

Exam #2

7 pages

Ocaml

Ocaml

7 pages

Parsing

Parsing

38 pages

Threads

Threads

12 pages

Ruby

Ruby

7 pages

Quiz #3

Quiz #3

2 pages

Threads

Threads

7 pages

Quiz #4

Quiz #4

2 pages

Exam #2

Exam #2

6 pages

Exam #1

Exam #1

6 pages

Threads

Threads

34 pages

Threads

Threads

26 pages

Exam #2

Exam #2

9 pages

Exam #2

Exam #2

6 pages

Load more
Download Quiz #4
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Quiz #4 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Quiz #4 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?