Sunday, 5 April 2020

Operating System - I/O Softwares

Operating System - I/O Softwares

Operating System - I/O Softwares
I/O software is often organized in the following layers −
·        User Level Libraries − This provides simple interface to the user program to perform input and output. For example, stdio is a library provided by C and C++ programming languages.
·        Kernel Level Modules − This provides device driver to interact with the device controller and device independent I/O modules used by the device drivers.
·        Hardware − This layer includes actual hardware and hardware controller which interact with the device drivers and makes hardware alive.
A key concept in the design of I/O software is that it should be device independent where it should be possible to write programs that can access any I/O device without having to specify the device in advance. For example, a program that reads a file as input should be able to read a file on a floppy disk, on a hard disk, or on a CD-ROM, without having to modify the program for each different device.

Device Drivers
Device drivers are software modules that can be plugged into an OS to handle a particular device. Operating System takes help from device drivers to handle all I/O devices. Device drivers encapsulate device-dependent code and implement a standard interface in such a way that code contains device-specific register reads/writes. Device driver, is generally written by the device's manufacturer and delivered along with the device on a CD-ROM.
A device driver performs the following jobs −
  • To accept request from the device independent software above to it.
  • Interact with the device controller to take and give I/O and perform required error handling
  • Making sure that the request is executed successfully
How a device driver handles a request is as follows: Suppose a request comes to read a block N. If the driver is idle at the time a request arrives, it starts carrying out the request immediately. Otherwise, if the driver is already busy with some other request, it places the new request in the queue of pending requests.
Interrupt handlers
An interrupt handler, also known as an interrupt service routine or ISR, is a piece of software or more specifically a callback function in an operating system or more specifically in a device driver, whose execution is triggered by the reception of an interrupt.
When the interrupt happens, the interrupt procedure does whatever it has to in order to handle the interrupt, updates data structures and wakes up process that was waiting for an interrupt to happen.
The interrupt mechanism accepts an address ─ a number that selects a specific interrupt handling routine/function from a small set. In most architectures, this address is an offset stored in a table called the interrupt vector table. This vector contains the memory addresses of specialized interrupt handlers.
Device-Independent I/O Software
The basic function of the device-independent software is to perform the I/O functions that are common to all devices and to provide a uniform interface to the user-level software. Though it is difficult to write completely device independent software but we can write some modules which are common among all the devices. Following is a list of functions of device-independent I/O Software −
  • Uniform interfacing for device drivers
  • Device naming - Mnemonic names mapped to Major and Minor device numbers
  • Device protection
  • Providing a device-independent block size
  • Buffering because data coming off a device cannot be stored in final destination.
  • Storage allocation on block devices
  • Allocation and releasing dedicated devices
  • Error Reporting
User-Space I/O Software
These are the libraries which provide richer and simplified interface to access the functionality of the kernel or ultimately interactive with the device drivers. Most of the user-level I/O software consists of library procedures with some exception like spooling system which is a way of dealing with dedicated I/O devices in a multiprogramming system.
I/O Libraries (e.g., stdio) are in user-space to provide an interface to the OS resident device-independent I/O SW. For example putchar(), getchar(), printf() and scanf() are example of user level I/O library stdio available in C programming.
Kernel I/O Subsystem
Kernel I/O Subsystem is responsible to provide many services related to I/O. Following are some of the services provided.
·        Scheduling − Kernel schedules a set of I/O requests to determine a good order in which to execute them. When an application issues a blocking I/O system call, the request is placed on the queue for that device. The Kernel I/O scheduler rearranges the order of the queue to improve the overall system efficiency and the average response time experienced by the applications.
·        Buffering − Kernel I/O Subsystem maintains a memory area known as buffer that stores data while they are transferred between two devices or between a device with an application operation. Buffering is done to cope with a speed mismatch between the producer and consumer of a data stream or to adapt between devices that have different data transfer sizes.
·        Caching − Kernel maintains cache memory which is region of fast memory that holds copies of data. Access to the cached copy is more efficient than access to the original.
·        Spooling and Device Reservation − A spool is a buffer that holds output for a device, such as a printer, that cannot accept interleaved data streams. The spooling system copies the queued spool files to the printer one at a time. In some operating systems, spooling is managed by a system daemon process. In other operating systems, it is handled by an in kernel thread.
·        Error Handling − An operating system that uses protected memory can guard against many kinds of hardware and application errors.

