Skip to main content

Posts

Computer Network | Subnetting

Maintaining a big network and providing security to such giant networks is always a hectic task. Where the division of networks or subnetting makes things easier. When you have to reach to a process running in a computer of a different network, there are three things to be identified. Identify the network. Firs the main network ID then the subnet ID. As deeper the subnetting, the identification time will become even more complex. Identification of Host Identification of Process Let's subnet 172.27.172.0/241 (Network ID) in to two (where Directed Broadcast Address(DBA) : 172.27.172.2552). This network has 256(232-24) IPs. Subnet-1 : 172.27.172.0/251 ( DBA-S1 : 172.27.172.127 ) Subnet-2 : 172.27.172.128/25 ( DBA-S2 : 172.27.172.2552 ) The similarity of nework ID of first subnet and directed broadcast ID of second network to those of the main network is obviously indicates that network division. The top level router will redirect the data to main network when it see…

Git in short - A Practical Guide

Git is one of the popular software version control systems. It helps to track modifications of files in a project and provides mechanisms to interact with the changes. This article explains some set of practical GIT work flows in brief. Section 1: Creation and management of a local GIT repository. STEP 0: Set path to project directory where version controller to be initialized. git init Syntax :   git init git init command initializes the current directory as a git repository. A hidden .git will be created in the current folder, to store all tracking related information. See the command line response on listing the files in the repository. Added a README.md file to the repository. git status Syntax :      git status git status command show the current status of the repository. The cmd line response indicates, the file README.md is not tracked by git. git add Syntax :      git add git add command moves the files under git's tracking. Theoretically git add moves file…

Computer Networks | IP Address and Network Address Classification

Sending a data packet between to different entities can be classified into two major categories. Unicasting : A one to one data transmission between a single sender and receiver. Broadcasting : Where there is only a single sender but multiple number of receivers are participating in data transmission. IP(Internet Protocol) address is the unique identity allocated to each and every machine on internet. IP version 4 (IPv4) address is a 32bit number, which is combination of Network ID and Host ID. Usually represents using dotted decimal notation (example: 172.27.172.27). There IP address are grouped into five classes, based on the size of sub-networks possible under each network group. The first octet of a IP address means 8 bits starting from most significant bit. The value of fist octet decides the class of IP address as shown. Class Name Range of First Octet Reserved bits for Network ID Reserved bits for Host ID A 0 - 126 8 bits | 0xxx xxxx 24 bits B 128 - 191 16 bits |…

Theory of Computation | NFA - Non-deterministic Finite Automata

Prerequisites : Symbols, Alphabets, Strings and LanguageTypes of Automata and Representation.DFA - Deterministic Finite Automata When there is a chance for multiple state changes on a given single input, the non-deterministic in autoama handles the scenario. The non determinism may even lead a in to null states. Non-deterministic Finite Automata(NFA) are pseudo machines, means cannot be implemented in reality, even though they are finite state machines. But of course NFA are very useful to resolve problem by exhaustive searching and backtracking. A null state is represented using Greek letter Φ The figure represents a NFA, which accepts all strings which starts with alphabet 'a' Here we have two states, A and B. so, set of all states Q = {A, B} and set of all symbols Σ = {a, b} Final state F = {B} and initial state q0 = { A } When input 'a' is given to state A, the state changes to B But input 'b' on A leads to a null(Φ) state. Any input on state B l…

Theory of Computation | DFA - Deterministic Finite Automata

Automata are decision making machines, which decides whether a string belongs to a language or not. An automaton is called deterministic, when it shows a unique path for change of state on every input. Automata with definite number of states are called finite automata. A Deterministic finite automaton(DFA) has both qualities,ie. it is deterministic and has finite number of states A binary number is even if its LSB(Least Significant Bit) is zero (eg: 110 = 6 is even). If LSB is one, it is odd (eg: 111 = 7 is odd). So if we are constructing an DFA which accepts all odd binary numbers, our deterministic finite machine will have two states odd and even. set of of all states Q = {O, E} O - Odd E - Even Our machine requires inputs, the elemental binary numbers, i.e 0 or 1 These are called input alphabets Σ = {0, 1} When you feed this a DFA with a inputs from MSB(Most Significant Bit) to LSB of a binary, when the zero comes as input the state has to be even when one the input the s…

