Pipes Implementation Between Two Computer Science Essay

Published: Last Edited:

This essay has been submitted by a student. This is not an example of the work written by our professional essay writers.

Almost all software development is predicated upon the use of software tiers or layers, stacks and components, for example: operating system process, thread and memory management, inter-process communication, specialised middleware, system framework libraries and application domain and application specific libraries.

For each of the underlined items above describe and explain the item (or a closely related set of items working together) using diagrams appropriately-this may include two or more items featuring in the same diagram to show their relationship(s). Each of your item explanations should refer to a relevant operating system and/or software sub-system and/or software library as appropriate.


A Process in operating system is an environment in which programs executes and are used to group resources together.

The smallest unit of processing that can be performed in an operating system is called thread. In latest operating systems, a process includes a thread - that means a single process may contain multiple threads. In fundamental view a user on a program and a progression of ones and zeros heads to the CPU. Through the processor, thread is within these ones and zeros which represents where and when it goes. The reason it is threaded also tracks one instance so that when other instances happen they can relate and correspond with one another completing applications.

In operating system, the memory management plays a vital role as it is one of most important attributes of the operating system. From the beginning of the computer era, there exists a need for more memory than exists physically in a system. Strategies have been built-up to overcome this drawback and the best performable of these is virtual memory. Virtual memory makes the system emerges to have extra memory than it actually has by sharing it between competing processes as they necessitate it.

Inter- process communication functions in the operating systems provide the solutions. Inter-process communication is used to generate information about certain sets computations finishing on one processor and to let the other processors waiting for finishing the computations take note of the information.

Specialized Middleware is a class of software technologies proposed to facilitate supervises the convolution and heterogeneity inbuilt in distributed systems. This middleware is a layer of software above the operating system but below the application program that provides a common programming abstraction across a distributed system.

System framework libraries are an abstraction in which software providing generic functionality can be selectively changed by additional user-written code, thus providing application-specific software.

An application domain is a mechanism which is comparable to a process in an operating system is used within the Common Language Infrastructure (CLI) to segregate executed software applications from one another so they do not affect each other. Each application domain has its own virtual address space which scopes the resources for the application domain using the address space, Kernel Space Processor Scheduling. The Application specific Library is a multipurpose auxiliary library that provides various functions related to the development and use of applications.

Input/output Management

Message Interpreter

Memory Management

Processor Scheduling

Kernel Space

Processor Scheduling

Fig: layered architecture of operating system

(Stallings, n.d.)

[5 marks]

Differentiate between a paradigm, a design pattern and an architectural pattern giving two examples of each and justifying why each of your six examples fits into the category you have selected for it.


A programming paradigm provides the programmer the means and structure for the execution of a program. In software engineering, one logical approach is in practice that defines how a programming language is implemented, which is term as programming paradigms. They are unique to every language regarding the domain, and many programming languages utilize multiple paradigms.

The term paradigm is also known as a "pattern" or "model." Therefore, a programming paradigm can be defined as a pattern or model used within a software programming language to create software applications. Examples of programming paradigm are procedural paradigms as COBOL, FORTRAN and object oriented programming as java, Smalltalk etc. Design patterns are usually coupled with code level commonalities. Various schemes for refining and building smaller subsystems are the provision of design pattern. It is usually influenced by programming language. Some patterns pale into insignificance due to paradigms. Design patterns are medium-scale tactics that flesh out some of the

Structure and behaviour of entities and their relationships while architectural patterns are seen as common at higher level than evaluate to design patterns. Architectural patterns are high-level strategies that concerns large-scale mechanism, the global properties and mechanisms of a system.

[5 marks]

Describe and explain the Pipes and Filters Architectural Pattern with particular reference to its use in the UNIX command shell (or similar) context. You should use examples to explain the advantages when pipes are used effectively and point out the problems that can occur when they are not used appropriately.


The filter transforms or filters the data it receives by the pipes. The pipe is the connector that passes data from one filter to the next. The pattern applies to problems where it is natural to decompose the computation into a collection of semi- independent tasks.

UNIX popularized the pipe and filter paradigm. The flexibility of UNIX pipes made the operating system a suitable platform for the binary reuse of filter programs and for application integration.

