Common Problems with C-with-Ease programs

Under construction

You may also wish to look at Common problems with C++-with-Ease.

Some common problems:


Problem: Deadlock

Deadlock is when a number of processes (usually 2) are waiting on a resource that is locked by another process in the group. C-with-Ease will also signal deadlock when no processes in the system are ready to run (this is only true with the non-preemptive, single unix process implementation).

Cause: Too many gets

A common cause is for a programmer to try and remove more objects from a context than it contains.

Cause: Resource contention

If a pair of processes both want to lock a pair of resources (say be removing a value from a singleton and then replacing it to unlock), but obtain the locks in opposite orders, then it is possible for each to get a single lock and wait on the other to release its lock before continuing. This results in the two processes being deadlocked.

To avoid this, take care when performing an action that will block another process especially if you may block waiting for that process.

Of course, the example situation above is exceedingly simple: you may end up with deadlock involving a chain of processes and contexts.


Tim MacKenzie