Chapter - 6 Operating System

Chapter - 6 Operating System

6.1 Fundamental concept
6.1.1 Introduction to operating system
Definition of operating system: - An organized collection of programs that controls the overall operation of the computer system is called operating system,
ð  Operating system plays a role of interface between the user and computer hardware.
ð  Examples of operating systems are: MS-DOS, Windows XP, Windows 7, Windows Vista, Linux, Mac OS, and UNIX etc.
ð  The organization or architecture of OS deal with the internal structure of OS, mainly it is divided into 3 layers as shown as figure below:

Application Software
Utility Software

Figure: Architecture of operating system

6.1.2 Role of operating system
ð  Operating system provides life to the computer hardware.
ð  The increased processing speed of the processor and its problem solving capacity created the need for more efficient modes of operating computers.
ð  The primary role of an operating system is to maximize the productivity of a computer system by operating it in the most efficient manner and minimizing the amount of human intervention.
It performs basic tasks, such as recognizing input from the keyboard, sending output to the display screen, keeping track of files and directories on the disk and controlling peripheral devices such as disk drives and printers.
Some of the roles of operating system are as follows:
·         It acts as an intermediary between program and computer hardware.
·         Operating systems loads program in the memory when power is turned on.
·         It performs basic operations i.e. recognize input from the keyboard and after processing sending output to the display screen.
·         It manages data, tracks of files and memory such as primary, secondary etc.
·         It manages scheduling process and provides the tasks to different peripheral devices.
·         Operating systems also allow users to share data and software among themselves.
·         It prevents the system from unauthorized users, hackers, crackers, computer viruses etc.

6.1.3 Functions of operating system
The functions of operating systems are:
1.      Input Output (I/O) management:
OS manages the input and output of computer. This applies to the flow of data among computers, terminals and other devices such as monitors, printers etc.
2.      Command Interpreter:
The command Interpreter takes a command from the user and then OS translates it into a detailed set of instructions, which computer can understand easily. So, main function of command interpreter is to get and execute the user specified command. In the MS-DOS, is a command interpreter.
3.      Data management:
OS software also manages the storage and retrieval of data. As the system software handles many of the details associated with the process, such details are not primary concerns for users or programmers writing application programs.
4.      File management:
File management creates a mechanism of files and directories (folder) by making a table of each file and directories in the storage device, so as to keep track of each element. Then it implements different type efficient searching mechanism of files. So, this module is responsible for data storing and retrieving. The operating system like windows manages the disk with FAT, FAT32 or NTFS file system. FAT is the short forms of the File Allocation Table. The FAT has the information about the file name, file size, date and time creation and allocation on the disk spaces. NTFS stands for New Technology File System. It has several important over FAT and support for the use of advanced data structure improve performances, reliability and disk space utilization, plus additional extensions such as security.

5.      Memory management:
Computer system includes number of storage device like registers, cache memory, primary memory, secondary memory etc. Whenever processor needs some data or instructions, it is first searched in registers and then after cache memory, if it isn’t available there, then it looks into the primary memory (RAM).If still not available, then data is brought into the main memory from hard disk. So, the way of loading, accessing and removing the data from these devices are managed by the operating system.
6.      Job Management:
It manages the jobs waiting to be processed. It recognizes the jobs, identifies their priorities, determines whether the appropriate the main memory and secondary storage capability they require is available or not, and schedules and finally a runs each job at the appropriate format. Job management uses such type of process which is called scheduling. The technique of maximum utilization of process is termed as CPU scheduling. Some scheduling algorithms are First Come First Serve, Shortest Job First, Priority Scheduling, Round Robin Scheduling etc.
7.      Process Management: -
The CPU of any computer system is called a processor. Main activities of process management are job queuing, job scheduling, keeping track of the status of each process etc. When multiple processes are running, some process may demand the input/output devices. In such case the process goes to the blocked state until the devices is available.
8.      User Interface:
An interface is a set of commands or menus through which a user communicates with a program. A command driver interface is one in which you enter commands whenever by using menu-driven; you select command from various menus displayed on the system. So, it determines how easily you can make the program do what you want.

9.      Interrupt-handling:
Interrupt is an event alters the sequences in which the processor executes instructions. There are two interrupt one is hardware interrupt and another is software interrupt. Hardware interrupt is caused by hardware devices such as keyboard, printer, chips etc. A software interrupt is generated by the processor executing specific instructions. It is caused by programs or software device like ROM BIOS.OS provides interrupt-handling procedure to run the computer very effectively.
10.  Deadlock Prevention:
 Sometimes, during a process, a situation is arises in which resource either hardware or software, shared by two or more processes cannot continue because the resource required by a process is held by another resource. In this situation, both jobs are conflict by resources. So, such type of situation or condition is called deadlock.
