100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Exam (elaborations)

Exam 2 COP4610 FSU Wang questions well answered graded A+

Rating
1.0
(1)
Sold
2
Pages
12
Grade
A+
Uploaded on
31-08-2024
Written in
2024/2025

Exam 2 COP4610 FSU Wang questions well answered graded A+

Institution
COp4610
Course
COp4610









Whoops! We can’t load your doc right now. Try again or contact support.

Written for

Institution
COp4610
Course
COp4610

Document information

Uploaded on
August 31, 2024
Number of pages
12
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

Content preview

Exam 2 COP4610 FSU Wang

Monitor - correct answer ✔✔a lock + condition variables



Lock - correct answer ✔✔provides mutual exclusion to shared data



Condition variable - correct answer ✔✔provides a queue for waiting threads inside a critical section



Hoare vs. Mesa monitors - correct answer ✔✔1.) Hoare Monitors (used in most textbooks)

a.) Signal() transfers the CPU directly to a waiting thread



2.) Mesa Monitors (used in most real operating systems)

a.) Signal() only puts a waiting thread on the scheduler's ready queue

b.) By the time the waken thread gets the CPU, the waiting condition may no longer be true and needs
to be retested



Correct a broken solution - correct answer ✔✔Reader() {

lock.Acquire();

while (activeWriters > 0

|| waitingWriters > 0) {

++waitingReaders;

okToRead.Wait(&lock);

--waitingReaders;

}

++activeReaders;

lock.Release();

// access database

lock.Acquire();

, --activeReaders;

if (activeReaders == 0 &&

waitingWriters > 0) {

okToWrite.Signal(&lock);

}

lock.Release();

}



Writer() {

lock.Acquire();

while (activeWriters > 0

|| activeReaders > 0) {

++waitingWriters;

okToWrite.Wait(&lock);

--waitingWriters;

}

++activeWriters;

lock.Release();

// access database

lock.Acquire();

--activeWriters;

if (waitingWriters > 0) {

okToWrite.Signal(&lock);

} else if (waitingReaders > 0) {

okToRead.Broadcast(&lock);

}

lock.Release();

}

Reviews from verified buyers

Showing all reviews
1 month ago

Not the actual exam what I bought, I basically bought the notes and it said that it was the exam.

1.0

1 reviews

5
0
4
0
3
0
2
0
1
1
Trustworthy reviews on Stuvia

All reviews are made by real Stuvia users after verified purchases.

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
7Eleven nursing
View profile
Follow You need to be logged in order to follow users or courses
Sold
286
Member since
3 year
Number of followers
208
Documents
11201
Last sold
6 days ago
7-Eleven

QUALITY WORK OF ALL KIND OF QUIZ,TEST or EXAM WITH GUARANTEE OF AN A+ Im an expert on major courses especially; psychology,Nursing, Human resource Management & Project writting.Assisting students with quality work is my first priority. I ensure scholarly standards in my documents . I assure a GOOD GRADE if you will use my work.

4.1

112 reviews

5
63
4
17
3
19
2
3
1
10

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions