2026 Jan CD short q's

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/6

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 9:02 PM on 8/6/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai
Chat

No analytics yet

Send a link to your students to track their progress

7 Terms

1
New cards
Explain how CompareAndSwap works?
CAS atomically compares a memory location to an expected value. If they match it swaps in a new value. If not, it does nothing and retries.
2
New cards

When is CAS better than locks?

CAS is better than locks under light contention, since a failed thread just retries instead of blocking.

3
New cards
What's the difference between deadlock prevention and deadlock avoidance?
Prevention removes a condition outright, like a fixed lock order. Avoidance checks at runtime if granting a resource could cause deadlock.
4
New cards

How can a reentrantlock be fair?

new ReentrantLock(true) gives the lock to the longest-waiting thread first, at the cost of some throughput.

5
New cards

Explain drawbacks of using parallel streams, list two

They run slower on small datasets due to the extra work of splitting and joining tasks. They can cause data errors if you modify shared variables or require strict processing order.

6
New cards

Explain how a server socket can prevent over threading and improve performance.

A thread pool caps how many threads handle connections at once, so extra clients queue instead of spawning new threads.

7
New cards
What is the difference between Callable and Runnable?
Runnable's run() returns nothing and can't throw checked exceptions. Callable's call() returns a value and can throw one, retrieved via a Future.