Office Tools

Office Tools
Office Tools
Application software that assist users in regular office jobs like creating, updating and maintaining documents, handling large amounts of data, creating presentations, scheduling, etc. are called office tools. Using office tools saves time and effort and lots of repetitive tasks can be done easily. Some of the software that do this are −
  • Word processors
  • Spreadsheets
  • Database systems
  • Presentation software
  • E-mail tools
Let us look at some of these in detail.
Word Processor
A software for creating, storing and manipulating text documents is called word processor. Some common word processors are MS-Word, WordPad, WordPerfect, Google docs, etc.

A word processor allows you to −
  • Create, save and edit documents
  • Format text properties like font, alignment, font color, background color, etc.
  • Check spelling and grammar
  • Add images
  • Add header and footer, set page margins and insert watermarks
Spreadsheet
Spreadsheet is a software that assists users in processing and analyzing tabular data. It is a computerized accounting tool. Data is always entered in a cell (intersection of a row and a column) and formulas and functions to process a group of cells is easily available. Some of the popular spreadsheet software include MS-Excel, Gnumeric, Google Sheets, etc. Here is a list of activities that can be done within a spreadsheet software −
  • Simple calculations like addition, average, counting, etc.
  • Preparing charts and graphs on a group of related data
  • Data entry
  • Data formatting
  • Cell formatting
  • Calculations based on logical comparisons

Presentation Tool
Presentation tool enables user to demonstrate information broken down into small chunks and arranged on pages called slides. A series of slides that present a coherent idea to an audience is called a presentation. The slides can have text, images, tables, audio, video or other multimedia information arranged on them. MS-PowerPoint, OpenOffice Impress, Lotus Freelance, etc. are some popular presentation tools.

Database Management System
Software that manages storage, updating and retrieval of data by creating databases is called database management system. Some popular database management tools are MS-Access, MySQL, Oracle, FoxPro, etc.

Open Source Software

Open Source Software
            Open Source Software

A software whose source code is freely distributed with a license to study, change and further distributed to anyone for any purpose is called open source software. Open source software is generally a team effort where dedicated programmers improve upon the source code and share the changes within the community. Open source software provides these advantages to the users due to its thriving communities −
  • Security
  • Affordability
  • Transparent
  • Interoperable on multiple platforms
  • Flexible due to customizations
  • Localization is possible
Freeware
A software that is available free of cost for use and distribution but cannot be modified as its source code is not available is called freeware. Examples of freeware are Google Chrome, Adobe Acrobat PDF Reader, Skype, etc.
Shareware
A software that is initially free and can be distributed to others as well, but needs to be paid for after a stipulated period of time is called shareware. Its source code is also not available and hence cannot be modified.
Proprietary Software
Software that can be used only by obtaining license from its developer after paying for it is called proprietary software. An individual or a company can own such proprietary software. Its source code is often closely guarded secret and it can have major restrictions like −
  • No further distribution
  • Number of users that can use it
  • Type of computer it can be installed on, example multitasking or single user, etc.
For example, Microsoft Windows is a proprietary operating software that comes in many editions for different types of clients like single-user, multi-user, professional, etc

Utility Software

Utility Software

Utility Software
Application software that assist OS in carrying out certain specialized tasks are called utility software. Let us look some of the most popular utility software.

Antivirus

A virus can be defined as a malicious program that attaches itself to a host program and makes multiple copies of itself, slowing down, corrupting or destroying the system. A software that assists the OS in providing virus free environment to the users is called antivirus. An anti-virus scans the system for any virus and if detected, gets rid of it by deleting or isolating it. It can detect many types of virus like boot virus, Trojan, worm, spyware, etc.
When any external storage device like USB drive is attached to the system, anti-virus software scans it and gives an alert if a virus is detected. You can set up your system for periodic scans or scan whenever you feel the need. A combination of both the techniques is advisable to keep your system virus free.

