Hi guys, just looking for a bit of help. I've fallen victim to a particularly bad teacher with concurrency and now i have an exam in 2 weeks. I've been relying on online tutorials but the vast majority of it still escapes me.

Can i ask what mutex is ? (mutual exclusion yes? but is it different?)

What atomicity is?

and what is wait set?

and any other tips would be helpful ! thank you

Dani AI

Generated

Thread starter asked for clear, exam-focused definitions; earlier replies included a search suggestion from and a non-constructive remark from . The following is a concise, practical summary to memorize and apply.

A mutex is the mechanism that enforces mutual exclusion: it ensures only one thread runs a protected critical section at a time. In Java, an object's monitor used by synchronized acts as a mutex; ReentrantLock is an explicit mutex with extras like tryLock, timed waits, and multiple Condition objects. Think “mutex = the tool,” “mutual exclusion = the guarantee.”

Atomicity means an operation appears to happen all at once to other threads. Simple reads/writes of most primitives and object references are atomic; compound actions (read–modify–write, e.g. increment) are not. Make compound operations atomic with synchronized or classes in java.util.concurrent.atomic (for example, AtomicInteger). volatile helps visibility but does not make compound operations atomic.

A wait set belongs to the monitor model: a thread that calls obj.wait() releases that monitor and joins that object’s wait set. Threads in the wait set can be awakened by notify/notifyAll, interrupts, or spurious wakeups. Always wait in a loop that rechecks the condition, for example while (!condition) obj.wait();. Prefer higher-level utilities (BlockingQueue, Condition, CountDownLatch) when possible for clearer, safer code.

Memorize these idioms, understand the difference between visibility and atomicity, and practice tracing small interleavings and lock-order scenarios (deadlocks). For authoritative Java examples and patterns see the Java Concurrency Tutorial.

Recommended Answers

All 5 Replies

Are you sure you are posting your question to the right forum?
Have you tried searching the net for those terms?

1st fundamental flaw: blaming your teacher.
2nd fundamental flaw: claiming to have studied yet clearly not even grasping the basics.

Is fundamental flaw 3 jumping to assumptions based on inaccurate information just for the sake of sounding condescending ? or just being a jerk for no good reason?

I blame my teacher because the notes are incoherant, do not make sense and do not provide definitions for what they are referring to, and because the teacher spends each lecture discussing the slides with ihimself, explaining they're not his slides so its not his fault, with us trying to make sense of uncompilable dead pseudo code. But thank you for pointing out that its been my fault all along.

And i do grasp the basics i even wrote a program using semaphores. The theory escapes me.


To the other guy, well mutex i wasn't sure of its relevance to mutual exclusion.

Atomicity - i couldn't find well defined in relevence to software.

Annnnd wait set i couldn't really find.

I was kinda hoping for some experienced developers defining it in a way i could apply.

I used those terms at yahoo and got lots of info. I combined them with java:
>mutual exclusion java
>atomicity java
>wait set java

The links seem to have lots of info. I don't know any more in order to help you.

Ah its okay man thank you.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.