Wednesday 26 October 2016

Friday 25 March 2016

Difference between loosely coupled and tightly coupled system


What is a loosely coupled system?

It is a concept of system design and computing where loosely coupled system is one in which every individual component has no knowledge of the definitions of other components.

In another meaning loosely coupled architecture or system means changes in one module / section that affect the other components and every module is somewhat independent of each other.


In a loosely coupled system, hardware and software may interact but they are not dependent on each other.


 
Source



What is a tightly coupled system?

It is a concept of system design and computing where every hardware and software components that are linked together in such manner that each component is dependent upon each other.

For example, in a tightly coupled system when a dependent class contains a pointer directly to a concrete class which provides the behavior of the object.

Tightly coupled architecture promotes interdependent applications and code. 

Tightly coupled architecture is fragile as the minor issue in one segment can bring the whole system down.




Another example of tightly coupled system




Difference:




Tightly coupled system
Loosely coupled system
1
It has shared memory concept
It has distributed memory concept
2
Contention is high in tightly coupled
Contention is low in loosely coupled
3
It has low scalability
It has high scalability
4
It has low delay
It has high delay
5
Data rate in tightly coupled system is high
Data rate in loosely coupled system is low
6
Cost of tightly coupled system is high
Cost of loosely coupled system is low
7
It has dynamic interconnection network
It has static interconnection network
8
It operates on Single Operating System
It operates on Multiple Operating System
9
In tightly coupled system cache memory assign according to the need of processing
In loosely coupled system, each process have its own cache memory
10
Throughput is high in tightly coupled
Throughput is low in loosely coupled
11
Security is high in tightly coupled
Security is low in loosely coupled
12
Low space in this architecture
High space in this architecture
13
Power consumption is lower than loosely coupled system
Power consumption is higher than tightly coupled system
14
Not reusable in the case of flexibility
Reusable in the case of flexibility
15
Ex., Zeon processor
Ex., Beowulf cluster


Thursday 24 March 2016

Processor pool model in distributed computing system

Before we start, the prerequisites are to have knowledge about the distributed system.

What is distributed system?


A distributed system is a collection of an independent computer that appears to its user as a coherent (logical) system.

A distributed system consists of concurrent (parallel) processors accessing distributed resources. It consists of autonomous computers linked by a computer network and equipped with a distributed system software. Resources are shared through message passing in a network environment that may be unreliable and contain untrusted components.

Layout of distributed system


What is processor pool?


An approach to the construct of processor pool, a full of Central Processing Units (CPUs) within the machine room, which can be allocated dynamically to users on demand.
Instead of giving individual workstations to users, the processor pool model given high-performance graphics terminals. Actually, this approach is based on the observation on What users really want is a good performance and high-quality graphical interface. It is built with low-cost microprocessors also, the concept known as traditional time-sharing is much closer than the Personal Computers (PCs) model.

A system based on processor pool model of distributed system



Processor-pool Model


  • The processor pool model consists of multiple processors and group of workstations.
  • The model is based on the observation that most of the time a user does not need any computing power.
  • In this model, the process is pooled together to be shared by the users as needed.
  • The processor pool of process consists of large microcomputers and minicomputers attached to the network.
  • Each processor has its own memory to load and run.
  • The processors in the pool have no terminals attached directly to them, and the user accesses the system from terminals that are attached to the network via a special device.

Motivation of processor pool model


A diskless workstation is a step further which is the actual motivation of processor pool model.
A diskless workstation or you can say that a diskless node is a personal computer or workstation working without disk drives, which uses client network booting to load its basic operating system from a server. A personal computer may be known as diskless node also if the disk attached within it is damaged or not working and use network booting option to load OS.

Diskless workstation



Queuing theory


To centralising the power of computing into a processor pool actually comes from Queuing theory is the huge argument. A situation is known as queuing systems. If the server can handle 100 requests/sec, but the users continuously generate 110 requests/sec, the queue will grow without bound. Client continuously sending 110 requests/sec and the server capacity is 100 requests/sec to handle, at that time queue will grow without bound.

A basic queuing system based on Queuing theory



Formal Models of distributed systems




Models of distributed computing


There are other two types of computing models:
  • Workstation model
  • Workstation-server model
  1. It is economically more viable to use a few high-end costly servers and more diskless workstations. Diskless workstations are easier to maintain than disk full ones.
  2. In a workstation-server model, the request-response protocol indicates that the client does not get burdened and the process migration becomes unnecessary.
  3. The user also has the flexibility of changing his workstation.
  4. A workstation is connected in a suitable network configuration using the star topology.
  5. Workstation-server model consists of multiple workstations coupled with powerful servers with extra hardware to store the file systems and other software.
  6. Workstation-server model is suitable for sharing the resources between different systems in a modular fashion.
  7. The processor-pool model uses computing resources more effectively, all the resources of the system being available to present working users.
  8. Workstation-server model offers services only to individual clients.
  9. A hybrid model of a distributed system may be built by combining the features of the workstation-server model and the processor pool model.