The uses of pipes and filter architectural pattern are:

UNIX popularized the pipes and filter paradigm. The flexibility of UNIX pipes made the operating system a suitable platform for the binary reuse of filter programs and for application integration

CMS pipelines are an extension to the operating system of IBM mainframes to support pipes and filters architectures. CMS pipelines provide a reuse and integration platform in the same way as UNIX.

The benefits of using pipes and filter architectural pattern are:

Reuse of filter components.

Efficiency by parallel processing.

Flexibility by filter exchange, recombination

It enforces sequential processing.

The problems occur in pipes and filter architectural pattern are:

Sharing state information is expensive or inflexible.

This pattern may be too simplistic.

(Tata, 2006)

[5 marks]

Describe, using text and diagrams, and discuss how pipes can be implemented effectively (i) between two processes on the same computer, and (ii) between two processes on two different computers connected by a network. You should take into consideration in each case whether synchronization is required and, if it is, describe and explain a suitable mechanism.


Pipes implementation between two processes on the same computer is given below:

Buffered, synchronous pipelines

In this pipeline, "pipelines are inserted in-between pipeline stages synchronously. The time between each clock signal is set to be greater than the longest delay between pipeline stages, so that when the registers are clocked, the data that is written to them is the final result of the previous stage.

Buffered, asynchronous pipelines

Buffered, asynchronous pipelines  use a request or acknowledge system, wherein each stage can detect when it's "finished". When a stage is completed and the next stage has sent "request" signal, the stage sends an "acknowledge" signal to the next stage, and a "request" signal to the earlier stage. When a stage receives an "acknowledge" signal, it clocks its input registers, thus reading in the data from the previous stage.

Unbuffered pipelines

They do not have registers in-between pipeline stages. Instead, the delays in the pipeline are "balanced" so that, for each stage, the difference between the first stabilized output data and the last is minimized. Thus, data flows in "waves" through the pipeline, and each wave is kept as short as possible.

Pipes implementation between two processes on two different computers is given below:

Connect the stream which is managed by the scheduler together with all other process running on the machine. When the receiving program is ready to read data, the OS sends data from the queue, after that it removes that data from the queue.

(Anon., 2010)

Question 2 [20 marks]

[5 marks]

Describe and draw diagrams for each of the following patterns and explain why they are related to the Broker pattern:





Cite the sources you referred to in formulating your answers.


Forwarder -Receiverhttpwww.os.cis.iwate-u.ac.jpwikkywikky.cgi%E9%80%9A%E4%BF%A1%3A%3AForwarder-Receiver%E3%83%91%E3%82%BF%E3%83%BC%E3%83%B3.jpg

Figure: forwarder-receiver design structure

The forward receiver pattern is used for peer to peer communication. Each peer communicates with the other only via forwarder and receiver. The forwarder acts as a push. Client allowing a communication peer to push message to it. The receiver acts as a pull server and waits for the peer to read a message. Hence, every peer needs to interact with its forwarder and receiver in push and pull style respectively. As the broker pattern routes message to one or more of many destination and also transforms message to an alternative representation, it is related the forwarder receiver.


The client makes the proxy. The proxy decides whether to give the client access to the subject. If more than a single subject is available, the proxy decides as the level of access as well as controls that access. The broker pattern sends responses and exceptions back to the client through a server side proxy.



abstract subject

service 1()

service 2()

real subject

service 1()

service 2()


service 1()

service 2()

real subject

service 1()

The broker pattern sends responses and exceptions back to the client through a server side proxy.

Client Dispatcher Server

The dispatcher plays a main role for communicating client and server. To do this, the dispatcher takes the name of a server and maps the name to the physical location of the server. By using the available mechanism, the dispatcher establishes a communication to the server and handed over the communication to the client. If it can't initiate the communication between them, it informs the client about the error.


As broker pattern locates the appropriate server, forwards the request to the server and transmit results and exceptions back to the client, we can say that broker pattern is related to the client dispatcher server.


This pattern acts as a communicating medium for two objects the mediator component helps in establishing communication between two objects.

Mediator defines an object that encapsulates how a set of object interacts.


(Frank Buschmann, n.d.)

