UNIT-1 Operating System - Concepts:: Definition
UNIT-1 Operating System - Concepts:: Definition
Definition: An operating system is a program that acts as an interface between the user and the computer
hardware and controls the execution of all kinds of programs.
Memory Management
Processor Management
Device Management
File Management
Security
Control over system performance
Job accounting
1
Error detecting aids
Coordination between other software and users
Memory Management: Memory management refers to management of Primary Memory or Main Memory.
Main memory is a large array of words or bytes where each word or byte has its own address.
Main memory provides a fast storage that can be accessed directly by the CPU. For a program to be
executed, it must in the main memory. An Operating System does the following activities for memory
management −
Keeps tracks of primary memory, i.e., what part of it are in use by whom, what part is not in use?
In multiprogramming, the OS decides which process will get memory when and how much.
Allocates the memory when a process requests it to do so.
De-allocates the memory when a process no longer needs it or has been terminated.
Processor Management: In multiprogramming environment, the OS decides which process gets the processor
when and for how much time. This function is called process scheduling. An Operating System does the
following activities for processor management −
Keeps tracks of processor and status of process. The program responsible for this task is known
as traffic controller.
Allocates the processor (CPU) to a process.
De-allocates processor when a process is no longer required.
Device Management: An Operating System manages device communication via their respective drivers. It does
the following activities for device management −
Keeps tracks of all devices. Program responsible for this task is known as the I/O controller.
Decides which process gets the device when and for how much time.
Allocates the device in the efficient way.
De-allocates devices.
File Management: A file system is normally organized into directories for easy navigation and usage. These
directories may contain files and other directions.
An Operating System does the following activities for file management −
Keeps track of information, location, uses, status etc. The collective facilities are often known as file
system.
Decides who gets the resources.
Allocates the resources.
De-allocates the resources.
Other Important Activities: Following are some of the important activities that an Operating System performs −
Security − By means of password and similar other techniques, it prevents unauthorized access to
programs and data.
2
Control over system performance − Recording delays between request for a service and response
from the system.
Job accounting − Keeping track of time and resources used by various jobs and users.
Error detecting aids − Production of dumps, traces, error messages, and other debugging and error
detecting aids.
Coordination between other software’s and users − Coordination and assignment of compilers,
interpreters, assemblers and other software to the various users of the computer systems.
Types of Operating System: Operating systems are there from the very first computer generation and they
keep evolving with time. In this chapter, we will discuss some of the important types of operating systems
which are most commonly used.
1. Batch operating system: The users of a batch operating system do not interact with the computer
directly. Each user prepares his job on an off-line device like punch cards and submits it to the
computer operator. To speed up processing, jobs with similar needs are batched together and run as a
group. The programmers leave their programs with the operator and the operator then sorts the
programs with similar requirements into batches.
3
2. Time-sharing operating systems: Time-sharing is a technique which enables many people, located at
various terminals, to use a particular computer system at the same time. Time-sharing or multitasking
is a logical extension of multiprogramming. Processor's time which is shared among multiple users
simultaneously is termed as time-sharing.
The main difference between Multiprogrammed Batch Systems and Time-Sharing Systems is
that in case of multiprogrammed batch systems, the objective is to maximize processor use, whereas
in Time-Sharing Systems, the objective is to minimize response time.
Multiple jobs are executed by the CPU by switching between them, but the switches occur so
frequently. Thus, the user can receive an immediate response. For example, in a transaction
processing, the processor executes each user program in a short burst or quantum of computation.
That is, if n users are present, then each user can get a time quantum. When the user submits the
command, the response time is in few seconds at most.
The operating system uses CPU scheduling and multiprogramming to provide each user with a
small portion of a time. Computer systems that were designed primarily as batch systems have been
modified to time-sharing systems.
Problem of reliability
Question of security and integrity of user programs and data.
Problem of data communication.
4
Distributed Operating System runs on multiple, independent CPU’s. Distributed systems use multiple
central processors to serve multiple real-time applications and multiple users. Data processing jobs are
distributed among the processors accordingly.
The processors communicate with one another through various communication lines (such as
high-speed buses or telephone lines). These are referred as loosely coupled systems or distributed
systems where each processor has its own local memory and processors communicate with one
another through various communication lines, such as high speed buses or telephone lines.
With resource sharing facility, a user at one site may be able to use the resources available at
another.
Speedup the exchange of data with one another via electronic mail.
If one site fails in a distributed system, the remaining sites can potentially continue operating.
Better service to the customers.
Reduction of the load on the host computer.
Reduction of delays in data processing.
4. Network operating System: An operating system that provides the connectivity among a number of
autonomous computers is called a network operating system. A typical configuration for a network
operating system is a collection of personal computers along with a common printer, server and file
server for archival storage, all tied together by a local network.
Mainly there are two types of network operating systems named as peer-to-peer and client / server.
Peer-to-peer network operating systems allow users to share resources and files located on
their computers and to access shared resources found on other computers. In a peer-to-peer network,
5
all computers are considered equal; they all have the same privileges to use the resources available on
the network. Peer-to-peer networks are designed primarily for small to medium local area networks.
Windows for Workgroups is an example of the program that can function as peer-to-peer network
operating systems.
Examples of network operating systems include Microsoft Windows Server 2003, Microsoft
Windows Server 2008, UNIX, Linux, Mac OS X, Novell NetWare, and BSD.
The advantages of network operating systems are as follows −
Operating System Services: The following are different types of services provided by Operating
System.
User interface: Almost all operating systems have a user interface (UI). This interface can take
several forms. One is a command-line interface (CLI), which uses text commands and a method for
entering them. Another is a batch interface, in which commands and directives to control those
commands are entered into files, and those files are executed. Most commonly a graphical user
interface (GUI) is used. Here, the interface is a window system with a pointing device to direct I/O,
choose from menus, and make selections and a keyboard to enter text.
Program execution: The system must be able to load a program into memory and to run that
program. The program must be able to end its execution, either normally or abnormally (indicating
error).
I/O operations: A running program may require I/O device. For specific devices, special functions
may be desired (such as recording to a CD or DVD drive). For efficiency and protection, users usually
cannot control I/O devices directly. Therefore, the operating system must provide a means to do I/O.
File-system manipulation: Operating System is used to control operations on files like creating,
opening, reading, and writing.
Communications: There are many cases in which one process needs to exchange information with
another process. Such communication may occur between processes that are executing on the same
computer or between processes that are executing on different computer systems tied together by a
computer network. Communications may be implemented via shared memory or through message
passing, in which packets of information are moved between processes by the operating system.
7
Error detection. The operating system needs to be constantly aware of possible errors. Errors may
occur in the CPU and memor, in I/O devices, and in the user program. For each type of error, the
operating system should take the appropriate action to ensure correct and consistent computing.
Resource allocation. When there are multiple users or multiple jobs running at the same time,
resources must be allocated to each of them.
Accounting: Accounting keep track of which users use how much and what kinds of computer
resources. This record keeping may be used for accounting (so that users can be billed) or simply for
accumulating usage statistics.
Protection and security. The owners of information stored in a multiuser or networked computer
system may want to control use of that information. When several separate processes execute
concurrently, it should not be possible for one process to interfere with the others or with the operating
system itself. Protection involves ensuring that all access to system resources is controlled. Security of
the system from outsiders is also important. Such security starts with requiring each user to
authenticate himself or herself to the system, usually by means of a password, to gain access to system
resources.
Introduction to System Calls: In computing, a system call is the programmatic way in which a
computer program requests a service from the kernel of the operating system it is executed on. A system call
is a way for programs to interact with the operating system. A computer program makes a system call when
it makes a request to the operating system’s kernel. System call provides the services of the operating system
to the user programs via Application Program Interface (API). It provides an interface between a process and
operating system to allow user-level processes to request services of the operating system. System calls are
the only entry points into the kernel system. All programs needing resources must use system calls.
8
Types of System Calls: There are 5 different types of system calls.
1. Process Control:
fork ( ) : This system call is used to create a new process, which is called as child process.
wait ( ): A call to wait() blocks the calling process until one of its child processes exits or a
signal is received.
exit ( ): This system call terminates a process normally.
2. File Manipulation:
open ( ): This is used for creating and opening a file.
read ( ): This is used to read content from specified file descriptor.
write ( ): This is used to wrote content to specified file descriptor.
close ( ): This is used to close opened file descriptors.
3. Device Manipulation:
iocntl ( ): This system call is used to control specified I/O device.
read ( ): This system call is used to read data from specified device.
write ( ): This system call is used to write data to specified device.
4. Communications:
pipe ( ) : This system call sends output of one command as input of another command.
shmget ( ): This system call is used to create a shared memory.
shmat ( ): This system call is used to access shared memory.
5. Protection and Security :
chmod ( ): This system call is used to change file access permissions.
chown ( ): This system call is used to change ownership of a file.
umask ( ): This system call is used to change default umask value.
QUESTIONS
10