For examples: - If program “A” captures hard disk and ask for printer to print, and program “B” captures printer and ask for hard disk to write, then such condition creates deadlock. Such conditions are avoided by OS. For that, it takes suitable action by careful allocation of resources.

11.  Security Management:
 One of the major tasks of OS is to secure the data and program while loaded into the memory. Anyone program does not allow capturing data space of other program. It maintains memory of each program. It protects hardware and software from improper use.

12.  Virtual Storage Management:
 As we know, in multiprogramming more than one jobs are loaded in main memory at a time. But if the program is larger than main memory (RAM), then entire job cannot be loaded at once inside the memory. So, in this case, the OS uses free space of secondary memory, which is known as virtual memory.
With this software it is possible to increase the capacity of main memory without actually increasing its size. This is accomplished by breaking a job into sequences of instructions, called pages or segments, of RAM and keeping only a few of this in memory at a time. Then, the remainder memory is kept on secondary storage devices.

# Spooling:
The spooling technique is used in multiprogramming environment. The “spooling” word is composed of S(Simultaneous) P(Peripheral) O(Operation) Olin(online). In other words, a spool is a buffer that holds output for a device.
The most common spooling application is print spooling: document formatted for printing are stored usually into an area on a disk and retrieved and printed by a printer at its own rate. Printers typically can print only a single document at a time and require seconds or minutes to do so.
# Buffering:
It is an area of computer’s memory (RAM) or devices’ memory for holding data during data transfer.
Typically, the data is stored in a buffer as it is retrieved from an input device (such as a keyboard) or just before it is sent to an output device(such as a printer). There are two types of buffer.
a)      Input Buffer
b)      Output Buffer
Buffers are typically used when there is a difference between the rate at which data is received and the rate at which it can be processed or in the case that these rates are variable, for example, in a printer spooler.

6.1.4 Types of Operating System
On the basis of operating method it can be classified into different types:
A.    Based on Processing method:
1.      Batch Processing OS: - Batch Processing Operating System carried out from beginning to end without user intervention. In this system, jobs are grouped together and processed one after another. So, next job gets chance to be executed only after the completion of current job. In this type of OS, users need not wait while the job is being processed, they can collect them later. So, there is no user’s interaction. It takes long computation time. For example: - weather forecasting, statistical analysis etc.
2.      Multiprogramming: - Multiprogramming allows execution of two or more programs in a main memory of the computer. In this environment, processor processes several programs simultaneously. All the programs are kept in the job pool of the mass storage device and these programs are ready for processing but CPU is busy, so these programs are waiting their turns. When one processing is completed, next ready program is fetched from main memory for processing. Different forms of multiprogramming OS are multitasking, multiprocessing and multi-user.
3.      Multitasking: - A system able to process a number of tasks at a time is called Multitasking. It allows more than one program to run concurrently. In multitasking, only one CPU is involved, but it switches from one program to another so quickly that it gives the appearance of executing all of the programs at the same time. For example: - a user could be running a world processing package, printing a document, copying files to disks etc.
4.      Multiprocessing: - Multiprocessing refers to a computer system’s ability to support more than one process (program) at the same time. Multiprocessing systems are much more complicated than single-Process system, because the OS must allocate resources to computing process in a reasonable manner. It also refers to the utilization of multiple CPUs in a single computer system. This is also called parallel processing. MVS (Multiple Virtual System/Storage) and UNIX are two most commonly multiprocessing operating system.
5.      Time Sharing Operating System:
If a computer allows interactive access to more than one user at one time then the operation is called time-sharing. A mainframe computer may support hundreds of terminals users simultaneously when as a minicomputer support up to twenty to thirty users. Multi access operating system use multi-programming and often employ virtual memory to improve the performances. All controlling features are better in this system.
6.      Real-Time Operating System:
These operating systems are online system responds to input immediately. This operating system is designed for the purpose of controlling and monitoring external activities with timing constraints. The real time operating systems are designed to service those applications where response time is of the essence in order to prevent error, misrepresentation or even disasters. Examples of real time operating system are those which handle machine tool and monitoring of a nuclear power station, missile-launching system.

B.     Based on User interface:
Interface allows user to communicate with the computer. So, it makes interaction of user with the system. Generally, there are two main types of user interfaces: Graphical User Interface and Character User Interface.

