From Maulana Abul Kalam Azad University of Technology, West Bengal

Algorithm

The word Algorithm means “a process or set of rules to be followed in calculations or other problem-solving operations”. Therefore Algorithm refers to a set of rules/instructions that step-by-step define how a work is to be executed upon in order to get the expected results. It can be understood by taking an example of cooking a new recipe. To cook a new recipe, one reads the instructions and steps and execute them one by one, in the given sequence. The result thus obtained is the new dish cooked perfectly. Similarly, algorithms help to do a task in programming to get the expected output.The Algorithm designed are language-independent , i.e. they are just plain instructions that can be implemented in any language, and yet the output will be the same, as expected. As one would not follow any written instructions to cook the recipe, but only the standard one. Similarly, not all written instructions for programming is an algorithm. In order for some instructions to be an algorithm, it must have the following characteristics: Clear and Unambiguous: Algorithm should be clear and unambiguous. Each of its steps should be clear in all aspects and must lead to only one meaning. Well-Defined Inputs: If an algorithm says to take inputs, it should be well-defined inputs. Well-Defined Outputs: The algorithm must clearly define what output will be yielded and it should be well-defined as well. Finite-ness: The algorithm must be finite, i.e. it should not end up in an infinite loops or similar. Feasible: The algorithm must be simple, generic and practical, such that it can be executed upon will the available resources. It must not contain some future technology, or anything. Language Independent: The Algorithm designed must be language-independent, i.e. it must be just plain instructions that can be implemented in any language, and yet the output will be same, as expected. Advantages of Algorithms: It is easy to understand. Algorithm is a step-wise representation of a solution to a given problem. In Algorithm the problem is broken down into smaller pieces or steps hence, it is easier for the programmer to convert it into an actual program. Disadvantages of Algorithms: Writing an algorithm takes a long time so it is time-consuming. Branching and Looping statements are difficult to show in Algorithms. How to Design an Algorithm? In order to write an algorithm, following things are needed as a pre-requisite: The problem that is to be solved by this algorithm. The constraints of the problem that must be considered while solving the problem. The input to be taken to solve the problem. The output to be expected when the problem the is solved. The solution to this problem, in the given constraints. Designing the algorithm Now let’s design the algorithm with the help of above pre-requisites: Algorithm to add 3 numbers and print their sum: START Declare 3 integer variables num1, num2 and num3. Take the three numbers, to be added, as inputs in variables num1, num2, and num3 respectively. Declare an integer variable sum to store the resultant sum of the 3 numbers. Add the 3 numbers and store the result in the variable sum. Print the value of variable sum END

Organization

Do you remember when you first realized that your computer was more than just a monitor and keyboard? That between the mouse click and the video playing? There was something that captured your intention understood it and made it real? What is that something? Is it Gremlins? Let's imagine that we can shrink down to the size of an electron and inject ourselves into a click of a mouse. If you took your mouse apart, you'd see that it's really a very simple machine. It has a couple buttons and a system for detecting motion and distance. You might have an optical mouse that makes these measurements with lights and sensors. But older ones did this with a hard rubber ball and some plastic wheels. Same concept. When you click the button on your mouse, it sends a message to the computer with information about its position. When your mouse click is received, it's handled by the basic input output subsystem. This subsystem acts like the eyes and ears and mouth and hands of the computer. Basically, it provides a way for the computer to interact with its environment. But it also acts like a buffer to keep the CPU from being overwhelmed by distractions. In this case, the IO subsystem decides that your mouse click is pretty important. So it generates an interrupt to the CPU. Hey, cb, you got to click here. The CPU or central processing unit is the brains of the whole computer. Just like your brain doesn't take up your whole body. The CPU doesn't take up the whole computer, but it runs the show all the same. And the CPU is job its whole job is fetching instructions from memory and executing them. So while you're typing, typing, typing may be really fast, like 60 words a minute, the CPU is fetching and executing billions of instructions a second, yes, billions, every second instructions to move your mouse around on the screen to run that clock widget on your desktop, play your internet radio, manage the files you're editing on the hard drive and much much more. your computer's CPU is one heck of a multitasker. But oh my gosh, there's a very important mass click coming through. Now let's drop everything now and deal with that. There are programs for everything that the CPU does a special program for the mouse for the clock widget for the internet, radio and for dealing with letters sent by the keyboard. Each program was initially written by a human in a human readable programming language like Java or c++ or Python. But human programs take up a lot of space and contain a lot of unnecessary information to a computer. So they're compiled and made smaller and stored in bits of ones and zeros in memory. The CPU realizes that it needs instructions for how to deal with this mouse click so it looks up the address for the mouse program and sends a request to the memory subsystem for instructions stored there. Each instruction in the mouse device driver is duly fetched and executed. And that's not nearly the end of the story, because the CPU learns that the mouse was clicked when the cursor was over a picture of a button on the monitor screen. And so the CPU asks memory for the monitor program to find out what that button is. And then the CPU has to ask memory for the program for the button, which means that the CPU needs the monitor program again to show the video associated with the button. And so it goes. And let's just say that there are a lot of programs involved before you even see the button on the screen light up when you clicked it. So just the simple task of clicking your mouse means visiting all of the critical components of your computer's architecture, peripherals the basic input output system, the CPU programs and memory and not one Gremlin

Operating System

An operating system is a program that acts as an interface between the user and the computer hardware and controls the execution of all kinds of programs. Following are some of important functions of an operating System. Memory Management Processor Management Device Management File Management Security Control over system performance Job accounting Error detecting aids Coordination between other software and users Memory Management Memory management refers to management of Primary Memory or Main Memory. Main memory is a large array of words or bytes where each word or byte has its own address. Main memory provides a fast storage that can be accessed directly by the CPU. For a program to be executed, it must in the main memory. An Operating System does the following activities for memory management − Keeps tracks of primary memory, i.e., what part of it are in use by whom, what part are not in use. In multiprogramming, the OS decides which process will get memory when and how much. Allocates the memory when a process requests it to do so.De-allocates the memory when a process no longer needs it or has been terminated. Processor Management In multiprogramming environment, the OS decides which process gets the processor when and for how much time. This function is called process scheduling. An Operating System does the following activities for processor management − Keeps tracks of processor and status of process. The program responsible for this task is known as traffic controller. Allocates the processor (CPU) to a process. De-allocates processor when a process is no longer required. Device Management An Operating System manages device communication via their respective drivers. It does the following activities for device management − Keeps tracks of all devices. Program responsible for this task is known as the I/O controller. Decides which process gets the device when and for how much time. Allocates the device in the efficient way. File Management A file system is normally organized into directories for easy navigation and usage. These directories may contain files and other directions. An Operating System does the following activities for file management − Keeps track of information, location, uses, status etc. The collective facilities are often known as file system. Decides who gets the resources. Allocates the resources. De-allocates the resources. Other Important Activities Following are some of the important activities that an Operating System performs − Security − By means of password and similar other techniques, it prevents unauthorized access to programs and data. Control over system performance − Recording delays between request for a service and response from the system. Job accounting − Keeping track of time and resources used by various jobs and users. Error detecting aids − Production of dumps, traces, error messages, and other debugging and error detecting aids. Coordination between other softwares and users − Coordination and assignment of compilers, interpreters, assemblers and other software to the various users of the computer systems.