Terminologies Beyond being an Ignorant.

There is no software that can hack facebook passwords(except key logging and phishing) and this goes same with e-mail account hacking. And these are some of the queries and desires one could start off primitive constructional hacking from, but they often fall off the edge and go destructive blackhat hacking for the curiosity. Curiosity is such an agent which could change and push forward the envelope. But this, if not done the right way will only lead to false reality of what is really not constructional nor is the reality in itself. Every one else seem tired of the questions and yet there really seems to be confusion on what to admire, are the guys who work hard to be on the white side, or the guys who still work hard at the black side of breaking the security. Now when I say ‘security’, strictly it does not have to be application security or network security, think bigger and there is physical security, mobile security, personal security; a person who bypass security or any counter-measures which are in place to prohibit access is known to be generally called as a ‘cracker‘ or a ‘hacker‘.

But don’t get hooked by the terms. They are both very different. It depends on the person on which side he chose to be. That is if a person has chosen the darker side, he would be in a long run be called and termed as a cracker. If not, he belongs to the ‘hacker’ category. And the latter is the category we would be talking about since I have really no interest on the other side of the fence where relatively today or later, things keep getting worse with law enforcement going stricter. Now, a cowboy fro curiosity might just explore both the sides and this is the gray area. Such people would be called as a Gray Hat. Let’s walk straight to the points and see some terminologies which could be mentioned to illuminate some of the people who had been missing a lot of what, why, how and the where’s. Here are some terminologies related to computer science but are inclined on the side of ‘computer hacks’ on a broader scope.

Kernel is the main component of most computer operating systems; it is a bridge between applications and the actual data processing done at the hardware level. The kernel’s responsibilities include managing the system’s resources (the communication between hardware and software components). Usually as a basic component of an operating system, a kernel can provide the lowest-level abstraction layer for the resources (especially processors and I/O devices) that application software must control to perform its function. It typically makes these facilities available to application processes through inter-process communication mechanisms and system calls.

Linux is a computer operating system which is based on free and open source software. Although many different varieties of Linux exist, all are Unix-like and based on the Linux kernel, an operating system kernel. The Linux was originally a ‘kernel’ where lines of code were added by the community later to make it better and better and now, Linux has so many distributions with 1000’s of lines of code and utilities.

An exploit (from the verb to exploit, in the meaning of using something to one’s own advantage) is a piece of software, a chunk of data, or sequence of commands that takes advantage of a bug, glitch or vulnerability in order to cause unintended or unanticipated behavior to occur on computer software, hardware, or something electronic (usually computerized). This frequently includes such things as gaining control of a computer system.

A shell is a piece of software that provides an interface for users of an operating system which provides access to the services of a kernel. However, the term is also applied very loosely to applications and may include any software that is “built around” a particular component, such as web browsers and email clients that are “shells” for HTML rendering engines. The name shell originates from shells being an outer layer of interface between the user and the internals of the operating system (the kernel).

PHP is a general-purpose server-side scripting language originally designed for web development to produce dynamic web pages. For this purpose, PHP code is embedded into the HTML source document and interpreted by a web server with a PHP processor module, which generates the web page document. It also has evolved to include a command-line interface capability and can be used in standalone graphical applications.

JQuery is a cross-browser JavaScript library designed to simplify the client-side scripting of HTML. It was released in January 2006 at BarCamp NYC by John Resig. Used by over 49% of the 10,000 most visited websites, jQuery is the most popular JavaScript library in use today.

A network host is a computer connected to a computer network. A network host may offer information resources, services, and applications to users or other nodes on the network. A network host is a network node that is assigned a network layer host address.

Algorithm: In mathematics and computer science an algorithm is an effective method expressed as a finite list of well-defined instructions for calculating a function Algorithms are used for calculation, data processing, and automated reasoning. In simple words an algorithm is a step-by-step procedure for calculations.

There are many websites that can be searched for vulnerabilities and can be hacked but if you are a real hacker then you should select the website and then try to hack it and this is termed as target hacking.

A router is a device that forwards data packets between computer networks, creating an overlay inter-network. A router is connected to two or more data lines from different networks. When data comes in on one of the lines, the router reads the address information in the packet to determine its ultimate destination. Then, using information in its routing table or routing policy, it directs the packet to the next network on its journey. Routers perform the “traffic directing” functions on the Internet.

A data packet is typically forwarded from one router to another through the networks that constitute the inter-network until it gets to its destination node.

In computer networks, a proxy server is a server (a computer system or an application) that acts as an intermediary for requests from clients seeking resources from other servers.

BB5 unlocking in Nokia phones is not possible to install unsigned OS in Nokia (not simlock).

The Metasploit Project is an open-source computer security project which provides information about security vulnerabilities and aids in penetration testing and IDS signature development. Its most well-known sub-project is the Metasploit Framework, a tool for developing and executing exploit code against a remote target machine. Other important sub-projects include the Opcode Database,shell code archive, and security research.

There is not a method to decrypt nokia MCUSW file and change it because if we do it then the check sum is changed than that of phone and its not installed. Symbian can be hacked by using ROM patcher and hello.

Free hosting websites don’t allow to use rapid leech script and other forums.

Unix (officially trademarked as UNIX, sometimes also written as Unix) is a multitasking, multi-user computer operating system originally developed in 1969 by a group of AT&T employees at Bell Labs, including Ken Thompson, Dennis Ritchie, Brian Kernighan, Douglas McIlroy, and Joe Ossanna. The Unix operating system was first developed in assembly language.

A scripting language, script language, or extension language is a programming language that allows control of one or more applications. “Scripts” are distinct from the core code of the application, as they are usually written in a different language and are often created or at least modified by the end-user. Scripts are often interpreted from source code or bytecode

Cross-site scripting (XSS) is a type of computer security vulnerability typically found in Web applications that enables attackers to inject client-side script into Web pages viewed by other users. A cross-site scripting vulnerability may be used by attackers to bypass access controls such as the same origin policy. This is a Application (Web Application) Security vulnerability and could be classified into different types of Cross Site Scripting attacks such as persistent, non-persistent and DOM-based. There are contexts which are bypassed with using certain characters if not already black-listed or the application isn’t using white-list for allowing only certain legacy characters into the application input. Output encoding is one of the many methods to stop this kind of attack.

A denial-of-service attack (DoS attack) or distributed denial-of-service attack (DDoS attack) is an attempt to make a computer resource unavailable to its intended users. Although the means to carry out, motives for, and targets of a DoS attack may vary, it generally consists of the concerted efforts of a person, or multiple people to prevent an Internet site or service from functioning efficiently or at all, temporarily or indefinitely

A Media Access Control address (MAC address) is a unique identifier assigned to network interfaces for communications on the physical network segment. MAC addresses are used for numerous network technologies and most IEEE 802 network technologies including Ethernet. Logically, MAC addresses are used in the Media Access Control protocol sub-layer of the OSI reference model.

Social engineering is the art of manipulating people into performing actions or divulging confidential information. While similar to a confidence trick or simple fraud, the term typically applies to trickery or deception for the purpose of information gathering, fraud, or computer system access; in most cases the attacker never comes face-to-face with the victim.

Rooting is a process that allows users of mobile phones and other devices running the Android operating system to attain privileged control (known as “root access”) within Android’s Linux subsystem with the goal of overcoming limitations that carriers and manufacturers put on some devices. It is analogous to jailbreaking on devices running the Apple iOS operating system.

Tethering means sharing the Internet connection of an Internet-capable mobile phone with other devices. This sharing can be offered over a wireless LAN (Wi-Fi), or over Bluetooth, or by physical connection using a cable. In the case of tethering over wireless LAN, the feature may be branded as a mobile hotspot. The Internet-connected mobile phone acts as a portable router when providing tethering services to others.

Malware, short for malicious software, consists of programming (code, scripts, active content, and other software) designed to disrupt or deny operation, gather information that leads to loss of privacy or exploitation, gain unauthorized access to system resources, and other abusive behavior.The expression is a general term used by computer professionals to mean a variety of forms of hostile, intrusive, or annoying software or program code.

A honeypot is a trap set to detect, deflect, or in some manner counteract attempts at unauthorized use of information systems. Generally it consists of a computer, data, or a network site that appears to be part of a network, but is actually isolated and monitored, and which seems to contain information or a resource of value to attackers.

A cache is a component that transparently stores data so that future requests for that data can be served faster. The data that is stored within a cache might be values that have been computed earlier or duplicates of original values that are stored elsewhere. If requested data is contained in the cache (cache hit), this request can be served by simply reading the cache, which is comparatively faster. Otherwise (cache miss), the data has to be recomputed or fetched from its original storage location, which is comparatively slower. Hence, the more requests can be served from the cache the faster the overall system performance.

A Trojan horse, or Trojan, is software that appears to perform a desirable function for the user prior to run or install, but (perhaps in addition to the expected function) steals information or harms the system. The term is derived from the Trojan Horse story in Greek mythology.

Overclocking is the process of operating a computer component at a higher clock rate (more clock cycles per second) than it was designed for or was specified by the manufacturer.

The MD5 Message-Digest Algorithm is a widely used cryptographic hash function that produces a 128-bit (16-byte) hash value., MD5 has been employed in a wide variety of security applications, and is also commonly used to check data integrity.

An assembly language is a low-level programming language for computers, microprocessors, microcontrollers, and other programmable devices. It implements a symbolic representation of the machine codes and other constants needed to program a given CPU architecture.

A hash function is any algorithm or subroutine that maps large data sets to smaller data sets, called keys. For example, a single integer can serve as an index to an array (associative array). The values returned by a hash function are called hash values, hash codes,hash sums, check-sums or simply hashes.

In computer security and programming, a buffer overflow, or buffer overrun, is an anomaly where a program, while writing data to a buffer, overruns the buffer’s boundary and overwrites adjacent memory. This is a special case of violation of memory safety. Buffer overflows can be triggered by inputs that are designed to execute code, or alter the way the program operates. This may result in erratic program behavior, including memory access errors, incorrect results, a crash, or a breach of system security. They are thus the basis of many software vulnerabilities and can be maliciously exploited.

Remote File Inclusion (RFI) is a type of vulnerability most often found on websites. It allows an attacker to include a remote file, usually through a script on the web server. The vulnerability occurs due to the use of user-supplied input without proper validation. This can lead to something as minimal as outputting the contents of the file, but depending on the severity.

SQL often referred to as Structured Query Language is a programming language designed for managing data in relational database management systems (RDBMS). Originally based upon relational algebra and tuple relational calculus, its scope includes data insert, query, update and delete, schema creation and modification, and data access control. SQL injection or SQLi is a code injection technique that exploits a security vulnerability in some computer software. An injection occurs at the database level of an application (like queries). The vulnerability is present when user input is either incorrectly filtered for string literal escape characters embedded in SQL statements or user input is not strongly typed and unexpectedly executed. Using well designed query language interpreters can prevent SQL injections.

Here are some tips and factsheets you would love to check since they are mostly universal in the hackerdom culture and people know it by default. If you do not know this by default, you are missing something and need to work on it:

One cannot just press the key and hack-away a system or bring down the SCADA power grids.

There is no powerful software or an antivirus program or utility which could detect all the malware which are existent.

Would add many if there are feedbacks on some ideas and what could be possibly be missing. Leave your feedbacks in the comments and I’d appreciate if you could whip out some original sources. Roger Out.

This is an introduction post for “Graphics and Internet” for WBUT 2014, which includes C as system programming and the underlying source code concepts for drawing basic graphics using C. Earlier in this post, I discussed data-structures in C for WBUT University in details which covered the practical aspects of year 2014. This post in contrary will mention the graphical aspect of the C programming keeping in mind the practical labs. I am glad I could post as far as the syllabus is concerned (which is really outdated as discussed in the last post), but this will help the current students who could have a look here after 2014 passes.

5.) Draw a Triangle

There are others as well which are related to Web Development. The posts belonging to Web-development could already be accessed from here. The section is for everything related to ‘code’ and working with code in different languages. HTML could be found there. I would appreciate if the readers leave behind a feedback. Roger out./-

The Introduction Preface

Hi, this is about all the practical lab C for WBUT Winters (Semester 3rd of the University prescribed Syllabus) section data-structures questions solved at once place for a ready reference to the students who might seek help and also on an information as to why colleges now should be moving from the stone age. All the programs are complied under Tubro C++ compiler and would not be/should not be expected to be executed/processed to create an object under GNU C compiler or any Windows variant compilers (such as Visual C compiler). Since the syllabus itself is too outdated and people had been talking about them in various forums; I came up with a compilation of the code as well as the questions which could help them understand the core with the ready service code to be executed only within from Turbo C++ compiler. This is C code and not C++ code. The source code for each of them had been practically tested on Windows 8.1 platform using DOSBOX as an emulator to run Turbo C.

The Recommendations

It’s recommended to move on with the syllabus and pay less attention there, if anyone really is serious on C and C++ programming. Python, Ruby, Delphi, Lua and Perl are the modern spectacular languages to choose from and Java is really not that friendly as you might think if you have to do a certain task. Java isn’t that flexible in terms that Java would really need long source code for a simple problem. See “Python to other languages – A comparison“. Get to know more at Stackoverflow. To refernce from the original source, here’s is the justification why someone would prefer to code in Python rather than any other older languages in a nutshell:

Speed of development. I can crank out working code before the Java folks have stuff that will compile.

Flexibility. I can refactor and rework a module in an afternoon. The Java folks have to redesign things on paper to be sure they can get some of the bigger refactorings to recompile. In Java, the changes aren’t as small and focused.I should probably blog about some of the nastier refactorings that would be a huge pain — even using the refactoring tools in Eclipse or NetBeans. The most recent example was a major change to the top-most superclass of a class hierarchy that would have invalidated a mountain of Java code. But the method was used in exactly two places, allowing a trivial change to the superclass and those two places. 100’s of unit tests passed, so I’m confident in the change without the compiler overhead.

Simplicity. Python doesn’t need a sophisticated IDE and super-complex WS libraries. Python code can be written in Komodo Edit. A WS interface between your Java front-end and PostgresSQL can be knocked together in Werkzeug in a day. You can plug your transactions into this without much overhead.

The post primarily covered Python against Java, but there are instances why some one could just prefer Python over C which could be referenced from here in this post. This does not at all mean to compare C and Python on basis of what they have to deliver but rather compares them on an average on the end-users opinion perspective. There are other considerations as well into modern computing which is resolved below in the list.

Why Would Python be Slow but equivalently faster ever than C Deployments?

Python is a higher level language than C, which means it abstracts the details of the computer from you – memory management, pointers, etc, and allows you to write programs in a way which is closer to how humans think. It is true that C code usually runs 10 to 100 times faster than Python code if you measure only the execution time. However if you also include the development time Python often beats C. For many projects the development time is far more critical than the run time performance. Longer development time converts directly into extra costs, fewer features and slower time to market.

Why use C contrary to the switching to any other programming languages, a hope out of no-where!?

“If there ever were a quote that described programming with C, it would be this. To many programmers, this makes C scary and evil. It is the Devil, Satan, the trickster Loki come to destroy your productivity with his seductive talk of pointers and direct access to the machine. Then, once this computational Lucifer has you hooked, he destroys your world with the evil “segfault” and laughs as he reveals the trickery in your bargain with him.

But, C is not to blame for this state of affairs. No my friends, your computer and the Operating System controlling it are the real tricksters. They conspire to hide their true inner workings from you so that you can never really know what is going on. The C programming language’s only failing is giving you access to what is really there, and telling you the cold hard raw truth. C gives you the red pill. C pulls the curtain back to show you the wizard. C is truth. Why use C then if it’s so dangerous? Because C gives you power over the false reality of abstraction and liberates you from stupidity.”

The Coverage

Now since we are already hopped into C with Turbo C as a compiler. I’d go writing the source code of the practicals here and try to keep it updated as much as I could to my disposal. Instead this is the responsibility at your side to post back with comments on what else its to be added so this could help others in the process.

Notes

The source code has replaced all the instances of \n to n. Take care of that plus the include headers have not been defined to be kept away from copy/paste practices. This in my opinion will lead to a better coding practices and would lead to a great start with self-research.

The Question Set

The questions I have dug so far follows these:

Doubly Linked List with insertion and deletion.

Priority Queue with addition and deletion of elements.

Dequeue or Double Ended Queue using Linked List.

Dequeue or Double Ended Queue using Circular Array.

Priority Queue Implementation using Arrays.

Circular Queue using Linked List with Circular Queue Concept Notes.

Circular Queue Implementation in C Data-Structures using Arrays.

Stack for PUSH and POP operations in C both via recursive and regular methods.

Linear Search Implementation in C using Arrays.

Binary Search Implementation in C using Arrays.

Insertion Sort Implementation in C using Arrays.

Merge Sort Implementation in C using Arrays.

Quick Sort Implementation in C using Arrays.

Heap Sort Implementation in C using Arrays.

Source Code Solutions

1.) Doubly Linked List with Insertion, Deletion and Reverse Display

Here’s the source code (to avoid copy/paste gimmicks, I have stripped off all the includes. Feel free to add them at your own expense) for Doubly Linked List:

3.) Dequeue or Double Ended Queue using Linked List

What is Dequeue?

The word dequeue is short form of double ended queue. In a dequeue , insertion as well as deletion can be carried out either at the rear end or the front end. The following diagram illustrates a version of the same concept:

4.) Dequeue or Double Ended Queue using Circular Array

The available source code is different from the previous one which used linked list. This time the code uses the concept for circular array and implements a Dequeue or Double Ended Queue implementation around circular array. The source code is below as per the references.

5.) Priority Queue using Array

I noticed I didn’t updated a priority queue implementation using arrays. This is the reason the source code is here for a ready reference to the readers of the blog. Here is the original version of the source code which is tested against the terms and conditions posted before which should be able to run via a Turbo C compiler. Any other compiler just won’t work because the syllabus itself is outdated, and people (and universities) must realize this fast.

6.) Circular Queue using Linked List in C Data-structures with Notes

In a standard queue data structure re-buffering problem occurs for each dequeue operation. To solve this problem by joining the front and rear ends of a queue to make the queue as a circular queue
Circular queue is a linear data structure. It follows FIFO principle.

In circular queue the last node is connected back to the first node to make a circle.

Circular linked list fallow the First In First Out principle

Elements are added at the rear end and the elements are deleted at front end of the queue

Both the front and the rear pointers points to the beginning of the array.

It is also called as “Ring buffer”.

Items can inserted and deleted from a queue in O(1) time.

Circular Queue can be created in three ways. They are:

· Using single linked list

· Using double linked list

· Using arrays

Follow is the source code for implementing a Circular Queue in C using Linked List:

7.) Circular Queue Implementation in C using Arrays

Earlier in the post, we talked about implementation circular queue using Linked List. This section talks about the same implementation but using arrays. The source code below could be used for the purposes to demonstrate the concepts:

Round Robin Scheduling

Previous post discussed the two types of CPU Scheduling, Preemptive and Non-Preemptive CPU Scheduling and was focused with FCFS, SJF and Priority Scheduling techniques. We had discussed in the last post how SJF and Priority Scheduling could be modified to attain preemptive scheduling and why FCFS scheduling cannot be used as preemptive scheduling. This post will go further with another preemptive type of CPU Scheduling which is known as Round Robin CPU Scheduling. Now, as we already know Preemptive Scheduling means forcibly stopping a job from the execution and keep it in the waiting state/blocked state for a period of time until it finishes executing another job execution processing, Round Robin is another instance of Preemptive Scheduling wherein it is possible to stop the job and pick up another job from the READY QUEUE and start executing it. But there is a difference in the way Round Robin Scheduling in implemented.

In SJF (modified to SRT {Shortest Remaining Time First Scheduling}) and Priority (modified with LONG TERM and SHORT TERM Scheduler), it was possible to attain preemptive CPU Scheduling, and used time (CPU BURST TIME) and priority respectively; this however isn’t the case with Round Robin Scheduling (does not depend on CPU BURST Time of the job, or the priority of the job. All the jobs are treated equally). Round Robin Scheduling, the CPU time is divided into number of quanta. Assume the CPU quanta to be duration = 2 ms (Milli-Second). Now, whenever a job is allocated to the CPU for execution, the job will be executed for a maximum of 2 ms. If the CPU BURST time required for the job execution to be completed is more than 2 ms, after 2 ms the job will be forcibly terminated and pushed back to the READY QUEUE and the new job from the READY QUEUE will be allocated to the CPU for execution and again that this new job will be only until 2 ms since that is the quanta defined in terms of Round Robin CPU Scheduling. In case the job execution requirement for any job is less than 2 ms, the job terminates normally and not forcefully. So after termination of the the job in case the job finishes before 2 ms, the Job might go to the I/OWAITING STATE/BLOCK STATE for the CPU to handle I/O operations or might go to the HALTED STATE/TERMINATED STATE. The CPU can’t stay idle for the remaining time if the jobs has finished before the determined quanta, hence the best efficient applied as per Round Robin implementation is to take a new job and start executing the job from that point of time and hence save time with efficiency. This means, assume if the quanta is 2 ms and the job was finished in 1 ms, a new job from the READY QUEUE is taken by the CPU Scheduler and executed, this new job quanta time starts from the earlier saved time which was 1 ms (2-1 = 1 ms). So for an example, there are 4 jobs in the READY QUEUE to be executed by the CPU :

J1 = 4 ms
J2 = 2 ms
J3 = 3 ms
J4 = 6 ms

Assumption is CPU quanta to be 2 ms. That is 1 quanta = 2 ms. Now for Round Robin CPU Scheduling, the job is taken as FCFS basis, but a limited quanta is available for all the jobs per execution cycle, that is in this case 2 ms (1 quanta). The timeline, these jobs will be served is as follows:

Since, Round Robin CPU Scheduler is taking the jobs in FCFS (First Come First Served) basis, there is no priority or CPU time burst minimum time required job first assigned with the scheduling process. The allocation is done purely on first come, first served basis this way and each execution cycle for each job spends 1 quanta of time that is 2 ms which is in this case. After 1 quanta of time spent on a particular job, the job if remaining CPU BURST remains, get’s to the READY QUEUE and next job is taken. If this next job is processed and only required the exact processing time equal to that of the 1 quanta time, the job can either be pushed to the I/O WAITING STATE to cover I/O operation or might reach the HALTED STATE/TERMINATED STATE which is normal Job execution termination. If the Job has finished before the 1 quanta time, the CPU Scheduler without wasting any time pushes the next job from the READY QUEUE to the ACTIVE STATE and starts executing it until the 1 quanta time period which is being assigned similarly to other jobs. When jobs are pushed to the READY QUEUE, they always are pushed to the back of the READY QUEUE since other jobs which are finished first should be at the first to be taken by the CPU. This means the CPU takes the job from the READY QUEUE head, which again means it is following all the rules of the FCFS basis. It has also to be noted that jobs could be pushed to the READY QUEUE from the I/O WAIT STATE, NEW STATE, or ACTIVE STATE (in-case of forcible termination). Here, we need to look at the process diagram to verify if the jobs could be taken to the READY QUEUE in three ways:

The process state diagram suggests, that indeed the READY QUEUE (READY STATE as per process state diagram) get’s the jobs from all the three directions, that is the active state when forcible termination of job is done by the CPU, the new state when new arrivals of jobs are scheduled to be transferred from the new state to the ready state and the wait or blocked state when the jobs are awaiting I/O operations. Hence, after the first execution cycle, the timeline for the above example would look like this:

Now, after this timeline, all the JOBS will be completed assuming no new job arrivals were in the READY QUEUE from the NEW STATE. Hence all the jobs are treated equally in the Round Robin CPU Scheduling. There must be a timer in the system to remind the CPU what 1 quanta is over for a job, this brings the topic to a new curve. The timer we are talking about here could be programmable as well since in some installations, an administrator might want a small quanta, in other installations, the same administrator might want a higher quanta. SO this timer should be programmable, to interrupt the processor reminding the CPU that 1 quanta is past and a job must be stopped.

Timer (Programmable)

Whenever the CPU Scheduler decides that a new job has to be allocated to the CPU or the CPU allocates a new job for execution, immediately the timer has to be reset. At the end of the time pointer, the timer will generate an interrupt when again the CPU will go to the system program and the responsibility of that system program will be to terminate the current executed job, get a new job from the READY QUEUE, give it to the CPU for execution and re-start the timer. That is what happens when the required CPU BURST time in more than the quanta set in the timer. If the CPU BURST time is less then that of the quanta described in the timer, the process is not executed completely till the timer gives an interrupt. The execution is completed before the timer gives an interrupt but the process for the whole cyclic execution process is not yet completed wholly. So the last statement of every CPU BURST must be a system call. The system call for performing an I/O operation or a system call indicating that the process is complete. Again following the system call, the CPU Scheduler has to fetch a new process (job) from the READY QUEUE, give it to the CPU for execution and at the same time, the timer has to be reset so that the next time quanta starts from that point.

Variations of Round Robin Scheduling

There could be different variations of the Round Robin Scheduling, earlier there were no considerations on the Round Robin Scheduling but there could be Jobs which require more CPU BURST time duration depending if the CPU BURST time is more for I/O Operations (I/O Bound Jobs) or CPU Time (CPU Bound Jobs). The variation will depend on these CPU BURST time duration requirements! The main algorithm used will be Round Robin Scheduling.

To implement these concepts, there is a need to know MULTI-LEVEL QUEUE

MULTI-LEVEL QUEUE

There could be multiple READY QUEUE’s as such the following demonstrating how it would work:

The entire diagram suggests that there could be multiple READY QUEUE which could be taken into consideration depending upon the jobs since the variation of jobs have either I/O operation taking the CPU BURST or CPU time taking the time duration of the CPU Processing. This way, if efficiency has to be maintained such that I/O Operations are given the highest priority, the multiple READY QUEUE would have (for an example) 1 READY QUEUE divided into 3 READY QUEUE, they could be:

Q1

Q2

Q3

Here are the Jobs which would be as per the priority of execution (Round Robin Scheduling Implementation does not use Priority, here we are only giving the job prioritizing the jobs in the READY QUEUE not in the Scheduling Algorithm).

Q2 – only after Q1 is empty, the jobs in Q2 are taken. That is all I/O Bound jobs have to be completed first.

Q3 – only after both Q1 and Q2 are empty, the jobs pending on Low priority that is CPU Bound jobs are taken.

There are disadvantages here. Consider that the jobs could be dynamic in nature which means, a job which is an I/O Bound Job could be changed into requiring CPU time (converts itself into being CPU Bound Job). That way, with the current MULTI-LEVEL QUEUE implementation, the jobs in the Q1 (requiring to be executed first in order) in-spite the jobs being transformed to CPU Bound Job by being of Dynamic Nature has to be in the Q1 and executed in first preference. This is unwanted and there has to be some techniques to resolve this. This is where MULTI-LEVEL FEEDBACK QUEUE is used.

MULTILEVEL FEEDBACK QUEUE

In Multilevel feedback queue, there would be again multiple number of queue’s. Assume there are 3 queues as shown below in the diagram (but with a provision that the jobs could be taken from one queue to another queue).

Whenever the jobs are pushed into the READY QUEUE, it’s always taken to the QUEUE number 1 which is Q1. The time quanta for all the queue’s are:

Q1 = 2 ms

Q2 = 5 ms

Q3 = 10 ms

Whenever a job is entered the first time, let’s assume the nature of the jobs isn’t known that is whether the Job is I/O Bound Job or a CPU Bound Job (what will be the CPU BURST Duration). In queue number 1, the job is to be put. In queue number 1 (Q1) the jobs will be allocated to the CPU using Round Robin Scheduling, for execution of the job. Once it is allocated to the CPU, it will be executed for a minimum of 2 ms, if one fins that the job (The CPU BURST) is over is finished before 2 ms, the job will be kept in Q1 and would not be moved to Q2. This is because the first it has executed, it has shown that the CPU BURST requirement is less than 2 ms, so it’s predicted that the next CPU BURST time will also be less than 2 ms. If the CPU BURST time of the Job is less than 2 ms, the Job remains in Q1. If the timer trigger has occurred and the job is greater than 2 ms, the job will be pushed to next queue which is Q2 which has the time quanta of more than 2 ms. This will again follow the Round Robin CPU Scheduling technique for the job to be allocated to the CPU for execution. This time the time quanta is 5 ms in Q2. In Q2, if one fins that the CPU time requirement for the job is less than 5 ms, it will remain in Q2 itself. Otherwise if it is greater than 5 ms, it will be pushed to the next queue which is Q3, with time quanta 10 ms. All of these queue will follow the Round Robing CU Scheduling algorithm for CPU jobs allocation for job execution.

So conclusively, the first time the job is pushed to the Q1, if the job CPU BURST duration is grater than the current quanta threshold of that particular queue, it would be pushed to the second queue or else be retained there itself. This depends on the nature of the jobs depending upon the requirement of the jobs for the time duration needed for a complete execution of the job with levels of time quanta divided into the READY QUEUE since the QUEUE itself now has been divided according to the time duration using quanta’s. In a similar fashion, the jobs which could be pushed downwards, should be the job require more I/O Bound Operations, the same should be the procedure, to push back the job upwards that is from Q3 to Q2 and then Q2 to Q1 as per the requirement and the nature of the job (if dynamic!). This means if the job at some point of time remain to be I/O Bound, the job remains in the Q1, if at another point of time duration. the job changes it’s nature from I/O Bound to CPU Bound, it could be pushed downward (lower preference). Similarly, low priority jobs (CPU Bound Jobs) could be pushed upwards by increasing it’s priority as per the dynamic nature of the job (changes from CPU Bound job to I/O Bound Job). Hence Jobs are kept at the queue level according to the nature of the job. These are the variations of the Round Robin Technique.

The diagram above shows clearly how the jobs are now flexibly aligned in accordance to the time duration required and the dynamic nature of the job. If the jobs are changed from CPU Bound job to the I/O bound, it’d go upwards the direction and if the I/O bound jobs are changed to CPU Bound jobs, it’d move downwards the direction as per the requirement. I/O Bound Jobs have the highest priority since it requires less CPU BURST time duration than the CPU bound Jobs which requires more CPU BURST time duration and hence has a lower priority.

A feedforward is also used, since there is a concept called switch time which is the extra time required by the CPU to change from a queue to another queue. The queue could be switched directly to the appropriate queue without having them to move through the intermediate queue. This means if a job has to be transfer from the Q3 to Q1, it is directly possible but needs switch time and some extra CPU processing. This is demonstrated in the diagram below:

We have concluded over preemptive and non-preemptive CPU Scheduling from the last post and concluded this with Round Robin CPU Scheduling. All the posts which covered process management are:

FCFS (First Come First Served) – Nonpreemptive

SJF (Shortest Job First) – Nonpreemptive

Priority Scheduling – Nonpreemptive

SRT (Shortest Remaining Time First) – Preemptive

Round Robin Scheduling – Preemptive

Multilevel Queue – Preemptive

But all these CPU Scheduling which we have discussed are based on a single CPU. The modern operating systems should not remain satisfied with single processor CPU. There are distributing computing nature which is used in modern operating system be it networked processors among many systems or a single set-up having multiple core processors. We discussed single resource with multiple processes among which the resource is to be shared. What we will see next is a setup wherein there are multiple resource which is to be shared with multiple processes.

DISTRIBUTED COMPUTING

There are models which could go under distributed computing:

WORKSTATION MODEL

PROCESSOR POOL MODEL

Workstation Model could be considered as such every user which has one full fledged computer having it’s own memory, hard-disk, etc but shared on for example a LAN network without which the the computer remains functional. Every user has the processing power.

Processor Pool Model could be considered wherein one can have a high-end server having multiple processors and to the users, there could be high-end terminals (example a graphics terminal), so that the user terminal doesn’t have any processing capabilities. Users does not have processing capabilities, the processing is centralized.

Naturally for these two types of models, the approach taken for CPU sharing must be different. There hence must be two different kind of allocation techniques:

NON-MIGRATORY

MIGRATORY

NON-MIGRATORY to some extend is static in nature. In NON-MIGRATORY CPU allocation, once the process is created, it is decided on which of the processors the process has to be executed; once decided it is fixed and that process is executed on that processor until termination.

MIGRATORY is dynamic wherein the process could be migrated from one processor to another depending upon the requirement. The process itself hence could be terminated in another processor and could be originated or allocated to another processor during initiation of the process.

The next post would cover these aspects of CPU process sharing since this post was dedicated to cover Round Robin Scheduling and Multilevel Queue. Single CPU Management and Process Management hence has been covered in these five posts which could be used for a ready reference:

Previous post discussed about CPU scheduling and an introduction towards Process Management; This post will take it further to an introduction to the process management which is required for WBUT 3rd Semester BCA candidates. Particularly this post is dedicated to process state diagram and will cover the entire aspect of the same.

To start off with the details, a program when needs to be executed goes through a process. This process has several state changes in the entire operation until termination of the program. Upon successful termination, the program would get useful results to the user. This entire process progression goes through state changes which are mention below in steps:

The process enters a state called NEW STATE.

The process then enters the READY STATE.

The process then goes to an ACTIVE STATE/RUNNING STATE (Execution of the program starts here).

The process ends with the HALT STATE/TERMINATED STATE (after all the program BURST’s are over. The program might be terminated forcibly or else is terminated normally.)

The following PROCESS STATE DIAGRAM would show the entire operation:

Note, there is a intermediary state which is known to be the WAITING STATE/BLOCKED STATE. The program goes through this particular state when the CPU is busy with interaction with the I/O devices during I/O operations (this is called I/O BURST). During I/O BURST, since the CPU time is being wasted, to avoid this; the pending jobs are brought up from the queue by the CPU Scheduler and then this new job is executed with first READY STATE and then after the whole operation is finished, the original Job is picked up and executed from middle-way. This way, the CPU saves significant amount of time and maintains the efficiency. The following describes the process timeline:

CPU SCHEDULING

