用于管理队列和堆栈的设计模式? [英] Design pattern for managing queues and stacks?

查看:79
本文介绍了用于管理队列和堆栈的设计模式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否存在用于管理队列或堆栈的设计模式?例如,我们正在寻求管理任务列表。这些任务将被添加到组队列中,然后用户将能够拉出队列并将其添加到他们的个人队列中。

Is there a design pattern for managing a queue or a stack? For example, we are looking to manage a list of tasks. These tasks will be added to a group queue, users will then be able to pull off the queue and add them to their personal queue.

推荐答案

设计模式可以使用 队列堆栈,但是队列和堆栈本身并没有真正实现设计模式,它们实现了一个接口。

Design patterns can use queues and stacks, but the queues and stacks themselves don't really implement a design pattern, they implement an interface.

队列通常为 FIFO ,而堆栈是 LIFO

Queues are typically FIFO while stacks are LIFO.

由于许多用户可能同时使用数据结构,因此应使用正确的同步避免并发问题。

Since many users might be using the data structures simultaneously, you should use proper synchronization to avoid concurrency issues.

您是否在寻找要使用与并发相关的设计模式

这篇关于用于管理队列和堆栈的设计模式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