1. Graphical User Interface (GUI)-Windows Based Operating System:
GUI allows you to enter commands by pointing and clicking at objects that appears on the screen. The main advantage of GUI is that it is easy to use. The disadvantage of GUI is the amount of memory space they need. It needs a lot of RAM and hard disk space to run.
Features of GUI:
·         GUI is graphical and user friendly.
·         Users don’t have to remember syntax and commands.
·         It needs large amount of memory space.
·         It runs other windows based programs like MS-Word, Excel etc.
·         By using icons, easy to understand the job of component.
·         It needs faster processor to operate.
·         By using GUI, easy to play games and easy to use images.
·         In GUI, other peripherals like mouse, light pen, joystick can be used.
·         GUI based OS are usually 32 or 64 bit operating system.
·         It supports multimedia environment.
·         It supports multitasking, multiprogramming, multithreading etc.
Different components supported by GUI:
·         Menu: - The program menu is a list of commands or instructions that tells your computer to perform an action such as opening program or saving documents etc.
·         Desktop: - The desktop is a container in which program icons and other interface components are arranged in attractive ways.
·         Icons: - A small image displayed on the screen to represents an object is called icon.
·         Window: - A window based program opens in a screen in a rectangular frame called Window.

2. Character User Interface (CUI)/Command Line Interface (CLI):
Command Line Interface, where the user provides the input by typing a command string with the computer keyboard and the system provide output by printing text on the computer monitor. So, the commands are accepted and executed by a part of the OS called the CUI. The main advantage of the CUI is that they can be quick to use. Since, there are no involvements of graphical components. So, CUI requires less memory to operate it. The disadvantage of CUI is that they are very difficult to use if the user doesn’t know the correct commands. DOS is very common example of CUI OS.

Features of CUI
·         CUI is faster than GUI.
·         It requires less amount of memory space.
·         CUI is more textual and less user friendly.
·         Users have to remember syntax and commands.
·         It cannot display graphics, pictures or icons.
·         It does not support multimedia environment.
·         It cannot recognize peripherals like mouse, light pen, and joystick.
·         CUI based OS are usually 8 or 16 bit operating system.

C.    Based on mode of user
1. Single User OS:
Single user OS provides an environment where single user can work in an interactive conversational mode. All the resources of the system are available to the user. If another user needs access to the computer system, they must wait till the current user finishes what they are doing and leaves. MS-DOS is an example of single user OS.

2. Multi User OS:
A Multi-user operating system lets more than one user access the computer system at a time. Access to the computer system is normally provided via a network, remotely using terminal or other computer. Today, these terminals are generally termed as personal computer and use a network to send or receive information to multi-user computer system. Examples are: - UNIX and Linux etc.
6.2 Disk Operating System (DOS)
6.2.1 Introduction
·         DOS (Microsoft Disk Operating System) is a single operating system developed in 1981 by Microsoft Corporation, USA.
·         It is the most popular operating system for 16 bit micro-computer.
·         It is still used because some available software (Turbo C, C++) have been written in DOS.
The main features of MS-DOS are:
a)      It is a single user OS.
b)      It works on both floppy and hard drives.
c)      It manages files from higher order to lower order.
d)      It supports different programming languages.
e)      It supports print spooler.

A file is a related collection of information stored on a disk having a unique name. A file name is divided into two parts. They are primary name and secondary name or extensions. Ex: - PLK.docx where PLK is primary name and .docx is the extension. An extension helps to identify the file quickly.

The process of starting the computer by loading system files (i.e. IO.SYS, COMMAND.COM and MS-DOS.SYS) from disk to computer’s memory is called Booting.
There are two types of Booting:
1.      Cold Booting:
 It is the process of starting computer from off state turning switch on to supply power to the computer first and then loading system files from disk drives into memory of computer.
2.      Warm Booting: 
The process of restarting computer by pressing CTRL+ALT+DEL or Restart button is called Warm Booting.
The device through which data are stored on disk or retrieved data from disk on to memory is called drive or disk drive. Eg: - Floppy disk, CD drive etc.

The condition given or assumed by a system is called Default. Similarly, the drive which is used to load the system on to memory is called as Default Drive.

The constant message that we will get while working on the computer is referred as prompt. It indicates the ready mode for accepting commands from user’s side by the computer.
Eg: - ‘C :\>’ is read as “c prompt”.

Common DOS commands:
Command is an order or instruction which is given to the computer to perform specific task and get reliable output. There are two types of commands in MS-DOS. They are:

1. Internal Commands:
 The commands which are parts of COMMAND.COM file of MS-DOS are called internal commands. These commands are loaded to the computer’s memory at the time of booting the computer. They are located in the memory till the computer is turned on. Examples of internal commands are CLS, DATE, TIME, DIR etc.

2. External Commands:
External commands are coordinated by individual command files either having extensions .exe or .com. In external command, the disk drive read the content of each files before execution. Examples of external commands are: CHK DSK, DISK COPY and TREE etc.

Homework [Unit- 6]

1.      What is operating system? Explain its major functions.
2.      Differentiate between GUI and CUI OS.
3.      Explain the different types of operating system with suitable examples.
4.      Describe the terms spooling and buffering.
5.      What do you mean by virtual memory? How does it differ from the main memory and secondary memory discuss.
6.      Explain the terms hardware interrupts and software interrupts.
7.      Distinguish between batch processing and on-line processing.
8.      Why GUI OS is more popular than CUI base OS? Explain.