




























Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
The implementation of message queues and the assessment of data structure and algorithm effectiveness using the example of message transmission. It covers the theory behind message queues, the implementation of a message queuing program, and the comparison of linear search and binary search algorithms. The document also explores the importance of asymptotic analysis in evaluating algorithm performance and the trade-offs between time and space complexity.
Typology: High school final essays
1 / 36
This page cannot be seen from the preview
Don't miss anything!





























Summative Feedback: Resubmission Feedback:
INTRODUCTION This report will provide for you the knowledge about middleware, the relationship between MOM with ADT/ Algorithm, as well as, illustrated example for each terms. In addition, this report also give the way to assess the effectiveness of data structure and algorithms, and implement complex data structures and algorithms
LO1 Implement complex data structure and algorithms P4 Implement a complex ADT and algorithm in an executable programming language to solve a well- defined problem In this section we divided into two part, includes the theory about the message queue and a program that illustrate the message queuing. The aim of the split into two parts is helps understand the message queue specifically both in theory and practice. Basic theory of message queues What is a message queues? Figure 1 The message queue operation. To easily graphs what a message queues is, we must understand the term “Message” and “Queue” within it. The term “Queue” means a line of things waiting to be handle that follow sequential order starting at the beginning of the line. Besides, the data transported between the sender and the receiver application is called a message. In the basic means it is a byte array with some headers on top. A message queue is a is a queue of messages sent between application that includes a sequence of work objects that are waiting to be processed. In the shorten word, a message queue is a named destination to which message can be sent. Messages accumulate on queues until they are retrieved by programs that service those queues. A queue message gives an asynchronous communication protocol, a system that puts a message onto a message queue that does not require an immediate response to continuing processing. A queue manager is responsible for managing message queue. The physical nature of a queue depends on the operating system on which the queue manager is running. A volatile buffer area in the memory of a computer, or a data set on a permanent storage device such as a disk can be a queue. In additional, the physical management of queues is the responsibility of the queue manager.
Implement a complete ADT and algorithm to solve a well- defined problem Problem Build a program that allows the transmission of a message as a sequence of 250 source characters to the destination. The source side uses the queue to make the buffer and the destination side uses the stack to handle the string. Implement the application with source code in C Source code Figure 4 Code of creating a Message Queue. Figure 5 Code of get all the message queues.
Figure 6 Code to open the queue on the local server. Figure 7 Code to send a message.
Exception handling Exceptions provide better control over error handling Keywords related to exceptions:
M4 Demonstrate how the implementation of an ADT/ algorithm solves a-well defined problem Middleware is software that connects network-based requests created by the client to the back-end data that the client is requesting. Middleware is similar to an operating system because it can support other application
programs, provides controlled interaction, prevents interference between calculations and facilitates interaction between properties. math on different computers through network communication services. How it works? All network-based requests are basically trying to interact with data behind. That data can be something as simple as an image to display or a video to play or it can be complicated as a history of banking transactions. The requested data can be of different types and can be stored in different ways, such as coming from a file server, fetched from a message queue or stored in a database. The role of intermediary software is to allow and easily access those auxiliary resources. Some examples of middleware: Distributed cache Message queue Transaction monitoring Automatic backup system (Red hat, 2018) Why message queues intermediate? In addition, Middleware message queuing allows optimal handling of transactions. It is done by properly channeling transactions, prioritizing and allocating the appropriate amount of resources to handle them. By queuing, Middleware ensures that:
Asymptotic analysis is input bound, it means if there is not input to the algorithm, it is concluded to work in a constant time. In the other faces, the input all other elements are considered constant. Asymptotic analysis mention to computing the running-time of any operation in mathematical units of computation. Generally, the time required by an algorithm comprises the following three types: Best Case: Minimum time required for program execution. Average Case: Average time required for program execution. Worst Case: Maximum time required for program execution. Asymptotic Notations A way of comparing function that ignores constant factors and small input sizes is called asymptotic notations. There are three commonly asymptotic notations that used to calculate the running-time complexity of an algorithm. O Notation Ω Notation Θ Notation Big- oh (O) notation The formal method of expressing the upper bound of the running-time of an algorithm is Big-oh. It is the measure of the longest amount of time. The function f(n)= O(g(n)) is read as f of n is big-oh of g of n, if and only if exist positive constant c such that f(n) ≤ k.g(n)f(n)≤k.g(n) for n >n 0 n>n 0 Thus, function g(n) is an upper bound for function g(n) as g(n) grows faster than f(n) Figure 11 Asymptotic upper bound. For examples, a) 3n+2=O(n) as 3n+2≤4n for all n≥ 2 b) 3n+3=O(n) as 3n+3≤4n for all n ≥
So, the complexity of f(n) is represented as O(g(n)) Omega (Ω) Notation The function f(n)= Ω(g(n)) is read as f of n is omega of g of n, if and only if there exist positive constant c and n 0 such that f(n)≥k.g(n) for all n, n≥n 0 Figure 12 Asymptotic lower bound. For examples, f(n)= 8n^2 +2n- 3 ≥8n^2 - 3 = 7n^2 +(n^2 - 3)≥7n^2 (g(n)) Thus, k 1 = So, the complexity of f(n) represented as Ω(g(n)) Theta (θ) Notation The function f(n)=θ(g(n)) read as f is the theta of g of n, if and only if there exists positive constant k 1 , k 2 and k 0 such that k 1 .g(n)≤f(n)≤k 2 .g(n) for all n, n≥n 0 Figure 13 Asymptotic tight bound.
problem, it might also be possible that for some inputs, the first algorithm performs better on one machine and the second algorithm works better on other machine for some other inputs. To solve some problem that leaded by the naïve way, the asymptotic analysis is the ideal solution. By working within asymptotic analysis, we can evaluate the performance of an algorithm in term of input size, as well as, we calculate how does the time and space taken by an algorithm increase with the input size. For specially example, we consider the search problem in a sorted array. We have two different methods, once using Linear Search and second using Binary Search
Exit else I← I+ Write(“Value of”, X, “NOT FOUND”) [Finished] Exit The above algorithm searches vector starting from the first elements up to the last element in linear manner for searching element X. Each time an index variable I is increase to search next element. If an element does not exist in the vector then entire vector is scanned and then result in element not found. The time required by the above algorithm is O(n) that is linearly proportional to total number of elements in the list.