Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
假设,我正在申请电影座位预订。场景是,3 个不同的请求同时出现在系统中。也没有毫秒的差异......如何处理请求?如何定义关键部分以及我需要使用什么策略。由于所有请求都在完全相同的时间,所以如何优先考虑哪个用户应该首先进行。
并发请求将由框架处理。要在代码中访问共享资源,您需要应用锁定机制。如果您的程序直接写入数据库,则需要应用数据库事务锁定。