Readers–writer lock Multithreading Scenario? [closed] - c++

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I have read a few links about Readers–writer lock. I had few doubts.
In case the system has to be designed for Multiple reads and single write ,and write should have priority.
In case the system has to be designed for multiple reads and multiple write
So should we be implementing a semaphore for multiple read and a mutex for multiple write? or when do i use a critical section?
Also,Does it depend on the operating system? (does it differ in case of Unix and Windows)?

Related

Replace critical section with boost::detail::spinlock cause dead lock on windows [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
My platform is vs2010 win2003 server, I have an application working well. There is an integer protected by a critical section, when I modify and use boost::detail::spinlock instead then it goes to dead lock.
It's boost::detail::spinlock. That means it's intended for internal use only. If you want portable replacement for critical sections, use boost::mutex from Boost.Thread.
It's boost::detail::spinlock. Spinlocks usually busy-wait, which makes them faster, but usable only under tightly controlled conditions.
Boost 1.53 (the latest release) finally got Boost.Atomic, which is a portable (and C++11 compatible) replacement for interlocked operations.

Is performance affected if multiple threads use the same object? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
The object in this case is a dictionary with some search methods. Only reading operations.
Quick answer: No.
Quite the opposite, it will speed up your program, especially if you have an object that needs to load a lot of data into memory.
Just make sure nothing can write to the object while the threads run.

Threads and synchronisation using pipe in c++ [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I have two threads. one thread generate a number and the other squares the number generated. I need to synchronise this action using pipes or semaphore or message queues . Help me with this problem
This is a wrong way to go. Generating an extra thread and synchronizing the two threads would require more CPU power than just squaring the number in the generator thread.
Implementing a pipeline is effective only when each step requires enough computational power to justify the extra thread.
As for your questions, I suggest you should read about the Producer-Consumer pattern. There are many implementations on the wild.

Sequential and running in one thread time difference c++ [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
Here is my source code for testing multithread performance in C++. Please tell me why is time about 5x smaller for ONE thread running(WaitForMultipleObject()) then first sequential performance. I expect almost same result for sequential performance and running with only one thread. Thanks
http://pastebin.com/EeJ5qW03
OS will decide when will your thread start running and it will also decide if there's a need for dispatching, perhaps. Add to that, it also has to create a separate stack for your thread, perhaps.
Read about the overhead on thread creation. All in all, the overhead is system specific.

Problem with Atomic operations on a intel XScale(ARM) processor - XScale-IXP42x Family - c++ [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
We are facing a possible problem on ARM processor machine.
We have done an implementation for smart pointers,which involves atomic operation for keeping track of the references.
We are getting crashes for that.
Is there a possible problem with atomic operations on ARM processor?
It's possible, but it's way more likely that there is a bug in your code.
Perhaps you should post some code.