File management tools

As you know, file management is an important function of operating systems as all data and instructions are stored in the computer in form of files. Utility software providing regular file management tasks like browse, search, update, preview, etc. are called file management tools. Windows Explorer in Windows OS, Google desktop, Directory Opus, Double Commander, etc. are examples of such tools.

Compression tools

Storage space is always at a premium in computer systems. So operating systems are always looking at ways to minimize amount of storage space taken by files. Compression tools are utilities that assist operating systems in shortening files so that they take less space. After compression files are stored in a different format and cannot be read or edited directly. It needs to be uncompressed before it can be accessed for further use. Some of the popular compression tools are WinRAR, PeaZip, The Unarchiver, etc.

Disk Cleanup

Disk cleanup tools assist users in freeing up disk space. The software scans hard disks to find files that are no longer used and frees up space by deleting them.

Disk Defragmenter

Disk defragmenter is a disk management utility that increases file access speeds by rearranging fragmented files on contiguous locations. Large files are broken down into fragments and may be stores in non-contiguous locations if contiguous ones are not available. When such files are accessed by the user, access speed is slow due to fragmentation. Disk defragmenter utility scans the hard disk and tries to assemble file fragments so that they may be stored in contiguous locations.

Backup

Backup utility enables backing up of files, folders, databases or complete disks. Backups are taken so that data may be restored in case of data loss. Backup is a service provided by all operating systems. In stand-alone systems backup may be taken in the same or different drive. In case of networked systems backup may be done on backup servers.

Basics of Computers - System S/W

Basics of Computers - System S/W

As you know, system software acts as an interface for the underlying hardware system. Here we will discuss some important system software in detail.
Operating System
Operating system (OS) is the lifeline of computer. You connect all the basic devices like CPU, monitor, keyboard and mouse; plug in the power supply and switch it on thinking you have everything in place. But the computer will not start or come to life unless it has an operating system installed in it because OS −
  • Keeps all hardware parts in a state of readiness to follow user instructions
  • Co-ordinates between different devices
  • Schedules multiple tasks as per priority
  • Allocates resource to each task
  • Enables computer to access network
  • Enables users to access and use application software
Besides initial booting, these are some of the functions of an operating system −
  • Managing computer resources like hardware, software, shared resources, etc.
  • Allocating resources
  • Prevent error during software use
  • Control improper use of computer
One of the earliest operating systems was MS-DOS, developed by Microsoft for IBM PC. It was a Command Line Interface (CLI) OS that revolutionized the PC market. DOS was difficult to use because of its interface. The users needed to remember instructions to do their tasks. To make computers more accessible and user-friendly, Microsoft developed Graphical User Interface (GUI) based OS called Windows, which transformed the way people used computers.
Assembler
Assembler is a system software that converts assembly level programs to machine level code.
These are the advantages provided by assembly level programming −
  • Increases efficiency of the programmer as remembering mnemonics is easier
  • Productivity increases as number of errors decreases and hence debugging time
  • Programmer has access to hardware resources and hence has flexibility in writing programs customized to the specific computer
Interpreter
The major advantage of assembly level language was its ability to optimize memory usage and hardware utilization. However, with technological advancements computers had more memory and better hardware components. So ease of writing programs became more important than optimizing memory and other hardware resources.
In addition, a need was felt to take programming out of a handful of trained scientists and computer programmers, so that computers could be used in more areas. This led to development of high level languages that were easy to understand due to resemblance of commands to English language.
The system software used to translate high level language source code into machine level language object code line by line is called an interpreter. An interpreter takes each line of code and converts it into machine code and stores it into the object file.
The advantage of using an interpreter is that they are very easy to write and they do not require a large memory space. However, there is a major disadvantage in using interpreters, i.e., interpreted programs take a long time in executing. To overcome this disadvantage, especially for large programs, compilers were developed.
Compiler
System software that store the complete program, scan it, translate the complete program into object code and then creates an executable code is called a compiler. On the face of it compilers compare unfavorably with interpreters because they −
  • are more complex than interpreters
  • need more memory space
  • take more time in compiling source code
