NEW CD SET 4

0.0(0)
Studied by 0 people
call kaiCall Kai
Locked
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/9

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 7:14 PM on 7/7/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai
Chat

No analytics yet

Send a link to your students to track their progress

10 Terms

1
New cards
What is the difference between notify() and notifyAll()?
notify() wakes one random thread. notifyAll() wakes every waiting thread, and they compete for the lock.
2
New cards
What does the volatile keyword guarantee, and what doesn't it guarantee?
volatile makes sure every thread sees the latest value, but it doesn't make things like x++ atomic.
3
New cards
What's the difference when using a binary semaphore instead of a lock?
A binary semaphore has no ownership check, so any thread can release it — a ReentrantLock only lets the owner unlock.
4
New cards
How many methods does the Externalizable interface have?
Externalizable has two methods: writeExternal() and readExternal().
5
New cards
Why do static and instance variables together complicate concurrent access?
A synchronized instance method locks the object; a synchronized static method locks the class — so they don't protect each other.
6
New cards
What is the difference between CountDownLatch and CyclicBarrier?
A CountDownLatch counts down once and can't reset. A CyclicBarrier makes threads rendezvous repeatedly and resets automatically.
7
New cards
How is it determined which thread wakes up when notify() is called?
The JVM decides — it's not guaranteed to be FIFO or based on priority.
8
New cards
Why is concurrent programming hard to debug?
Bugs depend on thread timing, so a program can run fine for ages then fail unpredictably.
9
New cards
How does a fair lock affect waiting threads? Give an example.
If five threads call lock() one after another, a fair lock lets them through in that same order.
10
New cards
What is a cyclic barrier? Give an example of when you'd use one.
Three threads could each fill a third of an array, call await(), then all proceed once everyone's done.