13
An Operating system is basically a intermediary agent between the user and the computer hardware. Manages the computer’s resources (hardware, abstract resources, software) It’s a resource allocator. It is also used to control programs to prevent errors and improper computer use. It is interrupt driven. Definition An operating system is a group of computer programs that coordinates all the activities among computer hardware devices. It is the first program

Os by nishant raghav

Embed Size (px)

Citation preview

Page 1: Os by nishant raghav

An Operating system is basically a intermediary agent between the user and the computer hardware.

Manages the computer’s resources (hardware, abstract resources, software)

It’s a resource allocator. It is also used to control programs to prevent errors and improper

computer use. It is interrupt driven.

Definition An operating system is a group of computer programs that coordinates all the

activities among computer hardware devices. It is the first program loaded into the computer by a boot program and remains in memory at all times.

Page 2: Os by nishant raghav

Figure- Diagrammatical Definition Of Os

Operating System Benefits

Simplifies hardware control for applications

Enforcer of sharing, fairness and security with the goal of better overall performanceo Trade-off between fairness and performance

o Trade-off between optimal algorithms and lean algorithms – OS is

overhead.

Provides abstract resourceso Sockets

o Inter-process communication

Functions of an operating system

The basic functions of an operating system are:

i. Booting the computerii. Performs basic computer tasks Example managing the various peripheral devices eg

mouse, keyboardiii. Provides a user interface, e.g. command line, graphical user interface (GUI)iv. Handles system resources such as computer's memory and sharing of the

central processing unit (CPU) time by various applications or peripheral devices

Page 3: Os by nishant raghav

v. Provides file management which refers to the way that the operating system manipulates, stores, retrieves and saves data.

Booting the computer

The process of starting or restarting the computer is known as booting. A cold boot is when you turn on a computer that has been turned off completely. A warm boot is the process of using the operating system to restart the computer.

Performs basic computer tasks

The operating system performs basic computer tasks, such as managing the various peripheral devices such as the mouse, keyboard and printers. For example, most operating systems now are plug and play which means a device such as a printer will automatically be detected and configured without any user intervention.

Provides a user interface

A user interacts with software through the user interface. The two main types of user interfaces are: command line and a graphical user interface (GUI). With a command line interface, the user interacts with the operating system by typing commands to perform specific tasks. An example of a command line interface is DOS (disk operating system). With a graphical user interface, the user interacts with the operating system by using a mouse to access windows, icons, and menus. An example of a graphical user interface is Windows Vista or Windows 7. The operating system is responsible for providing a consistent application program interface (API) which is important as it allows a software developer to write an application on one computer and know that it will run on another computer of the same type even if the amount of memory or amount of storage is different on the two machines.

Handles system resources

The operating system also handles system resources such as the computer's memory and sharing of the central processing unit (CPU) time by various applications or peripheral devices. Programs and input methods are constantly competing for the attention of the CPU and demand memory, storage and input/output bandwidth. The operating system ensures that each application gets the necessary resources it needs in order to maximise the functionality of the overall system.

Provides file management

The operating system also handles the organisation and tracking of files and directories (folders) saved or retrieved from a computer disk. The file management system allows the user to perform such tasks as creating files and directories, renaming files, coping and moving files, and deleting files. The operating system keeps track of where files are located on the hard drive through the type of file system. The type two main types of file system are File Allocation table (FAT) or New Technology File system (NTFS).

Types of file system

File Allocation table (FAT) New Technology file system (NTFS)

File Allocation table (FAT) uses the file allocation table which records, which clusters are used and unused and where files are located within the clusters.

Page 4: Os by nishant raghav

NTFS is a file system introduced by Microsoft and it has a number of advantages over the previous file system, named FAT32 (File Allocation Table).

One major advantage of NTFS is that it includes features to improve reliablity. For example, the new technology file system includes fault tolerance, which automatically repairs hard drive errors without displaying error messages. It also keeps detailed transaction logs, which tracks hard drive errors. This can help prevent hard disk failures and makes it possible to recover files if the hard drive does fail.

NTFS also allows permissions (such as read, write, and execute) to be set for individual directories and files.

Operating System – Properties

Following are few of very important tasks that Operating System handles

Batch processingBatch processing is a technique in which Operating System collects one programs and data together in a batch before processing starts. Operating system does the following activities related to batch processing.

OS defines a job which has predefined sequence of commands, programs and data as a single unit. OS keeps a number a jobs in memory and executes them without any manual information. Jobs are processed in the order of submission i.e first come first served fashion. When job completes its execution, its memory is released and the output for the job gets copied into an output

spool for later printing or processing.

ADVANTAGES Batch processing takes much of the work of the operator to the computer. Increased performance as a new job get started as soon as the previous job finished without any manual intervention.

DISADVANTAGES

Difficult to debug program. A job could enter an infinite loop. Due to lack of protection scheme, one batch job can affect pending jobs.

Page 5: Os by nishant raghav

MultitaskingMultitasking refers to term where multiple jobs are executed by the CPU simultaneously by switching between them. Switches occur so frequently that the users may interact with each program while it is running. Operating system does the following activities related to multitasking.

The user gives instructions to the operating system or to a program directly, and receives an immediate response.

Operating System handles multitasking in the way that it can handle multiple operations / executes multiple programs at a time.

Multitasking Operating Systems are also known as Time-sharing systems. These Operating Systems were developed to provide interactive use of a computer system at a reasonable cost. A time-shared operating system uses concept of CPU scheduling and multiprogramming to provide each user

