Threads, Processes
Version B
The CMY printer simulation
-
Demonstration
-
Description:
-
There are three layers (cyan, magenta and yellow) of an image (download
them here)
-
Each of the layers is put on the white paper pixel by pixel by a separate
thread
-
Each layer is being drawn starting from different corner
-
The program:
-
the visualisation of printing (see the demonstration)
-
Technical requirements:
-
No two threads should draw to the same pixel at the same time
-
Use Critical Section, Semaphore or Mutex for synchronisation
-
The visualisation should not flicker
-
No thread should be running after the main window is closed
-
The use of a Timer (CreateTimer, WM_TIMER) is forbidden
-
The use of busy waiting is forbidden
-
Hints:
-
CreateThread, _begin_thread()
-
CRITICAL_SECTION, CreateSemaphore(), CreateMutex()
-
WaitForSingleObject() (doesn't apply to CRITICAL_SECTION, so if you choose this
way of synchronisation, you need to deal with proper ending of the program in
some other way)
-
Approximate points:
-
the problem solution: 4.0
-
proper use and synchronisation of threads: 4.0
-
drawing: 2.0