(Anon., 1995)

[5 marks]

Describe and explain how the Broker pattern could be applied to peer-to-peer networking and what advantages would thereby accrue. Discuss why multiple Brokers might be preferable. Draw relevant diagrams and cite the sources you referred to in formulating your answers.


A broker is an architectural pattern for message validation, message transformation and message routing. Peer to peer style interaction model involves advertising resources search and discovery of resources, requests for access to these resources, responses to these requests and exchange of messages between peers. The broker merely serves as an efficient way for supporting interact ion between different applications (clients, peers, or hybrid.) Client's access services by connecting to a broker, where there is no presence of client in online. It is not tied to a specific device, geographic location or communication channel. Clients then maintain active connections to the hosting broker throughout the duration that they use the service.

The advantages of broker pattern are:

Routes message to one or more of many destinations.

Transform messages to an alternative representation.

Respond to events or errors.

The advantages of using multiple brokers are:

Work seamlessly with different providers on behalf of customers. It includes taking care of system provisioning, monitoring, billing, etc. In some sense, it's like service aggregation.

Ideally, move workloads among the service providers. You are no longer locked in with a particular service provider.

Maximize performance or price ratio of cloud services by shuffling workloads among the providers.

[10 marks]

Consider application processes that cooperate at the level of objects via published interfaces (for example COM, DCOM, CORBA). A process calls a method of an interface implemented in a second process. The method has parameters including complex data structure values and reference parameters but is a procedure with no return value. The two processes are on different computers.

Describe and explain in detail, with appropriate diagrams, how DCOM enables the calling process so that it is able to (i) determine whether an object of the specified class exists and can be instantiated on the target computer, (ii) cause an object of the said class to be instantiated on the target computer and gain access to the desired interface, and (iii) make a successful call to the method taking into account the types of parameters described above.


The DCOM system is instrumental in providing the foundation for the com+ server system. The creation of DCOM was used to solve a number of different problems of the primary problems that it was designed to solve is marshalling. It should also be noted that the "D" in DCOM was added to refer to the use of DCE or RPC. DCOM interface is defined such that the client and the component can connect without the need of any liaison system component. The client calls methods in the component without any overhead whatsoever.

DCOM (Distributed Component Object Model) is a set of Microsoft concepts and program interfaces in which object objects can request services objects on other computers in a network. DCOM is based on the Component Object Model (COM), which provides a set of interfaces allowing clients and servers to communicate within the same computer. DCOM extends this operation over a network. Networked communication requires port numbers. They are addresses for applications. RPC provides a simple message structure sending a program name and a list of parameters from the client -- the calling program -- to the server -- the called program -- and replying with the results of the program run.

Transfer Protocol to carry the RPC call over a network. Yes for sure, the specified class should exist and can be instantiated on the target computer


We can access the DCOM object by writing below codes:

We can access the DCOM object by writing below codes:

var type = Type.GetTypeFromCLSID(new Guid(CLSID), Environment.MachineName, true);

var COMObject = Activator.CreateInstance(type);

var returnValue = COMObject.GetType().InvokeMember(methodName, flags, null, COMObject, args

argModifiers, null, null);

(Anon., 2010)

Question 3 [20 marks]

[7 marks]

Software Architecture 'principles' are intended to 'improve' the software we create. What does this mean in real-world terms? How do we measure such 'improvement'? What are the 'quality factors' we must consider? What are the costs we must be concerned with? What failures are we trying to avoid?

Describe and explain the factors that contribute to the creation of high quality software by answering the questions above. Cite the sources you referred to in formulating your answers.


We measure such improvement by its reliability, efficiency. There are many factors. One should not evaluate "speed" or "security" of software but they should evaluate the general quality. The quality factors we must consider are












The factors that contribute to the creation of high quality software are described below.

Good software management : Good advice can be taken from many sources explaining good software management (open source, commercial) and for software development (embedded, in house etc.)

Good communication skills: communication between a project leader and other participants play an important role. If there is good communication between them, then there will be good working environment.

No bad politics: maintaining a good policy in project is important thing. People became frustrate and compelled to leave the project due to bad political processes which became more common in a project. The important features get lost due to bad political processes. So it is important to maintain a good policy which does not let the people being frustrated.

