Mutex on 1 byte shared resource
Is 开发者_开发问答Mutex required on 1 byte shared resource? If not then why not? Consider I am using normal desktop PC pentium IV , 32 bit. Will condition change if use core 2 duo?
It depends what you are going to do with it, but if you have multiple writers, implemented in C or C++, then yes you need a mutex - the size of the resource is not the issue.
CPU doesn't matter as the task scheduler is free to interrupt a thread at any time. Size doesn't matter. If it's shared then you need some method of locking.
精彩评论