However, compiled programs execute very fast on computers. The following image shows the step-by-step process of how a source code is transformed into an executable code −
These are the steps in compiling source code into executable code −
·        Pre-processing − In this stage pre-processor instructions, typically used by languages like C and C++ are interpreted, i.e. converted to assembly level language.
·        Lexical analysis − Here all instructions are converted to lexical units like constants, variables, arithmetic symbols, etc.
·        Parsing − Here all instructions are checked to see if they conform to grammar rules of the language. If there are errors, compiler will ask you to fix them before you can proceed.
·        Compiling − At this stage the source code is converted into object code.
·        Linking − If there are any links to external files or libraries, addresses of their executable will be added to the program. Also, if the code needs to be rearranged for actual execution, they will be rearranged. The final output is the executable code that is ready to be executed.

Software Concepts

Software Concepts

Software Concepts
As you know, the hardware devices need user instructions to function. A set of instructions that achieve a single outcome are called program or procedure. Many programs functioning together to do a task make a software.
For example, a word-processing software enables the user to create, edit and save documents. A web browser enables the user to view and share web pages and multimedia files. There are two categories of software −
  • System Software
  • Application Software
  • Utility Software
Let us discuss them in detail.

System Software

Software required to run the hardware parts of the computer and other application software are called system software. System software acts as interface between hardware and user applications. An interface is needed because hardware devices or machines and humans speak in different languages.
Machines understand only binary language i.e. 0 (absence of electric signal) and 1 (presence of electric signal) while humans speak in English, French, German, Tamil, Hindi and many other languages. English is the pre-dominant language of interacting with computers. Software is required to convert all human instructions into machine understandable instructions. And this is exactly what system software does.
Based on its function, system software is of four types −
  • Operating System
  • Language Processor
  • Device Drivers

Operating System

System software that is responsible for functioning of all hardware parts and their interoperability to carry out tasks successfully is called operating system (OS). OS is the first software to be loaded into computer memory when the computer is switched on and this is called booting. OS manages a computer’s basic functions like storing data in memory, retrieving files from storage devices, scheduling tasks based on priority, etc.

Language Processor

As discussed earlier, an important function of system software is to convert all user instructions into machine understandable language. When we talk of human machine interactions, languages are of three types −
·        Machine-level language − This language is nothing but a string of 0s and 1s that the machines can understand. It is completely machine dependent.
·        Assembly-level language − This language introduces a layer of abstraction by defining mnemonics. Mnemonics are English like words or symbols used to denote a long string of 0s and 1s. For example, the word “READ” can be defined to mean that computer has to retrieve data from the memory. The complete instruction will also tell the memory address. Assembly level language is machine dependent.
·        High level language − This language uses English like statements and is completely independent of machines. Programs written using high level languages are easy to create, read and understand.
Program written in high level programming languages like Java, C++, etc. is called source code. Set of instructions in machine readable form is called object code or machine code. System software that converts source code to object code is called language processor. There are three types of language interpreters−
·        Assembler − Converts assembly level program into machine level program.
·        Interpreter − Converts high level programs into machine level program line by line.
·        Compiler − Converts high level programs into machine level programs at one go rather than line by line.

Device Drivers

System software that controls and monitors functioning of a specific device on computer is called device driver. Each device like printer, scanner, microphone, speaker, etc. that needs to be attached externally to the system has a specific driver associated with it. When you attach a new device, you need to install its driver so that the OS knows how it needs to be managed.

Application Software

A software that performs a single task and nothing else is called application software. Application software are very specialized in their function and approach to solving a problem. So a spreadsheet software can only do operations with numbers and nothing else. A hospital management software will manage hospital activities and nothing else. Here are some commonly used application software −
  • Word processing
  • Spreadsheet
  • Presentation
  • Database management
  • Multimedia tools

Utility Software

Application software that assist system software in doing their work is called utility software. Thus utility software is actually a cross between system software and application software. Examples of utility software include −
  • Antivirus software
  • Disk management tools
  • File management tools
  • Compression tools
  • Backup tools