Is there a library for C that provides priority queues? [closed]

喜你入骨 提交于 2019-12-09 16:07:51

问题


Is there a library for C that provides priority queues? I'm interested in open source libraries that are commonly installed on Linux machines, something of the kind of glib, which provides some data structures.


回答1:


Some random link:

  • PQLib
  • libpqueue
  • pqueue-heap-c

Edit:

In general, books dealing with Linux Kernel and Linux System Programming contain valuable materials related to queues and their implemention details.




回答2:


You may be able to just use message queues, depending on how big the queues need to be.

With posix message queues (see man mq_overview) you can set message priorities.

Alternately, with System V message queues (msgget(), msgsnd(), msgrcv()), you can use the message type as a priority and try retrieving each priority (type) in sequence from highest priority to lowest.

In either case they're standard IPC, and should be available on any normal Linux distribution.



来源:https://stackoverflow.com/questions/8544856/is-there-a-library-for-c-that-provides-priority-queues

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!