Theory Of Computation | Types of Automata and Representation

The validation of a string for its membership in a language are handled by automata. An automaton acts as a acceptor of a string for a given language This is an example for an automaton which accepts all strings containing at least one 'a'. These circles are known as states. So X and Y are states. Circle with dual boundary (here Y) is final state and one with unmarked arrow is initial state(here X). Consider the string "baba", Initially we are at X, on seeing first alphabet 'b' the automaton loop back to X itself( Edge with alphabet 'b' point to X itself). On seeing next alphabet 'a', the state transition happens and reaches at new state Y. Once we reaches at state Y, both 'a' and 'b' loop back to the same state. So the string "baba" finally reaches as state Y Since the Y is the final state of this automaton, we can conclude that the sting "baba" belongs to the language represented by the given autom…

Theory of Computation | Symbols, Alphabets, Strings and Language

Theory of computation or Automata theory mainly deals with abstract modeling of machines and computation. These models embody some of the important complex logical features we encounter, on dealing software as hardware. The following are the basic terminologies, which are frequently used in Theory of Computation Symbol The smallest building entity of Automata Theory( or Theory of Computation) is known as symbol. example: a, 2, i, B... Alphabet A set of symbols forms an alphabet. An alphabet is usually represented by Greek letter sigma( Σ ) example: Σ= { x, y} String A string is a sequence of symbols in a alphabet. example: 'xy' is a string derived from the alphabet Σ= { x, y} Language Collection of strings are called as a language. example: Let an alphabet Σ= { p, q, r} Then if a language L of set of a strings of length 2 over Σ can be represented as L = { pp, pq, pr, qp, qq, qr, rp, rq, rr } Alphabet concatenation gives you set of all strings of length of as …

Sorting Algorithms In Brief

This article is a brief description of some set of widely used sorting techniques and it's implementations in golang. Summary: Insertion SortSelection SortInsertion Sort This algorithm maintains a sorted portion and unsorted portion, in the given list of elements to be sorted. It picks a corner element from unsorted portion and inserts it into correct location in the sorted portion. Here is the golang implementation of insertion sort. Run in Go Playground Here the algorithm sorts the elements in ascending order. The outer for loop, scan the array from start to end. ( with itr iterator.) The left portion pointed by outer for loop iterator will be the sorted portion. On every iteration of outer for loop, inner for loop shift the element pointed by outer iterator to its correct locations. This has been achieved by continuous comparison (arr[inItr] < arr[inItr-1]) and swapping. Selection Sort Similar to insertion sort, selection sort also maintains a sorted and unsorted por…

What is RR scheduling algorithm? A interpretation based on common situations in life

Where ever you go, you can find people in queue to get something processed, either it is airports for getting documents verified or even at hospitals to see a eminent doctor.People feels boring not only because of processor does not completes execution of their processor but also because of if processor does not even look into their processing need over a constant interval to satisfy their thirst of getting a touch by processor over intervals [ known as starvation ].Round robin schedules every running processes on main memory for execution for a specific quantum of time and preempts the execution process to give chance for the next, hence gives a lesser starvation.By adjusting lesser time time quantum the efficiency of execution also get increased.For detailed reading refer : Operating Systems | Scheduling Algorithms : Round Robin | Q/A Section | Home |

Computer Networks | what happens when you enter a URL? An introduction to Computer Networking

Any data, information or even hardware which are shareable among different computers are known as resources in computer network. Resource sharing is the major, reason for interconnecting different computing systems. Such a interconnected system of computers are known as network. Each computer in this interconnected group of computers is called a host computer. So a network can be termed as a group of interconnected hosts. Any work which is running on a system is called a process. In computer networking major focus is for processes which are participating in the resources sharing between host computers. example : A process sending URL GET get request from a Chrome browser.
A web server is a machine which delivers resources related to content of website, as per the request by any other machine(clients) in the network. Both server and client machine are hosts of a same network or different networks. A URL like http://www.wikipedia.org/wiki/Main_Page has three parts. http:// - File…