Wednesday 23 March 2016

Theory Of Computation – A great mathematical deal

Introduction

 

Computers play such an important part in our lives that formulating a“Theory Of Computation” threatens to be a huge project.



To narrow it down, we adopt an approach that seems a little old-fashioned in its simplicity but still allows us to think systematically about what computers do.

Here is the way we will think about a computer: It receives some input, in the form of a string of characters, it performs some sort of “computation”, and it gives us some output.
It’s very easy to try out computer efficiency that we will ask the computer can all be answered either yes or no.
For ex, we might  submit an input string and ask, “Is it a legal algebraic expression? “ At this point, the computer is playing the role of a language acceptor.

The language accepted is the set of strings to which the computer answers yes—in our example, the language of legal algebraic expressions. 

Accepting a language is approximately the same as solving a decision problem, by receiving a string that represents an instance of the problem and answering either yes or no.

Many interesting computational problems can be formulated as decision problems, and we will continue to study them even after we get to models of computation that are capable of producing answers more complicated than yes or no.

Now we look at the computations themselves: to say at the outset how sophisticated the steps carried out by the computer are allowed to be, and to see what sorts of languages can be accepted as a result.

Finite Automaton

 

A finite automaton is characterized by its lack of any auxiliary memory, and a language accepted by such a device can’t require the acceptor to remember very much information during its computation. 

A finite automaton proceeds by moving among a finite number of distinct states in response to input symbols.

Whenever it reaches an accepting state, we think of it as giving a “yes” answer for the string of input symbols it has received so far.

Languages that can be accepted by finite automata are regular languages; they can be described by either regular expressions or regular grammars, and generated by combining one element languages using certain simple operations.




Pushdwn Automaton

A language can be generated by a context-free grammar precisely if it can be accepted by a pushdown automaton, which is similar in some respects to a finite automaton but has an auxiliary memory that operates according to the rules of a stack.




Turing Machine


A Turing machine is not just the next step beyond a pushdown automaton. It is, according to the Church-Turing thesis, a general model of computation, potentially able to execute any algorithm.




Languages

Familiar languages include programming languages such as Java and natural languages like English, as well as unofficial “dialects” with specialized vocabularies, such as the language used in legal documents or the language of mathematics.
Special Thanks To Mr. John C. Martin for writing a book An Introduction to Languages and the Theory of Computation 




Tuesday 22 March 2016

Caesar Cipher program in JavaScript with slight modification

Encryption Like Student thought

 

Hi all engineering students and professionals who are currently interested in information security related topics.

I am posting an algorithm which based is Caesar Cipher.

An algorithm with slight modification with Caesar Cipher.

 

Introduction to Caesar Cipher

The earliest known use of a substitution cipher, and the simplest, was by Julius Caesar.

The Caesar cipher involves replacing each letter of the alphabet with the letter standing three places further down the alphabet.

For ex.

plain:  meet me after the toga party 

cipher: PHHW PH DIWHU WKH WRJD SDUWB

  

Modification is new thing - like student thought

A slight modification with the key used in Caesar Cipher.

An practical steps of algorithm modification is done with JavaScript Code

An algorithm works with only 7th step.

It's very easy to implement in programming languages you interested, here i am implementing this seven steps in JavaScript language.

Graphic layout of tool works on this algorithm is depends on your thoughts.
I am designing a webpage like this.


Step - 1

Convert input string characters in respected ascii codes & store it in array like below mentioned example of JavaScript code.