According to the process timeline, it could be observed that the program initiation starts with a CPU BURST and is terminated with a CPU BURST as well. During the entire process progression, the CPU has to interact with I/O devices and hence the pending jobs are completed during this time. The original job is held with a WAITING STATE/BLOCKED STATE status and upon completion of the pending process, the original job is taken. From the previous post we had discussed about two types of CPU Scheduling:

FCFS (First Come First Serve) CPU Scheduling.

SJF (Shortest Job First) CPU Scheduling.

SJF CPU Scheduling saves the time and is an efficient way to schedule jobs. This is done by the CPU Scheduler. Contrary to SJF CPU Scheduling, FCFS CPU Scheduling cannot save time and prediction for the next CPU BURST could not be determined (we need to determine or calculate the amount of time the next CPU BURST would be going to take to maintain an efficiency!) cannot be done. FCFS CPU Scheduling has a strict rule to take a Job, process and execute it and only after the termination of the original job, the next job could be taken by the CPU. Hence there is no real time efficiency scheduling been done with FCFS CPU Scheduling; the job which comes first is executed first and therefore prediction for the next CPU BURST could be applied for the SJF Scheduling algorithm. Since, SJF CPU Scheduling algorithm takes time efficiency into consideration, the CPU must predict the amount of time the CPU has to spend it’s time on NEXT CPU BURST.

CPU BURST: The amount of time spent by the CPU for a program in order to execute the program, process it for the execution.I/O BURST: The amount of time spent by the CPU for a program interacting with I/O devices for I/O operations.

Now, since a calculated prediction of the NEXT CPU BURST could only be determined for SJF CPU Scheduling, the following is considered as the standard process to calculate an estimate of the amount of time spent for the NEXT CPU BURST which would be yet to occur for a program process:

Now, there is yet another calculated special case of SJF algorithm which could be used for efficiency purposes. This special case of SJF CPU Scheduling algorithm is known as PRIORITY SCHEDULING. In case of priority scheduling, the priority levels could beset. In that case the job which has the highest priority should be executed first. Low priority jobs will be executed only after high specified priority jobs had been executed. It could be said that PRIORITY SCHEDULING could be considered as the reciprocal of the NEXT CPU BURST.

NON-PREEMPTIVE CPU SCHEDULING

Now, all of these scheduling algorithms, that is:

FCFS

SJF

Priority

are known to be NON-PREEMPTIVE SCHEDULING. The reason it is known to be NON-PREEMPTIVE Scheduling is since the processing of jobs once allocated, the CPU cannot be taken out of the job until that entire CPU BURST is complete. At the end of the current CPU BURST, another Job could be assigned to the CPU by the CPU Scheduler.

PREEMPTIVE CPU SCHEDULING

The situation with PREEMPTIVE CPU SCHEDULING is wherein the job is in it’s CPU BURST but could be made PREEMPTIVE by allocating another JOB (the current job has to be stopped before it’s natural completion). As per the three CPU Scheduling we have seen so far, the FCFS CPU Scheduling cannot be PREEMPTIVE CPU SCHEDULING because FCFS has to follow the strict rules regarding the jobs which are sent first must be completed first (executed first), and only after the normal completion of the first job execution, other pending jobs should be executed. The remaining two, that is SJF CPU Scheduling and Priority Scheduling algorithm could be modified to get PREEMPTIVE CPU SCHEDULING.

Let’s take an example of jobs which are in the READY Queue with SJF CPU Scheduling modified to suit PREEMPTIVE CPU SCHEDULING that is SHORTEST REMAINING TIME FIRST CPU SCHEDULING (SRT):

J1 – 15
J2 – 9
J3 – 3
J4 – 5

These jobs are in the ready queue with their CPU BURST time. As per the SJF CPU SCHEDULING, the shortest execution time required has to be picked up which in this case would be J3, since J3 has 3 units of time requirement and others have a longer span of time requirement. Let’s consider the execution has been started and the J3 job has spent 1 unit of time with the CPU Processing:

J3

|———–|
1 UNIT

There are remaining 2 UNITS of time completion left for job J3, but another job which is Job J5 arrives which requires an execution CPU BURST time of 1 unit, so, now on the READY Queue we have:

Now, the CPU Scheduler has to check the ready queue to find out which job has the minimum of time requirement as per the policy of SJF CPU SCHEDULING algorithm. The CPU Scheduler would find that the new job which has arrived only requires 1 time unit and hence will allocate the job J5 by PREEMPTIVE procedure of job J3 which was in the middle of the execution; the job J5 will be processed for execution:

J3 J5 2 UNIT LEFT

|———–|———–|______________|
1 UNIT 1 UNIT

So, the Job J5 will be executed since it has been scheduled to be executed in the middle of Job J3’s execution. After completion of Job J5, the CPU Scheduler would again check the READY QUEUE to check the status, and the CPU BURST requirement would be:

Assuming no new jobs came to the READY QUEUE with lower time unit requirement as compared to that of Job J3 time unit (which was left!), the CPU Scheduler would assign the CPU to execute J3 which requires 2 time units:

J3 J5 J3

|———–|———–|———————-|
1 UNIT 1 UNIT 2 UNIT

After the completion of the job J3, the CPU Scheduler yet again has to check the READY QUEUE:

J1 – 15
J2 – 9
J3 – 0
J4 – 5
J5 – 0

Now, the modified SJF algorithm will treat Job J4 to be minimum and start executing it assuming no newer jobs were upfront available in the READY QUEUE. This is how the SJF CPU Scheduling algorithm can be used to maintain efficiency in CPU processing with modification which is known to be SRT (SHORTEST REMAINING TIME FIRST) CPU Scheduling.

Now there must be a way to modify the Priority Scheduling algorithm to obtain an efficient result. This could be done using the same logic but using ‘priority’ in mind. The higher priority job must be executed first. But there would be a conflict using priorities since if a job which always have a high priority in the READY QUEUE than the others has to be executed first and this job comes coming over and again to the READY QUEUE, the lower priority jobs will starve for CPU time and hence might not get executed ever. Now, this situation is unwanted, a concept called ‘aging‘ is used. While the job remains in the READY QUEUE, at regular intervals of time, the CPU will go incrementing the priority of the jobs. Now the priority of the job isn’t decided by the user or the administrator, but it’s decided by the time spent by the CPU for a particular job while other incrementing pending jobs were getting higher priority hits since it’s been aging for CPU time. At one point the maximum priority level will be reached by the job(s) pending, and when it reaches this priority level, the CPU will start executing that job leaving the current job to the WAIT/BLOCK status.

The time taken by the CPU Scheduler which has to be executed by the CPU as well program should be negligible compared to the CPU BURST time of the jobs. Now for a brief overview of what we had discussed here were process block diagram where we talked that a process could migrate from READY state to the ACTIVE state and from the ACTIVE state to the WAITING STATE and then again from the WAITING state to the READY state until the job completion. But with new concepts involved such as PREEMPTIVE CPU Scheduling, there is another route of this migration of state, which hence could be also from the ACTIVE state to the READY state. Hence below is something which completes the Process State Diagram:

The ‘blue’ color path is the new path which is available because of PREEMPTIVE CPU Scheduling. With respect to the process state diagram; in a system if there are jobs which require more amount of CPU BURST time, such jobs would be called as ‘CPU Bound Jobs‘, another type of CPU BURST time is where a process would require more I/O time and less CPU time, such jobs are referenced as ‘I/O Bound Jobs‘. Hence two types of Jobs are:

CPU Bound Jobs

I/O Bound Jobs

Now, assume, In the READY Queue, all the jobs are CPU Bound Jobs; this means for none of the jobs, I/O operation is much concerned which again means I/O operation in the whole processing is negligible and very less time units are spent in I/O operations whereas much time is spent over CPU processing. So in such cases, the CPU time taken will be quite high and I/O devices will remain inactive. Now contradictory to the past situation where CPU Bound Jobs were in READY QUEUE and I/O operations were negligible, there could be situation where all the jobs in the READY QUEUE are I/O operation jobs and negligible CPU process jobs, which means time spent by the CPU will be negligible for these jobs and the I/O devices will be very busy since all the jobs have I/O operations. None of the previous and the current situation are wanted or desirable. Because the efficiency lies in the point that a system should be always busy with all of it’s components and in these cases either the CPU remains inactive or the I/O devices remains inactive, hence wasting ‘time’ and resources therefore go without proper management scheduling of the jobs in the first place. To avoid this situation, or rather to schedule the jobs efficiently, there are schedulers.

