ArticleslgStudy

computer science

Message queue

Message queue is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Message queue rather than just read about it. In short: In computer science, message queues and mailboxes are software-engineering components typically used for inter-process communication (IPC), or for inter-thread communication within the same process. They use a queue for messaging – the passing of control or of content.

Key takeaways

  • Message queue belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Message queue to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Message queue from memory before moving on to harder problems.

Reference excerpt

In computer science, message queues and mailboxes are software-engineering components typically used for inter-process communication (IPC), or for inter-thread communication within the same process. They use a queue for messaging – the passing of control or of content. Group communication systems provide similar kinds of functionality. The message queue paradigm is a sibling of the publisher/subscriber pattern, and is typically one part of a larger message-oriented middleware system. Most messaging systems support both the publisher/subscriber and message queue models in their API, e.g. Java Message Service (JMS). Competing Consumers pattern enables multiple concurrent consumers to process messages on the same message queue.

Remit and ownership Message queues implement an asynchronous communication pattern between two or more processes/threads whereby the sending and receiving party do not need to interact with the message queue at the same time. Messages placed onto the queue are stored until the recipient retrieves them. Message queues have implicit or explicit limits on the size of data that may be transmitted in a single message and the number of messages that may remain outstanding on the queue.

Remit Many implementations of message queues function internally within an operating system or within an application. Such queues exist for the purposes of that system only. Other implementations allow the passing of messages between different computer systems, potentially connecting multiple applications and multiple operating systems. These message queuing systems typically provide resilience functionality to ensure that messages do not get "lost" in the event of a system failure. Examples of commercial implementations of this kind of message queuing software (also known as message-oriented middleware) include IBM MQ (formerly MQ Series) and Oracle Advanced Queuing (AQ). There is a Java standard called Java Message Service, which has several proprietary and free software implementations. Real-time operating systems (RTOSes) such as VxWorks and QNX encourage the use of message queuing as the primary inter-process or inter-thread communication mechanism. This can result in integration between message passing and CPU scheduling. Early examples of commercial RTOSes that encouraged a message-queue basis to inter-thread communication also include VRTX and pSOS+, both of which date to the early 1980s. The Erlang programming language uses processes to provide concurrency; these processes communicate asynchronously using message queuing.

Ownership The message queue software can be either proprietary, open source or a mix of both. It is then run either on premise in private servers or on external cloud servers (message queuing service).

Proprietary options have the longest history, and include products from the inception of message queuing, such as IBM MQ, and those tied to specific operating systems, such as Microsoft Message Queuing (MSMQ). Cloud service providers also provide their proprietary solutions such as Amazon Simple Queue Service (SQS), StormMQ, Solace, and IBM MQ. Open source choices of messaging middleware systems includes Apache ActiveMQ, Apache Kafka, Apache Qpid, Apache RocketMQ, JBoss Messaging, RabbitMQ, Sun Open Message Queue, and Tarantool. Examples on hardware-based messaging middleware vendors are Solace, Apigee, and IBM MQ.

Usage In a typical message-queueing implementation, a system administrator installs and configures message-queueing software (a queue manager or broker), and defines a named message queue. Or they register with a message queuing service. An application then registers a software routine that "listens" for messages placed onto the queue. Second and subsequent applications may connect to the queue and transfer a message onto it. The queue-manager software stores the messages until a receiving application connects and then calls the registered software routine. The receiving application then processes the message in an appropriate manner. There are often numerous options as to the exact semantics of message passing, including:

Durability – messages may be kept in memory, written to disk, or even committed to a DBMS if the need for reliability indicates a more resource-intensive solution. Security policies – which applications should have access to these messages? Message purging policies – queues or messages may have a "time to live". Message filtering – some systems support filtering data so that a subscriber may only see messages matching some pre-specified criteria of interest. Delivery policies – do we need to guarantee that a message is delivered at least once, or no more than once? Routing policies – in a system with many queue servers, what servers should receive a message or a queue's messages? Batching policies – should messages be delivered immediately? Or should the system wait a bit and try to deliver many messages at once? Queuing criteria – when should a message be considered "enqueued"? When one queue has it? Or when it has been forwarded to at least one remote queue? Or to all queues? Receipt notification – A publisher may need to know when some or all subscribers have received a message. These are all considerations that can have substantial effects on transaction semantics, system reliability, and system efficiency.

Standards and protocols Historically, message queuing has used proprietary, closed protocols, restricting the ability for different operating systems or programming languages to interact in a heterogeneous set of environments. An early attempt to make message queuing more ubiquitous was Sun Microsystems' JMS specification, which provided a Java-only abstraction of a client API. This allowed Java developers to switch between providers of message queuing in a fashion similar to that of developers using SQL databases. In practice, given the diversity of message queuing techniques and scenarios, this wasn't always as practical as it could be. Three standards have emerged which are used in open source message queue implementations:

… excerpt ends here. Continue reading the full article.

Worked examples

Example 1 — a first encounter with Message queue

Start with the simplest possible case. Write down what Message queue claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Message queue before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Message queue ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Message queue

In research
Message queue appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Message queue in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Message queue is common in secondary-school and first-year university syllabi. It links to neighbouring topics Events (computing), Inter-process communication, Queue management, so understanding it makes those chapters shorter.
In everyday life
Look for Message queue outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Message queue” →

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study Message queue in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Message queue means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Message queue out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Message queue in simple terms?

In computer science, message queues and mailboxes are software-engineering components typically used for inter-process communication (IPC), or for inter-thread communication within the same process. They use a queue for messaging – the passing of control or of content.

Why does Message queue matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Message queue?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Message queue.

Tags

  • Events (computing)
  • Inter-process communication
  • Queue management

Keep exploring