for ( i  =  0;  i  <  inputString.length;  i++ ) {

      asciiArr[i]  =  inputString[i].charCodeAt( 0 ); 

 

Step - 2

Fill A to Z array in capital or small letters

for ( i = 0, code = 65; i < 26; i++, code++){

    atozArr[i] = String.fromCharCode(code);

}

 

Step - 3

Choose randomly two different characters index from A to Z and find which is minimum index and which is maximum index and stored it in different variables.

rndPositionOne = randomIndexFromInterval(0, atozArr.length - 1);

rndPositionTwo = randomIndexFromInterval(0, atozArr.length - 1);
 
minIndex = 0; maxIndex = 0;
 
if (rndPositionOne < rndPositionTwo){
   minIndex = rndPositionOne; maxIndex = rndPositionTwo;
}else{
   minIndex = rndPositionTwo; maxIndex = rndPositionOne;
}

Note: Here i'm referencing an function return a random value from minimum - maximum range.

Write a function outside of main function of your code. 

function randomIndexFromInterval( min, max){
   return Math.floor(Math.random() *   (max-min+1)+min);
}

 

Step - 4

Convert Randomly selected two indexes to Characters & Store it in selPosArray

for (i = minIndex, start = 0; i < maxIndex; i++, start++){    

 selPosArray[start] = String.fromCharCode( atozArr[i].charCodeAt(0));

}   

 

Step - 5

Addition of every selPosArray element to inputString element ascii

temp = selPosArray[selPosArray.length - 1].charCodeAt(0);

for (i = 0, j = selPosArray[0].charCodeAt(0); i < asciiArr.length; i++, j++){          

    if ( j == temp){
         j = selPosArray[0].charCodeAt(0);
    }
    encryptedString[i] = parseInt(asciiArr[i]) + j;         

}

 

Step - 6

Attach key to encrypted string - b'coz we use Symmetric Key encryption method

outputString.innerHTML = minIndex;

for (i = 0; i < encryptedString.length;  i++){   

      outputString.innerHTML = outputString.innerHTML +    String.fromCharCode(encryptedString[i]);

}

outputString.innerHTML = outputString.innerHTML + maxIndex; 

 

Step - 7

Finally your encryption is ready to send

document.getElementById("inputBox").value = outputString.innerHTML;

Plain Text:

Hi I am writing a blog on blogspot.com

Cypher Text:

4¯g‘i«¸l¼¸°¼²¸²l¦f©´¸±k»³f©´¸±¾¼´Âșu«¸·13

Note: Every time cypher text will change due to selection of random position from A to Z 

Decryption process is reverse of encryption process and here we use Symmetric Key concept so your decryption tool already knows where & how to decrypt the cipher text. 

So guys here is an output screen shot of my web browser Mozilla Firefox.

 

 

 JavaScript Code for Practice

function encryption(){                
          var inputString = document.getElementById("input").value;
          var outputString = document.getElementById("enc");
          var asciiArr = new Array();
          var atozArr = new Array();
          var selPosArray = new Array();
          var indexedArray = new Array();
          var encryptedString = new Array();                
          if (inputString.length != 0){
             outputString.innerHTML = "";
             //First Step: Convert all characters in ascii code 
             for (i = 0; i < inputString.length; i++){
                asciiArr[i] = inputString[i].charCodeAt(0);
             }                    
             //Second Step: Fill AtoZ array in capital or small letters 
             for (i = 0, code = 65; i < 26; i++, code++){
                atozArr[i] = String.fromCharCode(code);                 }
             //Third Step: Choose random two character indexes from A to Z
             rndPositionOne = randomIndexFromInterval(0, atozArr.length - 1);
             rndPositionTwo = randomIndexFromInterval(0, atozArr.length - 1);
             minIndex = 0; maxIndex = 0;
             if (rndPositionOne < rndPositionTwo){
                 minIndex = rndPositionOne; maxIndex = rndPositionTwo;
             }else{
                 minIndex = rndPositionTwo; maxIndex = rndPositionOne;
             }                        
             //Fourth Step: Convert Randomly selected two indexes to Characters & Store it in selPosArray
             for (i = minIndex, start = 0; i < maxIndex; i++, start++){
             selPosArray[start] = String.fromCharCode(atozArr[i].charCodeAt(0));
             }
             //Fifth Step: Addition of every selPosArray element to inputString element ascii

             temp = selPosArray[selPosArray.length - 1].charCodeAt(0);
             for (i = 0, j = selPosArray[0].charCodeAt(0); i < asciiArr.length; i++, j++){
               if ( j == temp){
                    j = selPosArray[0].charCodeAt(0);
               }
               encryptedString[i] = parseInt(asciiArr[i]) + j;
        }
             //Sixth Step: Attach key to encrypted string
             outputString.innerHTML = minIndex;
             for (i = 0; i < encryptedString.length;  i++){
                outputString.innerHTML = outputString.innerHTML + String.fromCharCode(encryptedString[i]);
             }
             outputString.innerHTML = outputString.innerHTML + maxIndex;                        
             //Seventh Step: Finally your encryption is ready to send

            document.getElementById("inputBox").value = outputString.innerHTML;    
         }else{                        document.getElementById("enc").innerHTML = "Error: Value can not be empty.";
         return false;
        }

}