What is a system call in operating systems?

CPU executes a program either in USER MODE or KERNEL MODE. Most of the Kernel Mode processes will be, basic level core functionalities of system and such processes will have direct accesess to most of the available resources of the system.Most of the User Mode processes will be of third party programs, which may be hazardes to a computet if we give direct access to resources. So for a program running in user mode must have to uses Operating System APIs inorders to access resources with out any security breaches. For such accesess the process in User Mode have to call OS functions with APIs provided, is known as system calls.What is RR scheduling algorithm? A interpretation based on common situations in life | Q/A Section | Home |

Operating Systems | Lock Variable Synchronization Mechanism

To learn lock variable synchronization mechanism, you have to understand different modes of execution of instructions in an operating system. Basically there are two modes of execution in a system, User Mode and Kernel Mode. The unrestricted access to any resources in the system, for executing instructions in Kernel Mode makes resources available only for most trusted basic level functions of operating system.
Direct access of hardware or memory references are not allowed in User Mode, due security concerns over higher level applications. System APIs provide a path way to reference these resources.
Features of Lock Variable A software logic implemented in User Mode.A Busy waiting method of synchronization. Multiple processes can be handled by single mechanism. There are two basic section for every synchronization method, which decides the nature of that algorithm, Entry and Exit sections. Arranged as shown. Here in lock variable method, a global variable Lock acts as a dec…

Operating Systems | Properties of Synchronization Mechanisms

Necessary conditions to consider a synchronization method as reliable. Mutual Exclusion Progress Properties which will enhance the efficiency of synchronization mechanisms. Bounded Waiting Portability Mutual Exclusion Mutual exclusion is a property, that provides an isolation between processes from accessing critical resources simultaneously. A process, that is using shared resources for execution of critical section, will prevent other programs from accessing the same resources with the help of synchronization mechanisms.
Progress If selection of a process from processes, that are ready to accesses certain shared resource, get decided within a limit of time, means there is a progress in work with the method used for synchronization. An infinite decision time show lack of progress. Bounded Waiting There exist a bound or a limit, if it is possible to count the number of processes, after which the request of a process to enter into critical section will be granted. An unbou…

Operating Systems | Concept of shared memory and critical section

While printing your document opened in Adobe Acrobat Reader, if you gave a same command for document opened in Microsoft Word! How will it be?These are the real time situations where two processes competing together for same resources due to improper process synchronization. An unstructured access approval to these resources may lead to a abnormal output or a breach in information security or even it may cause for data loss. In the above case which might be a bunch of over-written papers coming out of the printer connected to that system.

Shared Memory and Critical Section Resources or memory spaces where different processes have access to read, write or update at same time are known as shared memory.And the piece of program which tries to access the shared memory is known as Critical Section. There are situations where an operating system need to handle multiple request from critical sections of various processes in a machine, in order to maintain data consistency in resources

Operating Systems | Types and Functions

An operating system is an interface between user and hardware of a system and it controls allocation of resources and its retrieval. The major functions of operating systems are Dynamic handling of available/allocated/free spaces of memory.Controlling of process state transitions efficiently.Maintaining of consistency in resource access by different processes synchronization methods.incorporation of protection and security in the system.
The main objectives of an operating systems to, to provide convenient interface to its users and it should be efficient to process complex scientific data.The fundamental operations of an OS can be described as follows:Synchronization of processesWhat ever you do on your system is a process. Let us say your sending a request to your printer from a word document when your printer is already on duty with some other work, if the OS takes you command directly you will get a mixed-bad printout.So in order to avoid this OS implements different techniques, w…

Computer Network | Capacity of Channel and Pipelining

