Is it possible to share a HashMap between threads without locking the entire HashMap?

I don’t see how your request is possible, at least not without some exceedingly clever lock-free data structures; what should happen if multiple threads need to insert new values that hash to the same location? In previous work, I’ve used a RwLock<HashMap<K, Mutex<V>>>. When inserting a value into the hash, you get an exclusive lock … Read more

What is the difference between lightweight process and thread?

I am not sure that answers are correct here, so let me post my version. There is a difference between process – LWP (lightweight process) and user thread. I will leave process definition aside since that’s more or less known and focus on LWP vs user threads. LWP is what essentially are called today threads. … Read more

Difference between Mutex, Semaphore & Spin Locks

First, remember the goal of these ‘synchronizing objects’ : These objects were designed to provide an efficient and coherent use of ‘shared data’ between more than 1 thread among 1 process or from different processes. These objects can be ‘acquired’ or ‘released’. That is it!!! End of story!!! Now, if it helps to you, let … Read more

Why is async considered better performing than multithreading? [closed]

why is the general consensus that async is better performing than multithreading? (added: I’m talking about the case where either approach is viable and you get to make a choice) On the server side, async lets you make maximum use of threads. Why have one thread handle a single connection when it can handle hundreds? … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)