Good social engineering skills: a project leader should have good social skills from tactfulness, to humour etc. These entire things make contributing to a project which makes the program more fun and less frustrating.

Bad testers: if there is a beta tester for code, a lot of positive feedback can be get for various different platforms.

Automated tests : it means to test the behaviour of the code automatically. Accumulating such test is a good sign for maintaining high quality software.

Moving modular, well written code : the more modular a project's code is, the easier it is to change it and extend it, and the faster development will take.

A lot of negative hype helps in making the successful project. The less hype and general noise makes the software project better.

A good name : a good name also helps a lot in software quality and marketing.

The failures we are trying to avoid are:

Lack of preparation

Business Misfit

Unilateral decision making


Scope creep

(Roger Pressman, n.d.)

(Pankaj Jalote, n.d.)

[7 marks]

In the context of object-oriented design SOLID brings together a set of principles that can contribute positively to the creation of software systems.

Describe and explain, in your own words, inventing your own examples and citing your sources, (i) what positive contributions are to be expected, and (ii) what each principle is and why each principal is useful.


SOLID programming is a collection of 5 programming patterns for object oriented programming and design. The principle of SOLID are

S - Single Responsibility Principle (SRP)

O - Open Closed Principle (OCP)

L - Liskov Substitution Principle (LSP)

I - Interface Segregation Principle (ISP)

D - Dependency Inversion Principle (DIP)

Single Responsibility Principle

This Principle states that every object should have a single responsibility.

Responsibility is the main theme of this principle, so there should not be more than are responsibility per class. The reason it is important to keep a class focused on a single concern is that it makes the class more robust.

Open Closed Principle

This states that software entities such as class modules, functions should be open for extension but closed for modification. This is the basis of "keep all object variables private" argument Following this principle should make behavior easier to change and also help us avoid breaking existing behaviors while making changes. This also gets to think about the likely areas of change in a class, which helps us to choose the right abstractions required for design.

Liskov Substitution Principle

This states that sub classes should be substitutable for the classes from which they were derived. If you are calling a method defined at a base class upon an abstracted class, the function must be implemented properly on the subtype class. Whenever you use inheritance it's a fine idea to apply the LSP firmly in mind.

Interface Segregation Principle

This principle states that clients should not be forced to depend methods they don't use. When a client depends upon a class that contain interface that the client does not use but that other client do choose. Then that client will be affected by the changes that those other clients force upon the class.

Dependency Inversion Principle

It states that high-level modules should not depend on low level modules but both should depend on shared abstraction. Abstraction should not depend upon details but details should depend upon abstractions.

(Anon., 2009)

[6 marks]

Using Visual Studio 2012 and C# create a well-documented console application that demonstrates clearly the following three forms of Dependency Injection (sometimes referred to as Inversion of Control): (i) interface injection, (ii) setter injection, and (iii) constructor injection.


The following program is well -documented console application that demonstrates clearly the three forms of Dependency injection developed in Visual Studio 2012 and C#.

using System;

using Const=DependencyInjection.Constructor;

using Prop=DependencyInjection.Property;

using Inter = DependencyInjection.Interface;

namespace DependencyInjection


class Program


static void Main(string[] args)


ICalculator constAsianCalculator = new WholesellerRate();

//Contructor Dependency Injection

//Dependent Calculator passed through constructor

Const.Calculator constCalculator = new Const.Calculator(constAsianCalculator);

constCalculator.Rate = 2.0;

Console.WriteLine("Constructor Injection : {0}", constCalculator.CalculatedRate);

ICalculator propEuropeanCalculator = new RetailerRate();

Prop.Calculator propCalculator = new Prop.Calculator();

//Property Dependency Injection

//Dependent Calculator set on the Calculator property of PropertyInjectionCalculator

propCalculator.RateCalculator = propEuropeanCalculator;

propCalculator.Rate = 4.0;

Console.WriteLine("Property Injection : {0}",propCalculator.CalculatedRate);

ICalculator interAmericanCalculator = new MarketRate();

Inter.Calculator interCalculator=new Inter.Calculator();

//Interface Dependency Injection