Technically all of this means that there must be some kind of management at the READY QUEUE to avoid situations wherein resource time are being wasted. To address the problem, there are schedulers. There are two kind of schedulers, one which takes the job from the NEW STATE to the READY STATE (shifting the job from NEW to the main memory which is dubbed as READY QUEUE – The state diagram will describe it as the READY STATE) and another which takes the job from the READY STATE to the ACTIVE STATE. Since the procedure where the job has to be taken from the READY STATE (READY Queue) to the ACTIVE STATE is complex because of very low time span of the CPU BURST. The CPU BURST time span being short, the Scheduler cannot decide which operation (whether the job has to be migrated from the READY STATE to the ACTIVE STATE or ACTIVE STATE to the READY STATE (READY QUEUE) because there are two routes here {see the diagram above which shows the new path in blue because of PREEMPTIVE CPU Scheduling}) to be done. So this scheduler which takes the job from the READY STATE (READY QUEUE) to the ACTIVE STATE is known to be SHORT TERM SCHEDULER. The other scheduler which takes the job from the NEW STATE to the READY STATE (READY QUEUE) is called LONG TERM SCHEDULER. Therefore the two kinds of Schedulers are:

LONG TERM SCHEDULER

SHORT TERM SCHEDULER

Since we discussed that in the READY QUEUE it is not desirable to have CPU Bound Jobs or I/O Bound jobs, the LONG TERM SCHEDULER would be responsible to decide what jobs should be sent to the READY STATE (READY QUEUE). The duration of the LONG TERM SCHEDULER is quite long since it has plenty of time to decide, but the scope of time involved for SHORT TERM SCHEDULER is quite less which is the reason we can afford a complex LONG TERM SCHEDULER.

Last post I went ahead to introduce process management but I really forgot to add the first module. This post will not only cover the module aspect but also answer the questions which would be related to the specific section of Operating Systems – Introduction and System Structure. Having said that one must initially assume the title would spread the post in-depth in itself. Yes, the post is about the introductory part and is consumed with answering analytically deducted questions which were asked basically in previous years before 2014. Since, this would be my take in because none in WBUT BCA did a good job at sharing, I will go ahead with my take at this.

Following are the frequently asked questions which just as well might appear for 2014 WBUT, BCA. This post might also be beneficial not only to the current in-taking the examinations but would also help other students, researchers or examiners in developing or inspiring ‘writing’ what they had already documented on the hard copy. I believe sharing the world would be the utmost priority where everyone else only hopes.

The questions related with ‘analysis’ (prediction of possibilities of their coming up in year 2014) are as follows:

1.) Differentiate between Logical and Physical Address Space.
2.) What is Operating System? State the importance of Operating System.
3.) Discuss the relationship of Operating System to basic computer hardware. Explain the hierarchy of the Operating System.
4.) Write a Short Note on Device Management and Virtual Machine.

Now there are these objective questions along with answers (a one liner) which I think might help with the Objective based questions:

Which is not a layer of the operating system? Kernel is not a layer of the operating system, others like ‘Shell’, ‘Application Program’, and ‘Critical Section’ are a part of the operating system.

The Operating system is responsible for ‘controlling peripheral devices such as monitor, printers, disk drives, etc. It also helps detecting errors in user programs. It provides an interface which allows users to choose programs to run and to manipulate files. Pretty much everything‘. Anything else would be a wrong answer. The question asked were almost every-time belonged to all of these when objectively asked.

When an interrupt occurs, ”resuming execution of interrupted process after processing the interrupt‘ happens, anything else would be a wrong attempt at answering the question.

What is a Shell? – Shell is a command interpreter, anything else is wrong.

Multiprogramming Systems ‘execute each job faster‘.

Multiprogramming is ‘more than one program executing on a machine‘.

In System mode, machine is executing operating system instructions. So basically it is in system mode that the operating system prefers to execute OS system instructions. Other modes are Normal, Safe, and User.But none of the latter would be correct if objectively asked about executing system instructions.

That been done, we now have very basic touch with the objective part. The questions which were given are as per the subjective analysis and on this analysis, i would be getting the answers in this post. The subjective questions which are predicted to come for year 2014 has already been detailed in this post before, so I would straight away drive to answering them at a go.

1.) Differentiate between logical v/s physical address space.

Answer: First off, let’s dive what really an address space is. To the definition, an address space is the amount of memory allocated for all possible addresses of a computational entity such as for example: a file, a a device, a server, or a networked computer. An address space may refer to a range of addresses which are available to the processor or available to a process. This range of addresses might be logical or physical.

Now, to answer the second part and differentiate between logical and physical address space, we need to know what are logical and what are physical address space. Logical address are the addresses generated by the CPU. From the perspective of the program that is running, an item seems to be from the address which is logically assigned by the CPU. The user-program never looks down at the Physical Addresses, it always has to refer to logical addresses generated by the CPU. In other words, the logical address space is the set of logical addresses generated by a program. Logical addresses need to be mapped to physical addresses before they are used and this mapping is handled using a hardware device called the Memory Management Unit (MMU). Now, for Physical address space, Physical address or the real address is the address seen by the memory unit and it allows the data bus to access a particular memory cell in the main memory. Logical addresses generated by the CPU when executing a program are mapped in to physical address using the MMU.

The difference between Logical Address Space and Physical Address Space: Logical address is the address generated by the CPU (from the perspective of a program that is running) whereas physical address (or the real address) is the address seen by the memory unit and it allows the data bus to access a particular memory cell in the main memory. All the logical addresses need to be mapped in to physical addresses before they can be used by the MMU. Physical and logical addresses are same when using compile time and load time address binding but they differ when using execution time address binding.

2.) What is an Operating System? State the Importance of the Operating System.

Answer: The low level software which is a collection of programs and utilities and supports basic functions such as scheduling tasks, and controlling peripherals is known as the Operating System. It sits between the user and the hardware, and lets the user use the interface to control the machine and produce or generate output. The operating system manages the I/O operations, handles interrupts, manages the file system, storage space and additionally provides utilities which could be handy for an user to automate tasks.

Importance of the Operating System: The importance of an Operating System is that is provides the user with a power to create programs, account, execute a program, access files in a controlled way, access additional systems, detect error, and access I/O devices for an automated way of working. Users depend on their Operating Systems to automate tasks which are repetitive in nature for them and also detect, manipulate and quarantine error accordingly without requiring the user to take care of the low level tasks. It interacts with the hardware and allows the hardware to instruct other hardware to progressively execute a job/task and produce useful results as an output.

3.) Discuss the Relationship of operating system to basic hardware. Explain the hierarchy structure of the operating system.

Answer: The basic computer hardware are monitor, the CPU, the keyboard, memory, and other I/O and secondary devices. Operating system manages all of these resources which is the reason it has been also termed as ‘Resource Manager’. The efficiency with which an operating system handles all these resources are remarkable and it also handles the scheduling i.e: which job depending upon their priority must be executed first by the hardware involved and which jobs are to be queued.

The structure of the Operating System is organized the following way:

This resembles to the following image which deduces out the functionality associated with each layer:

The application programs are dependent on the users of the operating system. The system program layer consists of computer, assembler, linker, library, routine, etc. The kernel directly interacts with the hardware and provides services such as hardware drivers etc. The kernel comprises of I/O drivers, CPU scheduler, pager, swapper, etc. Altogether, the structure of the Operating system manages the hardware resources in timed and at an efficient manner.

4.) Write a Short Note on Device Management and Virtual Machine.

Answer: Device Management: The operating system has an important role in handling devices and managing them. The devices can be managed by the operating system via three distinct ways:

a.) Dedicated
b.) Shared
c.) Virtual

The dedicated devices are tape drives, plotters, etc. The shared devices are printers, hard drives, etc and the virtual devices are virtual printers (spooling), etc. The status of channels, control units, and devices must be checked by the device management routines embedded into the operating system. Some devices are capable of doing an I/O peration withot any support from the channel or the control units. However most devices require the control unit and the support of channels.

Virtual Machine: Virtual Machine are visualized operating system within the operating system. The virtual machine works the same way a operating system installed on a physical hard disk might work but relies on the virtual machine control program called “VMM”. VMM stands for Virtual Machine Monitor and is responsible to link the virtual machine, often called as the ‘guest operating system‘ to the underlying primary hardware. The hardware partition for the virtual operating system would also be virtual and depends on the VMM. The advantages of visualization are:

This post was all about the introductory part of the operating system syllabus for BCA WBUT, 2014. I would come up with the continuation of the posts related to process management since I had been working on them. Related answers to process management in Operating Systems could be found later in this blog. I would first detail them and then come up with analysis (prediction) for the coming 2014 Winter exams. Stay chilled this winter and have a great start of the week ahead. Taking a leave!