Capacity of Channel Capacity can be measured by counting number of packets of data embedded in a snapshot of a channel while it is transferring maximum amount of data it can hold. Which means the holding capacity of channel during transmission. If a half duplex channel can send \( n \) bits per second(Band Width) the it has a propagation delay(\( T_p \)) of \( p \) seconds, channel will have a capacity \( n*p \) bits.\( Capacity\ of\ channel = Band\ Width( BW ) * Transmission\ dealy( T_p ) \) Channels with high capacity is called thick channels/thick pipes and those with lower capacity is called thin pipes. Since the sender has to wait until receive acknowledgement from the receiver, in efficient usage of available space on thick pipes makes it not suitable for stop and wait protocol. We have efficiency( \( \eta \) ) of stop and wait protocol, which can be rewrite as, \( \eta =\frac{1}{1 +2\ a} =\frac{1}{1 +\frac{2\ T_p}{T_t}} \\ \\ \eta =\frac{1}{1 +\frac{2\ T_p\ BW}{L}} \\ \\ \…

Computer Network | Flow control Methods: Stop and Wait

Some times sending data packets at higher rate to a less efficient receiver may cause for the discarding of data from the buffer and lead to data loss. Flow control methods are used to avoid this dilemma.Stop and WaitWhen the data packet from the sender reaches at the receiver it returns a success message and once the sender acknowledges the success return it will go for the the next one. This sequence of protocols are know as stop and wait method of flow control.In theoretical questions Tq and Tprocess usually approximates as zero. Generally Transmission delay for the acknowledgement will be negligibly small (about 10-3 times) compared to transmission delay for the data,which may also can approximate to zero.Piggybacking is a concept where data is send along with acknowledgment and other control information during bidirectional communication. So in Piggybacking acknowledgement time will become equal to that of propagation transmission time.Cases where Tacknowledgement, Tq and Tproces…

Computer Network | Delays in Networks

Data transmission from one point to another point, is a combination of different movements of data over multiple stages. Each of these movements takes its own time depending of the location of data, capacity of transmission medium, signal velocity and various other factors. The following are some basic time aspects which can be used to asses a transmission network or a protocol.Transmission DelayPropagation DelayQueuing DelayProcessing Delay Transmission Delay(Tt)Time taken to schedule a data packet from a host system to its outgoing link is known as transmission delay. It depends on mainly two parameters- band width and size of data packets.Band width is the amount of data which can send in unit time.If Band Width= 1 bps [bit per second] and Data packet/unit is of 10 bits, then Transmission Delay Tt= 10 bits /(1 bit/ second) = 10 seconds which implies, If Band Width is B bps and Data is of length L bits the Transmission Delay Tt=(L/B) Which means the transmission delay will becomes too …

Operating Systems | Scheduling Algorithms: HRRN

Highest Response Ratio Next(HRRN)Response ration of a process in ready state at a moment is the ratio of sum of service time (equal to burst time) required and waiting time till that moment to the burst time. Among available processes on ready state ,a process with highest response ratio get allocated to CPU by a scheduler with HRRN algorithm. If response ratios are equal next priority will for one which is arrived first and even that also similar then next is for onw with lowest process ID. Example: Calculate completion time, turn around time and waiting time for the following processes using non-preemptive HRRN algorithm?ProcessATBTP104P213P311P432Answer:
The sequences of allocation of process into CPU can be depicted as follows:TAT = CT - AT & WT = TAT - BTProcess NumberATBTCTTATWT10410106213874311321432964The HRRN algorithm not only favors the shortest job with longer waiting time but also limits the waiting time and starvation on longer processes. | Previous | Next | Home |

Operating Systems | Scheduling Algorithm: Priority Scheduling

Priority SchedulingThe algorithms schedules the process with highest priority from available processes available on main memory.It is of two types Static Priority SchedulingWhere once the priority is assigned for a process,the priority of a process will not change till termination of the process.Dynamic Priority SchedulingIn dynamic priority scheduling the priority might change during processing the program.The priority scheduler with methods to suspend processes during execution of program is called preemptive priority scheduler and with out such methods are known as preemptive scheduler. Among two process with same priority, once which arrived first will have higher precedence and if those are also equal the chronological order of process id would considered.Example: Consider the table of processes which will be executed using preemptive priority scheduling algorithm. Find the completion time, turnaround time and waiting time for each of them? Process NumberPriorityATBT1202231131224…