You are not logged in.
Pages: 1
Hi!
Everyone says, that it hits performance very strong, when application performs many mutex locks and unlocks operations. Is it still true nowadays, when we use so fast computers?
Maybe I'll provide an example:
I have function, which sends data over net, we can say, that it's wrapper for stock recv() function. My function performs 4 lock/unlock operation on each execution and it can send 512 bytes at once. If I'll try to send 20 MB will I notice noticeable performance lose?
Offline
I really doubt you would see much difference... once you start dealing with network I/O, your processing is almost certainly going to be limited by the speed of the the network and not by the speed of your CPUs.
(I suppose if you had a blazing fast network and slow CPUs, there might be an exception to that, but that would be a pretty uncommon situation, I think).
One way to find out would be to try it with and without the locking, and see if you can detect any difference.
-Jeremy
Offline
It's not the locking and unlocking itself that causes performance problems,
It's when lock contention happens and multiple threads need to wait for each
other that things start to fall apart.
(Of course if you have exessive locking then it can be a performance problem.)
Offline
Pages: 1