Last post, I talked about the coverage of the series on operating system and the introductory post with the importance of operating system, as well as defining the operating system. In this post, I’d discuss CPU management and hence go closer into process management. The CPU is known by Central Processing Unit and it is hence obvious CPU is a process manager of the computer system. It processes the given data into desired output which is useful for the user. The process which takes place in the CPU should be in the main memory, that is the data which is to be executed via processing should be in the main memory (Random Access Memory or RAM). A multi-user system uses processes, and a process does not mean a multiple CPU handling these processes, it means that the processes are handled by the same CPU but with optimization in time and processing efficiency. The data provided by the user is fed to the CPU which is a ‘Job’, this Job needs processing to be done and hence result in execution in the CPU, the Jobs require the dependency data to be present in the main memory. Jobs are the tasks which the CPU has to undertake in order to process them, and then execute and write the results to the secondary devices (special I/O devices as discussed in y previous posts) or directly as a output to a video terminal, or printer, etc.

The terms which would be required for CPU management are:

Waiting Time

Turnaround Time

What is Waiting Time?

The gap in time between the given job for execution to the CPU and the actual time when the CPU begins to execute the given job is known as the waiting time. Or in other words the time the processing for the given job to be executed/processed remains in the ready queue for the CPU to begin processing or executing is termed as the waiting time.

Let t(0) be the time the user has given a certain job for processing or execution to the CPU. And let the actual time when the CPU begins processing/executing the given job be t(i). The time difference between t(i) and t(0) i.e: t(i) – t(0) = t(w) {Waiting time} is termed as the waiting time. So the equations are:

T(i) - T(0) = T(w)

Where,

T(i) = Time at which the user had supplied the job for processing or execution to the CPU.

T(0) = Time at which the CPU actually starts processing or execution of the supplied job.

T(w) = Waiting Time.

Now for the CPU to give an output, there must be some time taken by the CPU in order to process the job. This time on a timeline of the whole processing from job given, to job initialization by the CPU and the output could be shown as below:

Waiting Time Demonstration

As shown, the processed job by the CPU is at the last entry which is marked as T (p), this would be the output time stamp when the job is done by the CPU. Now, the concept of turnaround time hops in.

What is Turnaround Time?

The time taken for a job to complete it’s processing or execution from the point of the job submission to the CPU until it’s processing has been completed is termed as turnaround time. Or in other words, turnaround time is the total time taken between the submission of a program/process/thread/task for execution and the return of the complete output to the user.

Now, as we had assumed the time stamp when the job is completed to be T (p), the turnaround time would be as following described by the equation:

T (t) = T (p) - T (0)

Where,

T (t) = Turnaround Time

T (p) = Processed or executed job by the CPU returned to the user or written in the special I/O device or outputted.

T (0) = The time stamp when the user submitted the job/task to the CPU.

Diagrammatically, it would be:

Turnover Time

Having said that, the users would always want the waiting time and the turnaround time to be minimum in order to accomplish processing and outputting of the given jobs. But the CPU handles multi-jobs simultaneously and hence this isn’t possible or realistic. Jobs should be executed in first come first served (FCFS) basis and hence certain waiting time has to be allotted to the incoming jobs. Let’s assign these incoming jobs to be:

J1, J2, J3, J4 which would be incoming from ascending order, i.e: 1st J1 is fed to the CPU, then J2, J3 and finally J4. Hence the processing by the CPU should also be in accordance. That is if FCFS (First Come First Served) method is applied, J1 should be undertaken first and then the rest and hence the processing of J1 will be first then the rest. Applying that:

The jobs have been assigned with there respective time units of execution, that is each job is actually undertaken by the CPU at a certain time lapse, which until then it’s a waiting time. Assuming the jobs have arrived to the CPU progressively as J1, J2, J3 and then J4, I draw a general timeline:

Calculate Average Waiting Time

The above diagram shows the calculation part of the average job wait time. The calculation is simple, ignore the numbers and because it’s FCFS, start from ‘0’ for the Job 1 since Job 1 never waited, the others were in queue. The numbers given are for execution time that is the time interval the job took to get over with execution and hence the waiting time for each would be calculated as:

The last 3 units of time wasn’t a wait time, it was the time taken for the 4th job to get over with execution, the 4th job already waited for 33 units of time for it’s turn to get execution scheduled. This process undertaken by the CPU is called Job Scheduling or simply Scheduling. That comes deep later, but to calculate the average waiting time, I need to consider all the jobs which are 4 items so:

71/4 = 17.75 is the average waiting time i.e: T (wa). Hence, T (Wa) = 17.75 time units for the above example on wait time average. Now, changing the sequential order of the incoming jobs. The CPU has no control over the incoming of the jobs, but what the CPU has control of is the order in which the jobs will be given a priority for execution. This could be decided by the CPU. So, consider the order below for jobs: (considering the same queue of jobs, the situation here is re-scheduling the jobs

J4 = 3 units of time
J2 = 8 units of time
J3 = 10 units of time
J1 = 15 units of time

In this case, the execution time remains the same, however the jobs are re-shuffled according to the CPU’s preference and the priority in taking up the job. Previously, the jobs were taken first come first served basis, but here even though the jobs arrived sequentially, the CPU has the authority and control of the execution land the processing of the jobs which were given by the user. The CPU decides to execute the job in the order such that J4 was executed first, next was J2, and then J3 and finally J4 was executed.

Considering the above situation, I now wanted to determine the average waiting time for such a schedule prescribed by the CPU because the CPU has the control on the scheduling part but does not have the control over the incoming jobs. To draw a rough sketch of just occurrences with a job execution and waiting timeline:

Scheduling without FCFS. Rescheduling with CPU’s control over Scheduling

Considering the image below I had drawn (MS paint, mind not!), the time taken for execution of the jobs in previous scenario were the same, but the scheduling was done by the CPU without FCFS method but taking in priority to which jobs has to be executed first to perform optimization. The magic happens here. Now if we calculate the waiting time:

W (J4) = 0 (since it arrived first)
W (J2) = 0 + 3 = 3 (since J2 had to wait for 3 units of time because 3 units of time were wasted {rather not!} in execution of job J4)
W (J3) = 3 + 8 = 11 (since J3 had to wait until J2 was finished executing with time lapse of 8 units)
W (J1) = 11 + 10 = 21 (since J1 had to wait for J3 to finish up with execution with time lapse of 10 units)

Hence;

W (J4) = 0
W (J2) = 3
W (J3) = 11
W (J1) = 21

Total Wait Time = 35 time units
________________________________

Now, if I calculate the average waiting time T (Wa) for this, that is 35/4, it comes to 8.75 time units. So:

T (Wa) = 8.75

which is far lesser in waiting time than the previous scenario. Calculating the optimization which had occurred here and the difference, our previous FCFS achieved 17.75 of waiting time, and this scheduling by the CPU achieved 8.75. The difference in wait time optimization being:

17.75 - 8.75 = 9.00 time units

A budget of total 9 time units. So we find that just by changing the order, the same jobs were optimized. The average waiting time were reduced drastically so naturally the CPU would now prefer the second type of scheduling rather than the first scheduling. The user wold always prefer the first scenario but the CPU won’t allow that because it has to follow optimization rules. In the second scenario, there is a pattern why the average waiting time were drastically reduced. This is achieved by executing the jobs first which take lesser time for execution because the next queue of jobs will have to ‘wait’ lesser and hence optimization could occur.There are various objectives which could be achieved, the objective achieved here was to minimize the average waiting time for the jobs together to be finished in an optimized way.

So that’d be the very touch towards process management in this post. Next post, I’d bring some more fruits to the blog. The concepts of process management is vast and does not end with this basic post. To keep updated if you like these posts, subscribe via mail or keep visiting the blog. Cheers out!

Before I get to the importance of the operating system, I must define what an Operating system is, the standard definition of an operating system and then deduce it’s importance respectively. In order to define operating system, one must understand that there is a distinction between software components and hardware components of a computer. The computer itself cannot accomplish everything, it needs support from the hardware as well as support fro the hardware in order to accomplish the task it has been assigned to do. This applies both to super computers, personal computers, Macs and any devices which fall in the realm of being called as a computer, including basic calculators, watches, mobile devices and any other gadget which use hardware components as well as pre-made integrated software components. Different files which are inter-related and accomplish a certain set of task makes up the operating system. These files are system level files which does scheduling, interrupting, data transferring and managing the flow of data and is low level software component of the computer itself. And hence he standard definition of an operating system would be:

An operating system is a set of program files which controls the resources of the computer system and allows the communication of hardware components of a computer to the software components of the computer system. Operating systems provides access to computer services which is possible only via working of both the hardware components and the software components.

The operating system is like a resource manager. It handles decision making and interruption. It manages the time for tasks to occur. So, what are the resources of the computer system?

CPU – Central Processing Unit of the computer system – performs execution of a program operation. The complied program or the executable program has to be executed by the CPU to give the users the desired result. The program is taken from the secondary storage drive to the main memory. The CPU cannot access directly the secondary storage memory. The program must be brought from the secondary memory to the main memory for execution. Even the data to be processed has to be brought from the secondary memory to the main memory. The data which is to be executed must reside in the main memory for execution and hence cannot reside in the secondary memory for execution. Therefore first resource for the computer system is the CPU, the central processing unit.

The Main Memory – When a piece of program has to be executed by the CPU, this data or program must reside in the main memory, hence if there is a multi-user system where more than one user program has to be executed simultaneously. To manage these programs for more than one user is a required responsibility of the operating system.

Secondary Storage – This consists of the hard disks, magnetic tapes, floppy disks, CD-ROM drives and USB storage devices. The way the main memory is accessed and the way in which the secondary storage are accessed are different. There are different types of secondary storage as discussed above and hence the characteristics of these storage are different and never uniform. Accordingly, the different secondary storage devices are to be accessed are different. Main memory is accessed directly by the CPU, but secondary storage are not accessed directly by the CPU. For the CPU to access the secondary memory in case required data has to be fetched into the the main memory for execution of a certain program, the CPU has to consult or instruct the device driver. The device driver would look for the required files, data or programs which the CPU needs for execution, fetch it and bring them back to the CPU for such an execution to occur. Hence the way main memory is accessed and the way the secondary storage is accessed are different.

Input/Output Devices (I/O devices) – These are the devices through which the user would feed the data, write a data and will interact physically such as keyboard, mouse, etc. These devices are the input devices. When the user wants to get the data as a output in visual form, such as video terminal, a printer, etc. All of them are output devices. The secondary storage could also be considered as a I/O device because a data file processed normally resides in the secondary storage, when a program is executed, the program opens the data file which is stored in the secondary storage device, reads the data file, and after reading it closes the file which means it also inputs the data but not through the keyboard but through the hard-disk or the secondary storage. Similarly when processing data, the output is stored in the secondary storage. So considering this, the secondary storage has to be considered as a special type of input/output devices.

So, there are majorly four types of resources which the computer system has. These are as discussed above, namely, the CPU, the main memory, the secondary storage and the input/output devices. The main memory and the secondary storage are types of memory modules and could be termed as ‘memory devices’ which the computer system has the responsibility to manage as ‘memory management’. Similarly, the computer system has to manage the secondary storage and the input/output devices and the secondary storage is treated as special kind of input/output components. The computer system requires to efficiently manage all these resources for providing time to multiple users or clients. These resources are confined in a single system but in modern operating system this isn’t the case. The advancement of information distribution. When a multiple computers are considered with interconnection with the help of networking can hence accomplish distributed working in order to give relevant information to the users. Even if the network fails, the isolated computers would still work. Information could be transferred from one computer to a different computer at a different geographical location through networking and hence distribution of information, the concept of distributed computing system comes.

Distributed Computer System

Advantages of distributed computer systems:

The information storage required is minimal because all the information is not required to be in single computer system. It could be distributed among different computers. The information is broken to number of pieces and stored on different isolated computers which are inter-networked.

Having such a distributed computer environment prevents duplication of information. It prevents multiple files (data duplication) which isn’t desired. This increases the efficiency. Hence efficient utilization of resources. The modern operating systems caters this efficiency management.

Hence the responsibilities of the operating system includes controlling the hardware components, the resources which are provided to the computer system, to routinely schedule the tasks carried out by the computer system and hence along with merging the functions of hardware and software provide computer based services to the users of the computer system. Now, that we are aware of certain responsibilities of the operating system, we must enlist some of the important aspects of an operating system. They are as follows:

1. It moderates the relationship between the computer and its peripherals.

2. It helps in the management of files,- copying, deleting, moving of files from one storage location to the other.

3. It encourages the memory for its efficient usage and thus adding the speed of the computer.

4. It manages the activities of the processor in terms of job execution according to the priority of arrival ,of jobs.

5. It informs the user of nay hardware or software error.

6. It makes communication between the computer and the user or the operator possible.

In order to understand this perspective more deeper, consider reading the next concurrent posts about operating system. The posts would include process management, cache memory, deadlocks and the coverage I had put in the previous post. I shall take a leave and the next post would be on CPU management.

Hi, this semester I had something new to discuss. The subject was Operating System, and I find it a pleasure writing all of the achieved knowledge through this blog post. This post would be the introductory post since there is a lot to cover. And because there is a lot to cover, here I would go in accordance with clear mentionables and hence cover only the important aspects. The coverage will encircle all the syllabus. To let you know the university (WBUT 2014) has prescribed the following as the syllabus:

Importance of OS.

Basic concepts and terminology

Types of OS

Different views

Journey of a command execution

Design and implementation of OS

Process: Concept and views

OS view of processes

OS services for process management

Scheduling algorithms,

Performance evaluation

Inter process communication and synchronization

Mutual exclusion

Semaphores

Hardware support for mutual exclusion

Queuing implementation of semaphores

Classical problem of concurrent programming

Critical region and conditional critical region

Monitors

Messages

Deadlocks

Resource manager

Memory management

File management

Processor management

Device management

Security and protection

Authentication, protection and access control

Formal models of protection

Worms and viruses.

Multiprocessor system, classification and types

OS functions and requirements

Introduction to parallel computing

Multiprocessor interconnection synchronization.

Distributes OS – rationales

Algorithms for distributed processing

Introduction to Unix OS/DOS (case study)

All of the above topics are a standard evaluation of the syllabus and the topics marked are to be covered. The first topic is importance of OS and shall be discussed from the next post. It has come to my attention that universities rather Indian Universities are not much conceptual on drafting out syllabus. They care only to finish a heap of things without any real conclusion on the achieved skill-set. However, I choose to go the other way round and make things better with my own research and dedication because I am interested in such topics and college degree doesn’t matter much to me. The degree which is fetched might be useful for industrial jobs, but these jobs are often versatile on different things and the employee themselves need to be trained, fed, kicked and reduce the possibility of invention. This in turn re-invents the wheel of ultimate progression and limits the imaginary thoughts which could be turned into an invention and discovery.

As for this post is concerned, the coverage of the syllabus laid down by WBUT has been covered and hence I shall proceed to the next post in continuation to this post on the topic for ‘Importance of OS’. Because without really knowing why we need operating system, we would really be lost onto the topics. Feel free to navigate along the ‘categories’ to discover new contents added to ‘Operating Systems’. I shall post when time permits me and would share the additional resources if available any. I had planned to cover all the topic in each post for these to go ahead and leave a mark on a good outline coverage of all the topics. Probability of the questions asked and their answers will be also covered. An analysis from the previous year questions would also be sorted out and hence provide a flexible way to deduce the questions for the upcoming years. Since the year of writing these posts is 2014, it is the duty for other academic students to share the resources and these posts to others who shall be in need and had opted for the same university and has these topics to be covered. I shall take a leave now from this post and move along to the next posts which are due to come.

So, the bitter truth is I really had not been prepared for ISAD, a part of BCA academic course. I had to go check what had been on the syllabus to make myself accented towards ISAD. I found that most of the topics had been summoned from the earlier dose of business system and applications. I quickly researched some of the topics I could study and mywbut.com came very handy with resourceful of materials. I knew I could get some of the topics fetched from this site which prepared the notes already. I am just pushing my information on the topics I know about because not all of the contents could be grabbed from this site alone. There are other resources as well, I will share them after I finish off my content on this. This post is to supposed be updated when I am updated. Again, you cannot get ‘all’ on this post itself. If you are specifically doing your academic kung-fu, this is not the best place. I write my research and personal papers here which might be found useful at some point. This doesn’t mean you end and hopefully do your part.

There are these topics that I see i can get my hand as on :

Software Development Life Cycles – All those old bees. Namely Waterfall model, Spiral model, Incremental and you name it! there would be more…

Feasibility Studies. – I am really not aware of this. What this was suppose to mean? I have to research, and let’s see what I get!

Requirements Determination – em, I can just imagine there are requirements of some sort… I had been on pentesting; this is not majorly what I do (academics!).

Logical Design – Falls in System Design, we will get on all that later.

Physical Design – Falls in System Design.

Program Design – In System Design.

Risk and Feasibility Analysis – .. [redacted]

This post has been redacted from continuation due to time lack (the post was maintained for further study but due to the lack of time, the post is discontinued ..). See you another time, or catch the section which are available. Some good resources to look into are:

But I doubt the above link would be much beneficial. If that doesn’t work, get here:

pwntoken.wordpress.com

because if I change my mind and find some spare time, I’d share it here. This can/will happen if motivated enough. Go through my other posts on 3rd semester if needed. All the 2nd semester posts are redacted due to lack of maintenance and time management.