//Dependent Calculator set on the Interface through method SetRateCalculator method


interCalculator.Rate = 2.0;

Console.WriteLine("Interface Injection : {0}", interCalculator.CalculatedRate);





Question 4 [40 marks]

[10 marks]

Draw a diagram of an interactive application that implements the Model View Controller (MVC) pattern. The application can display two views of the application's data (but only one view at a time). Label the Model, View(s) and Controller elements in your diagram. Show (and label appropriately) the interactions between the Model, View(s) and Controller elements as well as where the application's data is received, manipulated and returned to an associated data store.

Describe and explain, with reference to your MVC diagram, the role of each of the three elements and the interactions between the elements, the data store, the user interface and the user.


The principles of MVC make it so much desirable to develop such application which can call 2 or more than 2 model from same function. MVC splits user interface interaction into three distinct roles. model-view-controller-01.png

With MVC, we can separate presentation (V, C) the domain logic (M) and also separate UI behavior (C) from UI display. This is more maintainable and it also fosters reuse and testing. It allows tackling complexity.

This is not that just applies to web application. It user interface

Like with any patterns it depends on the predicament we want to solve. Surely for much more effectual functionality of data stores and controller internet plays a vital role which makes MVC brilliant.

As for n-tier, the traditional MVC did not anticipate its use on the web. With the donation of UI happening in the browser and the controller on a remote server, MVC on the web is also multi- tier architecture. MVC is just not alarmed where it happens. But the most substantial thing is that whatever the platform is, its model is already designed as per for platform independency. It depend on the users what they call upon and to the controller to response their respective call. The most important part here is the nature and

functionality of controller. All characteristics to execute depend upon a controller as what view to push toward users' call. Elaborating more design can be totally different but the logic inside the particular design is same for PC and Smart phones. As to understand, design are made for

compatibility for different platforms but the logic or code inside the design are global in nature or its same for PC and Smart phones.

Therefore, MVC is best suited for these types of applications. As per design its more effective from each point of view in MVC pattern but yes, someone can argue the design as a big head but to make it compatible its really essential to follow the MVC pattern by designing more than one model.

[8 marks]

Present and discuss the rationale of the MVC pattern in the context of an application that must work well on both smart phones and desktop computer systems where the application data store is only accessible over the Internet. Set out, with justification, why MVC is best suited to this type of application and the problem sit is designed to avoid.


Model-View-Controller is a software design pattern that can be used to organize code in such a way that the business logic and data presentation are separate. The premise behind this approach is that if the business logic is grouped into one section, then the interface and user interaction that surrounds the data can be revised and customized without having to reprogram the business logic. MVC was formerly developed to map the traditional input, processing, output roles into a logical GUI architecture.

MVC splits user interface relations into three distinct roles as view, controller and model. This design pattern helps to make MVC best suited for both desktop computer and smart phone. In simple briefing, MVC is capable of storing different model or interface design that would be executed according to the user's device. Here controller understands the users demand and display the model according to it.

In the MVC design pattern, application flow is mediated by a central controller. The controller delegates requests to an appropriate handler. The controller plays a vital role to the means by which the user interacts with the web application. The controller is responsible for the input to the model. A pure GUI controller accepts input from the user and instructs the model and viewport to perform action based on that input. If an invalid input is sent to the controller from the view, the model informs the controller to straight the view that error occurred and to tell it to try again.

A web application controller can be thought of as specialized view since it has a visual aspect. It would be actually be one or more HTML forms in a web application and therefore the model can also dictate what the controller should display as input. The controller would generate HTML to permit the user input a reservation to the web application. The controller would add the necessary parameterization of the individual form element so that the Servlet on java platform or other can observe the input. This is different from a GUI, actually back-to-front, where the controller is waiting and acting on event-driven input from mouse or graphics tablet.

So on conclusion, the functionality of MVC's controller makes MVC best suitable to develop such application which needs to display in different platform.

[12 marks]

Draw a diagram of an interactive application that implements the Model View View-Model (MVVM) pattern. The application can display several views of the application's data simultaneously. Label the Model, View(s) and View-Model elements in your diagram. Show (and label appropriately) the interactions between the Model, View(s) and View-Model elements as well as where the application's data is received, manipulated and returned to an associated data store.