with a small portion of a time-shared CPU. Each user has at least one separate program in memory.

A program that is loaded into memory and is executing is commonly referred to as a process. When a process executes, it typically executes for only a very short time before it either finishes or needs to

perform I/O. Since interactive I/O typically runs at people speeds, it may take a long time to completed. During this time a

CPU can be utilized by another process. Operating system allows the users to share the computer simultaneously. Since each action or command in a

time-shared system tends to be short, only a little CPU time is needed for each user. As the system switches CPU rapidly from one user/program to the next, each user is given the impression that

he/she has his/her own CPU, whereas actually one CPU is being shared among many users.

MultiprogrammingWhen two or more programs are residing in memory at the same time, then sharing the processor is referred to the multiprogramming. Multiprogramming assumes a single shared processor. Multiprogramming increases CPU utilization by organizing jobs so that the CPU always has one to execute.

Following figure shows the memory layout for a multiprogramming system.

Page 6: Os by nishant raghav

Operating system does the following activities related to multiprogramming.

The operating system keeps several jobs in memory at a time. This set of jobs is a subset of the jobs kept in the job pool. The operating system picks and begins to execute one of the job in the memory. Multiprogramming operating system monitors the state of all active programs and system resources using

memory management programs to ensures that the CPU is never idle unless there are no jobs

ADVANTAGES

High and efficient CPU utilization. User feels that many programs are allotted CPU almost simultaneously.

DISADVANTAGES

CPU scheduling is required. To accommodate many jobs in memory, memory management is required.

SpoolingSpooling is an acronym for simultaneous peripheral operations on line. Spooling refers to putting data of various I/O jobs in a buffer. This buffer is a special area in memory or hard disk which is accessible to I/O devices. Operating system does the following activities related to distributed environment.

OS handles I/O device data spooling as devices have different data access rates. OS maintains the spooling buffer which provides a waiting station where data can rest while the slower device

catches up. OS maintains parallel computation because of spooling process as a computer can perform I/O in parallel fashin.

It becomes possible to have the computer read data from a tape, write data to disk and to write out to a tape printer while it is doing its computing task.

Page 7: Os by nishant raghav

ADVANTAGES

The spooling operation uses a disk as a very large buffer. Spooling is capable of overlapping I/O operation for one job with processor operations for another job.

Real Time SystemReal time systems represents are usually dedicated, embedded systems. Operating system does the following activities related to real time system activity.

In such systems, Operating Systems typically read from and react to sensor data. The Operating system must guarantee response to events within fixed periods of time to ensure correct

performance.

Distributed EnvironmentDistributed environment refers to multiple independent CPUs or processors in a computer system. Operating system does the following activities related to distributed environment.

OS Distributes computation logics among several physical processors. The processors do not share memory or a clock. Instead, each processor has its own local memory. OS manages the communications between the processors. They communicate with each other through various

communication lines.

Personal Computers

Page 8: Os by nishant raghav

A personal computer is a general-purpose computer whose size, capabilities and original sale price make it useful for individuals, and is intended to be operated directly by an end-user with no intervening computer operator. This contrasts with the batch processing or time-sharing models that allowed larger, more expensive minicomputer and mainframe systems to be used by many people, usually at the same time. A related term is "PC" that was initially an acronym for "personal computer", but later became used primarily to refer to the ubiquitous Wintel platform.

Parallel System

Parallel operating systems are used to interface multiple networked computers to complete tasks in parallel. The architecture of the software is often a UNIX-based platform, which allows it to coordinate distributed loads between multiple computers in a network. Parallel operating systems

Page 9: Os by nishant raghav

are able to use software to manage all of the different resources of the computers running in parallel, such as memory, caches, storage space, and processing power. Parallel operating systems also allow a user to directly interface with all of the computers in the network.

A parallel operating system works by dividing sets of calculations into smaller parts and distributing them between the machines on a network. To facilitate communication between the processor cores and memory arrays, routing software has to either share its memory by assigning the same address space to all of the networked computers, or distribute its memory by assigning a different address space to each processing core. Sharing memory allows the operating system to run very quickly, but it is usually not as powerful. When using distributed shared memory, processors have access to both their own local memory and the memory of other processors; this distribution may slow the operating system, but it is often more flexible and efficient.

Process Concepts

Process -- The fundamental concept of multiprogramming operating systems. A process is

An abstraction representing a program executing on a CPU

Page 10: Os by nishant raghav

An abstraction representing a virtual CPU executing a program

Processes run concurrently. (This can be accomplished with true concurrency on a computer with more than one CPU, or by rapid switching among processes on a single-CPU computer.)

Processes compete with each other for CPU time and other resources.

Process states

A convenient way to model the changes that a process undergoes during its lifetime is through the state of a process. A process is always in one of a finite set of states.

Running -- executing instructions on a CPU.

Ready -- waiting for CPU time; otherwise able to run

Blocked -- waiting for some event to occur; e.g. I/O completion, resource availability

Threads-

A thread is a basic unit of CPU utilization, consisting of a program counter, a stack, and a set of registers, ( and a thread ID. )

Page 11: Os by nishant raghav

Traditional ( heavyweight ) processes have a single thread of control - There is one program counter, and one sequence of instructions that can be carried out at any given time.

As shown in Figure 4.1, multi-threaded applications have multiple threads within a single process, each having their own program counter, stack and set of registers, but sharing common code, data, and certain structures such as open files.