Operating Systems

An operating system is a collection of integrated , interrelated and interdependent groups of programs , which are designed to perform various internal operations of Computer efficiently and make it easier for people to use the computer .

Tasks of Operating System :

**1)** Recognizing input from input devices **2)** Sending Output to Output devices **3)** keeping track of files and directories on secondary storage devices **4)** Controlling Peripheral Devices

Classification of Operating Systems :

1. **Multi-User :** Allows two or more users to run programs at the same time .
2. **Multi-Processing :** Allows a single program to run on more than one CPU .
3. **Multi-Tasking :** Allows two or more processes to run simultaneously .
4. **Multi-Threading :** Allows different parts of a program to run simultaneously .
5. **Real Time** **:** Responds to input instantly . (e.g. DOS , UNIX are not real time)

## Information Management

Information Management (IM) refers to a set of services used for storing , retrieving , modifying or removing the information on various devices . IM consists of two main modules :

**1)** File system .... **2)** Device Driver (DD) or Device Management (DM)

**Block :** A block is a logical unit of data that the operating system defines for its convenience .

**Files :** A file in a computer refers to a set of data and/or instructions . Every file generally has these properties : name , extension , size , type , etc.

**Directories (Folders) :** A directory is a logical structure or Object which is linked to sub-directories and files that behave as if they are stored within it .

**VTOC or Device Directory :** VTOC stands for Volume Table of Contents . For every file , the OS maintains a VTOC , which stores file information such as File Name , Extension , Size , etc.

**System Calls :** The system calls under IM are : create a file , open a file , close a file , Write data form buffer to head , create link , create a directory , Explore a directory , read data from file to buffer , move file pointer , change working directory .

## File Operations

**File Access Methods**

 Files store Data . When a file is being used , its data is to be accessed :

1. Sequential Access : Records are sequentially stored one after the other . The drawback is that the application has to go through the records sequentially before finding the required record .
2. Direct Access : In this method , any block can be read or written at random without having to search sequentially .

**Allocation Methods**

 These are methods of storing data and allocating memory to data .

1. **Contiguous Allocation :** In this method , every file is allocated consecutive blocks on storage device . The drawback with this method is the relocation of free space to new files and limit on maximum file size . If we want to edit a file , then it may require more space . Thus , contiguous allotment uses a technique called **Dynamic Allocation** . In dynamic allocation , disk space is perceived as a large array of blocks . The OS searches through the 'holes and determines which is the best hole to insert data . For this , the OS uses three methods : First Fit , Best Fit , Worst Fit . **First Fit** technique allocates the first big enough space . **Best Fit** technique allocates the smallest hole which is big enough to store data . **Worst Fit** technique allocates the largest hole to store data .
2. Linked or Chained Allocation : In this method , the file may be scattered in different locations or blocks . This directory contains a pointer to first and last block in the file . In this method , direct access is not possible .
3. Indexed Allocation : All pointers are brought together into one block called as index block . Each file has its own index block . A file allocation table is maintained by an OS on a floppy or hard disk that provides a map of clusters that a file has been stored in .

## File Systems

**File Systems :** The collection of related information is called as a file system . For convenient use , the OS provides systematic list of file directories and systems .

There are two types of file systems : disk-based and tape-based .

**Disk based Systems :** Each disk is divided into tracks and each track is dividd into sectors .

A sector is the smallest unit of unformation which can be read from and written to the disk . **Sector** varies from 32 bytes to 4096 bytes . A track contains 4 to 32 sectors per track and from 75 to 500 tracks per disk .

The time requird for read/write heads to move to correct tracks is called as **Sek Time** . The time required to activate Read/Write Heads for appropriate surface is called as **transmission time** . The time rquired for requested sector on track to rotate blow the had is called as **Latency time** or **rotational delay** .

**Tape-based Systems :** They are simple but inefficient .

## **Device Drivers**

Device Drivers are software programs required for each device . Each device requires different drivers based on its functions . A device driver knows how should the buffers , flags , register control and status bits should be used for a device . Some device drivers are useful for data conversions .

## Process Management

In Multiuser operating systms many users might execute same or different programs at the same time . But , the computer systems have only one CPU and it can execute only one instruction at a time . Thus , the instructions need to be scheduled and tracked . This is called as Process Management .