Describe and explain, with reference to your MVVM diagram, the role of each of the three elements and the interactions between the elements, the data store, the user interface and the user.


Model View ViewModel (MVVM) is an architectural pattern used in software engineering. The MVVM pattern was conceived to support WPF and silver light. MVVM is a design pattern for building user interfaces.


Elements of the MVVM pattern includes :

Model: it represents objects and operations of business domain. It doesn't contain any information about the users interface.

View: it is element of user interface (UI) that represents the state of the view model. It display information from the view model, send commands to the view model and when the state of the view model changes, it update.

View Model: It is a pure-code representation of the data and operation as a UI. It is not the UI itself. Although it is not he persisted data model, it holds the unsaved data which the user is working.

View model is a model of the view. It acts as an intermediate class between the view and the model as it references the model and calls method as the model to retrieve domain objects, which are typically exposed to the view.

[10 marks]

Explain (using an appropriate example and code snippets) why the MVVM application pattern is favoured for applications built using Microsoft Windows Presentation Foundation (WPF). Your explanation should include the relevance of XAML and data binding in this context. Cite the sources you referred to in formulating your answers.


The MVVM (Model-View-ViewModel) Design Pattern is a Design Pattern introduced recently in the software development community. This Design Pattern is a specialized Design Pattern for WPF applications.MVVM.jpg

We have many admired design patterns that can help to tame this unmanageable beast, but properly separating and addressing the massive amount of concerns can be difficult. The more multifaceted the patterns are, the more likely that shortcuts will be used later on which undermine all previous efforts to do things the right way.

It is not always the design patterns at fault. Sometimes we use complicated design patterns, which require writing a lot of code because the UI platform in use does not lend itself well to a simpler pattern. What's needed is a platform that makes it easy to build UIs using simple, time-tested, developer-approved design patterns. Fortunately, Windows Presentation Foundation (WPF) provides exactly that.

As the software world continues to adopt WPF at an increasing rate, the WPF community has been developing its own ecosystem of patterns and practices. In this article, I'll review some of those best practices for designing and implementing client applications with WPF. By leveraging some core features of WPF in combination with the Model-View-ViewModel (MVVM) design pattern, I some code snippets to of making WPF application.

Some code snippets to of making WPF application:

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Windows;

using System.Windows.Controls;

using System.Windows.Data;

using System.Windows.Documents;

using System.Windows.Input;

using System.Windows.Media;

using System.Windows.Media.Imaging;

using System.Windows.Navigation;

using System.Windows.Shapes;

namespace WpfModelViewDemoApplication.Views


public partial class MainView : Window


public MainView()






To add some functions to the WPF MVVM application, we will first create the application's data model. The model classes are created in the "Models" folder in the C# file "StudentsModel.cs":

using System;

using System.Collections.ObjectModel;

using System.Collections.Generic;

using System.Linq;

using System.Text;

namespace WpfModelViewDemoApplication.Models


public class Student


public string Name {get; set;}

public int Score {get; set;}

public DateTime TimeAdded {get; set;}

public string Comment {get; set;}

public Student(string Name, int Score,

DateTime TimeAdded, string Comment) {

this.Name = Name;

this.Score = Score;

this.TimeAdded = TimeAdded;

this.Comment = Comment;



public class StudentsModel: ObservableCollection<student />


private static object _threadLock = new Object();

private static StudentsModel current = null;

public static StudentsModel Current {

get {

lock (_threadLock)

if (current == null)

current = new StudentsModel();

return current;



private StudentsModel() {

Random rd = new Random();

for (int Idex = 1; Idex <= 5; Idex++)


string Name = "Student Name No. " + Idex.ToString();

int Score =

System.Convert.ToInt16(60 + rd.NextDouble() * 40);

DateTime TimeAdded = System.DateTime.Now;

string Comment = "This student is added @ " +


Student aStudent = new Student(Name, Score,

TimeAdded, Comment);




public void AddAStudent(String Name,

int Score, DateTime TimeAdded, string Comment) {

Student aNewStudent = new Student(Name, Score,

TimeAdded, Comment);