For example, if a project need a log system, instead of direct writing log file or wrap the log file in a monitor object, we could start a dedicated log-thread which is the only thread that will log.
If the other threads want to write a log, it send a message to this dedicated thread. Then, the log-thread could sequentially write the log from its message queue to the log file.
I think this is a better design than the multithreaded-one in which each routine writing log should use some kind of synchronization scheme.
So am I right? Could you provide more methods/examples to turn a multithreading problem to a simple single-thread problem?
In a design where a dedicated thread is the only one writing to the log you must use synchronization too, except that instead of synchronizing access to the log you need to synchronize access to the producer-consumer queue of the thread that writes to the log.
The problem by no means has become simpler: the need of synchronization did not go away, only got moved from one place to the other.