Chapter: 2:XI_C++ Working with operating system An operating system has two parts. 1.Kernel 2.shell The kernel is responsible for interacting with hardware . Shell is responsible for interacting with user. It acts as the command interpreter which takes the commands from the user, interprets then and takes action accordingly icon: Icon is a graphic symbol representing a window element. Directory or Folder: Storage locations that store or group of files under them are known as directories. File: A file is a collection of logically related information. File save as a name .file extension There are two type of File. Primary file name: A primary file name consists of one to eight(1-8) characters in length. Secondary File name(Also called Extension): a file extension consists of a period followed by zero to three(0-3) characters. It is an optional. exe specifies executable file .bat specifies Basic program file .PAS specifies Pascal file Path: A path is a sequence of directory names which give hierarchy to access a particular directory or file name. Pathname: The full name of a file or directory. for Example: C:\>x\y Root (current or working) Directory: The first level in a multilevel directory system . It is a denoted by backslash(\). A directory can have as many child(syb) directories, but a child directory can have only one parent directory, it cannot have more one parent directories. Wild card: It give flexibility in specifying paths and files. There are two types of wild card. Question mark(?): A question mark in a filename or file name extension means that any one or none character can occupy that position. For Example: Memo?.doc would represent Memo.doc Memo3.doc Memo7.doc A??.exe means A followed by any two or less characters and extension.exe Asterisk(*): The *(Asterisk) replace any number of characters. A*.exe will list Ab.exe, Abc.exe, Ans.exe, Answer.exe *.* Can be used for referring all file with any primary name and any extension. B*.* will list all files starting with B Bc.exe Batch.dat Bat.dat 1.Introduction 2.Types of Software 2.1.System software 2.2.Application software The proficiency, versatility and processing speed of desktop computers have advanced to such an extent that any type of information and data processing is like a child’s play to the machines which are now available. Over the years , professional programmers have come out with incredible software and programs to enable our desktop computer to perform almost any type of task. This chapter is dedicated to the “ computer software ” that played a very important role in making computers a household name. Hardware represents the physical and tangible components of the computer i.e. , the components that can be seen and touched. =>Software represents the set of programs that govern the operation of the computer system and make hardware run. Software broadly classified into two categories. 1.System software 2.Application software The software that controls internal computer operations is called System Software. The system software can further be classified into two categories: 1.Operating System 2.Language Processor 1.Operating System: An Operating System is a program which acts as an interface between use and the hardware. 1.Single Program OS. As the name suggests , this OS is single user operating system , so only one user program can be supported and executed by it at any point. 2.MultiProgram OS. It supports multiprogramming.i.e., more than one user can be supported by it, therefore ,more than one user programs are loaded and active in the main store at he same time. 3.Time Sharing OS. This OS uses the time sharing technique. Each active user program is given a fair share of CPU time(δ),if the time elapses or an I/O operation is requested, CPU shifts over to the next jobs waiting and the previous program 4.Real Time os: The jobs have fixed deadlines and the jobs have to be completed within their deadlines. the system performance is measured by its ability to complete its jobs within specified deadlines. If a job cannot be complete within its deadline, its situation is called deadline overrun. 5. Multiprocessing os: The Multiprocessing os is capable of handling more than one processors as the have to be executed on more than one processor(CPU) Assembler: It translates(converts) the assembly language program into an equivalent machine language program. Compiler: It Translate(convert) the Entire HLL program into machine language program in one go, and reports all errors of the program along with the line numbers. Interpreter: It Translate(convert) the HLL program into machine language program line by line. It is a set of programs necessary to carry out operations for a specified application. 1.Package 2.Utilities 3.Customised software Word processing package: Word processing package is a package that processes textual(compossion) matter and creates organized and flawless(Error free) documents. Example: Word,Wordstar,softword. . Electronic Spreadsheets: An Electronic spreadsheet is a program that accepts data in a tabular form( in rows and columns) and allows to manipulate/calculate/analyze data in the desired manner. Examples: Exel,Lotus1-2-3 etc. Database Management system (DBMS): It is a package that can handle and manage bulk of stored data. Desktop Publishing Packages: The software that handles page layout by combining the functions of a traditional typesetter and a layout artist, is known as desktop publishing software. Graphics Software: The application software that manipulates images is known as graphic software. multimedia software: the software the incorporates images , text, sound, computer animation, and video sequences is known as multimedia software. Presentation Graphic software: The application software that can create professional looking visual aids. Utilities: Utilities are those application programs that assist that the computer by performing housekeeping functions like backing up disk or scanning/cleaning viruses or arranging information etc. Text Editor: It is used for creating, editing text files. It supports special commands for text editing i.e., You can insert, delete, find, replace characters, lines and paragraphs etc. Backup Utility: This utility program facilitates the backing up of disk. Back-up means duplicating the disk information so that in case of any damage or data-loss, this back up data may be used. Compression Utility: This utility program facilitates compression of files. Large files can be compression so that they take less storage area. When needed ,these compressed files can be exploded back to their original form. Disk Defragmenter: This utility program attempts to minimize the fragmentation on your disk . A file is fragmented when it becomes too large for your computer to store in a single location on a disk. Antivirus Software: It ensures virus –free work environment. A computer virus is a program that can inject other computer programs by modifying them in such a way as to include a copy of itself. Need For Operating System To make computer system convenient to use To use computer hardware in an efficient manner It decides How to do? What to do? When to do? => Types of services provided by OS : (i). Program execution: It is responsible for executing various programs whether user programs or system programs. (ii). Handling Input/output operation: It is responsible for Handling various Inputand various output in the appropriate manner. (iii). Manipulation of file system: It is responsible for making of decisions regarding the storage of file. (iv). Error Detecting and Handling : It is also responsible for detecting any type of errors that occurs and then properly handling it (v).Resource Allocation: It is responsible for proper use of resources available. (vi). Accounting: It keeps an account of what type of functioning is taking place and what type of errors have occurred. (viii). Information and Resource Protection: It is responsible for ensuring that the information and resources available on machine are used in the correct way =>Functions of an Operating System An operating system has variety of functions to perform. It divided into three types: (i). Processor Management: This deals with management of the Central Processing Unit (CPU). The operating system takes care of the allotment of CPU time to different processes. This is called scheduling. => Throughput: It is the amount of work accomplished in a given time interval. =>Priority Scheduling: Each task is given CPU time according to the priority assigned to that task. The program with higher priority will be given CPU time before a program with lower priority. The CPU executes the task till it is completed or there is some interrupt request i.e. till the time operating system has to stop (interrupt) the current task due to an unavoidable job request. => There are two types of scheduling technique. (i). Non-Preemptive scheduling. (ii). Preemptive scheduling. =>Non-Preemptive scheduling: A scheduled job always completes before another scheduling decision is made. =>It is divided into three types: (a). First Come First Serve(FCFS) Scheduling. (b). Shortest Job Next(SJN) Scheduling. (c). Deadline Scheduling. => First Come First Served Scheduling: It work on the basis of FCFO. The process, which requests the CPU First, is allocated the CPU first. A query is maintained called ready queue in which all the process , that want cpu time are entered. =>Shortest Job Next(SJN) scheduling: Whenever a new job is to be admitted , the shortest of the arrived job is selected and given the cpu time. Throughput remain the same as in FCFS but waiting time improved. => Deadline Scheduling: a Deadline of a job is the time limit within a job must be over. If a job overshoots its deadline, it is said to be Deadline Over Run. => Deadline Over Run(K) = C-D Where C is job completion time D is Deadline for a job => Preemptive Scheduling: A scheduling decision can be made even while the job is executing whereas in Non-Preemptive scheduling , a scheduling decision is made only after job completes it execution. => It is Divided into two types (i). Round Robin Scheduling. (ii). Response Ratio Scheduling. =>Round Robin Scheduling: This type of scheduling technique is also known as Time Sharing Scheduling. In this, each program or task is given a fixed amount of time to execute. The CPU continues with the execution till either the allotted time is over or there is some interrupt request or the task is completed before the allotted time. If the task is not completed at the end of the allotted time, it is put at the end of the queue. So each task gets its allotted share of CPU time. This scheduling technique improves the response time and provides an interactive environment. => Response Ratio Scheduling: Elapsed Time Response Ratio= Execution time received The job with highest response ration is preferred over others. When a short job arrives , its response ration is high, so it is scheduled for execution immediately. => Storage Management: In a computer, both the CPU and the I/O devices interact with the memory. When a program needs to be executed it is loaded onto the main memory till the execution is complete. Thereafter that memory space is freed and is available for other programs. The common memory management techniques used by the operating system are Partitioning and Virtual Memory. => Continuous Storage Allocation: each problem, , which is to be executed , is allocated a contiguous storage memory .each job step is considered as a single independent entity for allocation for a contiguous storage area. =>Non-Continuous Storage Allocation: A program can be stored in Non-Continuous Storage area . A program is divided into smaller components of equal sizes. One of more components can be stored in the non-Continuous Storage area .each component in that particular memory area is provided addresses 0,1,2,…..n . => Virtual storage using Paging: In this technique the program is executed even if the complete program is not loaded on to the main memory. The operating system divides the main memory into equal sizes called pages. A part of the program resides in the main memory and is called the active set. The rest is in the secondary storage device in the form of tracks/sectors or blocks. With the help of Page Map Tables (PMT), the operating system keeps track which page of main memory is storing which block of secondary memory. A virtual address (which is not the real physical address) is mapped either to the main memory or the secondary memory. Hence virtual memory allows more programs and even larger programs to be executed in the main memory leading to efficient memory utilization. => Demand Paging: Bringing in(paging –in) the required pages is called DEMAND PAGING. => Virtual storage using Segmentation: In this technique, use of program segment. A program segment is a logical unit of a program as defined by a programmer.it is a piece of program logic which performs a specific task. The programmer only for determining how many segments a program should have or which program units should comprise a segment. Foe accessing a particular word in the segment, its logical address consists of two parts: (i). Segment Number. (ii). Word Number. => This segment number mapped on to ‘SEGMENT TABLE’ to get physical address of the segment and by adding the word’s identification number, physical or logical address of the word is found out. Again the hardware unit , address transformation unit , is responsible for generation of actual address of the required word within the segment. => Information Management: The Information Management component of OS is structured as follow: (i). Physical IOCS(input-output control system): It is responsible for device management and for ensuring device independence. (ii). Logical IOCS: It is responsible for efficient organization and access of the data on IO device. (iii). File System: It is responsible for protecting and controlling sharing of files. => Commonly Used Operating Systems: (i). Linux: Linux is a free and open software which means it is freely available for use and since its source code is also available so anybody can use it, modify it and redistribute it. It can be downloaded from www.linux.org. (ii). Windows: Microsoft launched Windows 1.0 operating system in 1985 and since then Windows has ruled the world’s software market. It is a GUI (Graphic User Interface) and various versions of Windows have been launched like Windows. like Windows 7, Windows 8. (iii). BOSS (Bharat Operating System Solutions): This is an Indian distribution of GNU/Linux. It consists of Linux operating system kernel, office application suite, Bharateeya OO, Internet browser (Firefox), multimedia applications and file sharing. (iv). Solaris: It is a free Unix based operating system introduced by Sun Microsystems in 1992. It is now also known as Oracle Solaris. (v). Mobile Operating Systems (Mobile OS): It is the operating system that operates on digital mobile devices like smart phones and tablets. The most commonly used mobile operating systems are –Android and Symbian. => Android: It is a Linux derived Mobile OS released on 5th November 2007 and by 2011 it had more than 50% of the global Smartphone market share. It is Google’s open and free software that includes an operating system, middleware and some key applications for use on mobile devices. => Symbian: This Mobile OS by Nokia (currently being maintained by Accenture) designed for smartphones. It offers high level of functional integration between communication and personal information management. It has an integrated mail box and it completely facilitates the usage of all Google applications in your smartphone easily. => Window Phone => Apple iOS => RIM BlackBerry OS =>Distributed Operating System: On a network data is stored and processed on multiple locations. The Distributed Operating System is used on networks as it allows shared data/files to be accessed from any machine on the network in a transparent manner. We can insert and remove the data and can even access all the input and output devices. The users feel as if all data is available on their workstation itself. =>Interactive Operating System: This is the operating system that provides a Graphic User Interface (GUI) through which the user can easily navigate and interact. The computer responds almost immediately after an instruction has been entered, and the user can enter new instructions after seeing the results of the previous instructions.