The system calls under process management are : ready a process , resume a process , suspend a process , block a process , change the priority of a process , terminate a process , delay a process , generate a process , fork a process .

## Memory Management

When a program is being executed , the OS allocates memory space to it . But the OS should know how much free space is available and how much memory is needed for the task .

For this , the OS keeps a list of free memory locations . Before starting the execution of the program , the OS checks the list and allocates space to the program . This is called as Memory Management .

The system calls under memory management are : to allocate a chunk of memory to a process , to free chunk of memory from a process .

## Graphical User Interface (GUI)

In Graphical User Interface , the commands are replaced by graphical representations , so that the user need not know the keywords and can use the program easily .

## Worms and Virus

**Worms :** A computr worm is a computer program , which spreads to other computers over the network . While spreading , it consumes network resources to a large extent . A computer worm can potentially bring the entire network to a standstill .

A Computer Worm generally does not harm other programs or data . It consumes transmission capacity and disk storage . It may deny access to legitimate users . The worm spreads over a network . It gets address of other computers on the network through mailing list and sends a copy of itself to other computers .

A worm can be prevented by strong security and various check points on the communication system .

**Virus :** A computer Virus is a part of a program , which is written to infect other programs . It is not a complete program , but comes with installation of other programs . A virus can cause direct harm to the computer . It can corrupt code as well as data . The five types of viruses are : 1) Boot Sector Virus , 2) Memory Resident Virus , 3) File Specific Virus , 4) Command Processor Virus 5) General Purpose Virus .

The well known mthods of infection by virus are :

1. Append : The viral code appends itself to unaffected programs .
2. Replace : The viral code replaces itself with original program code .
3. Insert : The viral code is insrted in the body of orinal code , so that the program misbehaves .
4. Delete : The viral code deletes some code from original program ,
5. Redirect : The normal flow of a program is disrupted and the virus forces the user to be redirected to some other program or viral program .

**Detection** of Virus can be done by cchecking the integrity of binary files . THe program maintains a check of all these files , a mismaatch in it indicates virus . Some programs continuously monitor the memory locations to check for virus .

**Removal** of Virus is not easy because the bit pattern of virus may vary . If th bit pattern of virus is dtected then it can be removed .

**Prevention** of Virus can be done by buying only legal copies of software from reliable sources . Illegal and free softwares have higher risk of containing virus . Frequent back-ups and running of monitoring programs also help in detection and removal of virus .

## Windows 98 Overview

1. Windows 98 is a single user multi tasking operating system developed by Microsoft .
2. Windows 98 is easier to use . Navigating around the computer is easier .
3. A file , directory or a program can be opened with a singl click .
4. Windows 98 allows you to use multiple monitors with the same computer .
5. New hardware can be easily installed without having to restart the computer .
6. With Windows 98 , you can use cameras and other digital imaging devices .
7. Windows 98 can be easily integrated with Internet . Web pages can be viewed in any window . E-mail can be linked to application called Microsoft Outlook .
8. Windows 98 supports DVD and digital audio , thus users can play high definition digital movies and audio on computer .

## Windows NT Overview

1. Windows NT is a multi user , multi tasking and multi threading operating system developed by Microsoft .
2. A user can get faster response even though multiple programs are running .
3. Windows NT supports virtual memory management system ,
4. It is a 32 bit Operating system .
5. Windows NT provides New Technology File Systems , which implements fault toletance , security and has support for very large files .

## Linux Overview

1. Linux is a Free to Use operating system . It can be used , modified in any way .
2. It is a multiuser , operating system with a full set of unix compatible tools .
3. Linux has compatibility on a wide range of platforms .
4. It can run even on machines having 4 GB RAM .
5. It has standard interfaces for both the programmer and the user .
6. Linux supports a wide range of applications .
7. The file system in Linux obeys UNIX semantics .

The components of LINUX are Kernel , System Libraries and System utilities .

**Kernel :** Kernel maintains all important abstractions of the operating systems , such as processes and virtual memory .

**System Libraries :** System libraries define a standard set of functions through which applications can interact with the kernel , and which implements much of the OS functionality .

**System Utilities :** These are programs that performs individual , specialized management tasks . Some system utilities may be invoked just once to initialize and configure some aspects of systems .