NEW CD SET 2

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 similarity between sleep() and yield()?
Both let a thread pause without releasing its locks, and neither blocks on a condition.
2
New cards
What are the 4 necessary conditions for deadlock?
The four conditions are mutual exclusion, hold and wait, no pre-emption, and circular wait.
3
New cards
Why can't semaphores generally be used as locks?
Semaphores don't check ownership, so any thread can call release(), even one that never called acquire().
4
New cards
Describe the classic 3-state thread model and its transitions.
The three states are Ready, Running, and Blocked. The scheduler swaps a thread between Ready and Running, and I/O or lock waits send it to Blocked.
5
New cards
What does tryLock() do?
tryLock() grabs the lock only if it's free right now, returning true or false immediately instead of blocking.
6
New cards
What's the difference between coarse-grained and fine-grained locking?
Coarse-grained locking uses one lock for everything — simple, but serializes all access. Fine-grained gives each element its own lock for more concurrency, at the cost of complexity.
7
New cards
What is the difference between a process and a thread?
A process has its own memory space. Threads share memory within a process, which makes sharing easy but risky without sync.
8
New cards
How do you get a list of IP addresses assigned to a network interface in Java?
Call NetworkInterface.getNetworkInterfaces() to list interfaces, then getInetAddresses() on each for its IPs.
9
New cards
What is the difference between a Predicate and a Function?
A Predicate's test() always returns a boolean. A Function's apply() can return any type.
10
New cards
What is the purpose of a synchronized block?
A synchronized block guarantees mutual exclusion and visibility between threads.