locking

wait_event and lock interaction

倾然丶 夕夏残阳落幕 提交于 2021-01-28 05:09:22
问题 I'm new to linux kernel development and wonder how wait_event/wait_event_interruptible interacts with other locking primitives in the kernel. I'm used to C++ std::condition_variable::wait and want to achieve something similar in the kernel. I have a queue of receive buffers which are filled using DMA transfers. The list is protected using a spin lock. Finished buffers are added by the DMA finished soft IRQ. I created a character device which allows reading of the finished buffers. So far this

Is there any way to work with sessions without locking on ASP.Net MVC site?

爱⌒轻易说出口 提交于 2021-01-27 23:05:41
问题 Is there any way to work with sessions without locking on ASP.Net MVC site ? Session lock mechanism leads many problems; When your site slow down little bit, users are start to hit "F5" on the keyboard. When they do this, requests are starting to wait each other. All those requests are hanging on IIS at " RequestAcquireState " state for session module. If a user made a simultaneous requests this will happen. Because session module in IIS and default session provider (Or generally custom ones)

Redis store (or any database?) lock mechanism (NodeJS)

南笙酒味 提交于 2021-01-27 19:18:25
问题 I have the following problem: I'm using Redis with NodeJS together via mranney's driver and my NodeJS webserver is retrieving some data from Redis, doing some operations on it and saving it back to the Redis. But this operation (call it X) may take a while so multiple users can fire it at the same time on the same resources. So if a user A fires X and user B fires X at the same time I want user A to finish the job and then user B to get the (processed) data and do X. In the meantime user B

In MySQL Why does setting a variable from a select acquire a lock when using read uncommitted?

不羁岁月 提交于 2021-01-27 04:02:31
问题 We have a table in MySQL using InnoDB, and we are using a transaction isolation level of read uncommitted. Why does setting @x as shown acquire a lock? mysql> set @x = (select userID from users limit 1); Query OK, 0 rows affected (0.02 sec) mysql> Trying to update this table from another prompt results in a timeout error: mysql> update users set userID = 1; ERROR 1205 (HY000): Lock wait timeout exceeded; try restarting transaction 回答1: For what it's worth, this locking is not limited to READ

In MySQL Why does setting a variable from a select acquire a lock when using read uncommitted?

孤者浪人 提交于 2021-01-27 04:01:03
问题 We have a table in MySQL using InnoDB, and we are using a transaction isolation level of read uncommitted. Why does setting @x as shown acquire a lock? mysql> set @x = (select userID from users limit 1); Query OK, 0 rows affected (0.02 sec) mysql> Trying to update this table from another prompt results in a timeout error: mysql> update users set userID = 1; ERROR 1205 (HY000): Lock wait timeout exceeded; try restarting transaction 回答1: For what it's worth, this locking is not limited to READ

Does transaction release insert intention lock after insertion?

老子叫甜甜 提交于 2021-01-24 09:48:52
问题 After executing the below code, create table t(id int primary key); insert into t values (5),(10); -- session 1 start transaction; select * from t where id > 8 for share; -- session 2 start transaction; insert into t values(6); -- is blocked the output of select * from performance_schema.data_locks is: +--------+---------------------------------------+-----------------------+-----------+----------+---------------+-------------+----------------+-------------------+------------+----------------

Qt: How to lock/prevent a file from being read while it is written?

十年热恋 提交于 2021-01-21 10:28:39
问题 I am using Qt5 on Windows 7. In my current project I open a binary file in order to populate it with data coming from a TCP socket. Normally, after the file is populated, I close it and another application will read this binary file for further processing. Well, the problem is: The writing operation takes about 4-5 seconds (or even more) so I need to find a way to prevent the other application from reading from the binary file until the file is completely populated ... Here below is the code

TMREWSync (TMultiReadExclusiveWriteSynchronizer) questions

筅森魡賤 提交于 2021-01-20 09:05:33
问题 I have questions about TMREWSync: Is it possible to upgrade Read lock to Write lock without unlocking? Don't understand what I should do if BeginWrite returns false? 回答1: Yes, TMREWSync supports lock upgrades. Use it like: BeginRead ... BeginWrite ... EndWrite ... EndRead . Source code in System.SysUtils states: The function result of BeginWrite indicates whether another thread got the write lock while the current thread was waiting for the write lock. Return value of True means that the

Difference in internal storing between 'fair' and 'unfair' lock

ぐ巨炮叔叔 提交于 2021-01-18 06:25:09
问题 The way Lock interface with class Reentrant(true) lock works is that it uses BlockingQueue to store Threads that want to acquire the lock . In that way thread that 'came first, go out first'-FIFO. All clear about that. But where do 'unfair locks' go, or ReentrantLock(false). What is their internal implementation? How does OS decide which thread now to pick? And most importantly are now these threads also stored in a queue or where? (they must be somewhere) 回答1: The class ReentrantLock does

Difference in internal storing between 'fair' and 'unfair' lock

戏子无情 提交于 2021-01-18 06:25:07
问题 The way Lock interface with class Reentrant(true) lock works is that it uses BlockingQueue to store Threads that want to acquire the lock . In that way thread that 'came first, go out first'-FIFO. All clear about that. But where do 'unfair locks' go, or ReentrantLock(false). What is their internal implementation? How does OS decide which thread now to pick? And most importantly are now these threads also stored in a queue or where? (they must be somewhere) 回答1: The class ReentrantLock does