01-Operating System Unit-I - Introduction
01-Operating System Unit-I - Introduction
UNIT I INTRODUCTION
Computer System - Elements and organization; Operating System Overview - Objectives and Functions -
Evolution of Operating System; Operating System Structures – Operating System Services - User
Operating System Interface - System Calls – System Programs - Design and Implementation - Structuring
methods.
COMPUTER SYSTEM
Definition: Is a collection of entities (hardware, software and liveware) that are designed to receive,
process, manage and present information in a meaningful format.
Computer Hardware
Hardware refers to the physical, tangible computer equipment and devices, which provide support for major
functions such as input, processing (internal storage, computation and control), output, secondary storage
(for data and programs), and communication.
Input Devices
Are devices used for entering data or instructions to the central processing unit. Are classifie according to
the method they use to enter data.
A) Keying Devices
Are devices used to enter data into the computer using a set of Keys eg Keyboard, key-to- storage and
keypad.
B) Pointing Devices
Are devices that enter data and instructions into the computer using a pointer that appears on the screen. The
items to be entered are selected by either pointing to or clicking on them.e.g mice, joystick, touch sensitive
screen, trackballs
C) Scanning Devices
Are devices that capture an object or a document directly from the source. They are classifie according to
the technology used to capture data e.g. Scanners and Document readers.
1
UNIT - I INTRODUCTION
The system unit is the core of a computer system. Usually it's a rectangular box placed on or underneath
your desk. Inside this box are many electronic components that process data. The most important of these
components is the central processing unit (CPU), or microprocessor, which acts as the "brain" of your
computer. Another component is random access memory (RAM), which temporarily stores information that
the CPU uses while the computer is on. The information stored in RAM is erased when the computer is
turned off.
Almost every other part of your computer connects to the system unit using cables. The cables plug into
specific ports (openings), typically on the back of the system unit. Hardware that is not part of the system
unit is sometimes called a peripheral device. Peripheral devices can be external such as a mouse, keyboard,
printer, monitor, external Zip drive or scanner or internal, such as a CD-ROM drive, CD-R drive or internal
modem. Internal peripheral devices are often referred to as integrated peripherals. There are two types
according to shape: tower and desktop.
2
UNIT - I INTRODUCTION
Software:
A set of programs that form an interface between the hardware and the user of a computer system are
referred to as Software. They are of six types:
(a) System software:
A set of programs to control the internal operations such as reading data from input devices, giving results
to output devices and ensuring proper functioning of components is called system software.
(b) Application software:
Programs designed by the user to perform a specific function, such as accounting software, payroll software
etc.
(c) Operating system:
A set of tools and programs to manage the overall working of a computer using a defined set of hardware
components is called an operating system. It is the interface between the user and the computer system.
(d) Utility software:
Certain special purpose programs that are designed to perform a specialized task, such as functions to copy,
cut or paste files in a computer, formatting a disk etc.
(e) Language processors:
Special software to accept data and interpret it in the form of Machine /Assembly language understandable
by a computer. It also ensures the correctness of language syntax and errors
(f) Connectivity software:
A set of programs and instructions to connect the computer with the main server to enable sharing of
resources and information with the server and other connected computers.
Output Unit:
It controls various output devices like printer, graphic plotter, speech synthesizer, monitor (also known as
Visual Display Unit or VDU) to produce the desired output and present it to the user. It ensures the
convertibility of output into human readable form that is understandable by the user.
3
UNIT - I INTRODUCTION
Processor Management: In multi-programming 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: OS keeps tracks of processor and status of process.
OS allocates the processor (CPU) to a process. It 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. The program responsible
for this task is known as the I/O controller. Decides which process gets the device when and for how much
time. OS allocates the device in the most efficient way. It de-allocates devices in most efficient way.
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. OS Decides who gets the resources. It allocates the resources and also de-
allocates the resources when not in need.
Security: OS prevents unauthorized access to programs and data. For shared or public systems, the OS
controls access to the system as a whole and to specific system resources.
Control over system performance: OS will collect usage statistics for various resources and monitor
performance parameters such as response time, Recording delays between request for a service and
response from the system.
Job accounting: OS Keeps track of time and resources used by various jobs and users. On any system, this
information is useful in anticipating the need for future enhancements and in tuning the system to improve
performance and can be used for job accounting purposes.
Error detection & Response: A variety of errors can occur while a computer system is running. These
include internal and external hardware errors, such as a memory error, or a device failure or malfunction;
and various software errors. In each case, the OS must provide a response that clears the error condition
with the least impact on running applications. The response may range from ending the program that
caused the error, to retrying the operation, to simply reporting the error to the application, Production of
dumps, traces, error messages, and other debugging and error detecting aids.
4
UNIT - I INTRODUCTION
Booting the computer: Booting is the process of starting or restarting the computer. If computer is
switched off completely and then turned on then it is cold booting. If computer is restarted then it is warm
booting. Booting of the computer is done by OS.
Coordination between other software and users: An OS enables coordination of hardware components,
coordination and assignment of compilers, interpreters, assemblers and other software to the various users
of the computer systems.
5
UNIT - I INTRODUCTION
The evolution of operating systems based on the feature (how features got developed over the years).
Serial Processing
Before the 1950s, there was no operating system, and users used to give programs to the computer system
itself. So, less speed and more errors were generated (as serial processing is done on a single machine). So,
the developers or the programmers had to provide the entire program in the form of sequential instruction
in the form of a punched card. These punched cards were first translated into a card reader and then it was
submitted to the operating system.
Due to this extensive process of execution of a simple program and human intervention, the overall
execution time was very large and inefficient. There were various other problems such as no user
interaction, execution of only one process at a time, very less memory, no error handling, etc. Now, a red
light was used to detect the error in the program execution. So, if there was any error, the error got detected
due to red blinking lights.
Batch Processing
In today's world, we can see that a user of the computer directly interacts with the computer. But in the past
years (1955 - 1965), the users were not able to directly interact with the computer system.
In earlier times, we used a type of operating system termed a batch operating system in which the user(s)
used to prepare their instructions (tasks or jobs) in the form of jobs on an off-line device like punch cards
and submits them to the computer operator. Now, out of these punch cards, similar punch cards of jobs
were grouped and run as a group to speed up the entire process.
Note: The Jobs consisted of program and input data along with the control instructions.
The main task of the programmer or developer was to create jobs or programs and then hand them over to
the operator in the form of punch cards. Now, it was the duty of an operator to sort the programs with
similar requirements into batches. Due to this dual procedure and manual intervention, the batch operating
system was a slow operating system. The most common use input and output devices were card-reader or
tape drives.
The Batch operating system was used to schedule similar jobs in one batch, so the same jobs in the batch
were executed at a higher speed. As the jobs were scheduled one after the other, whenever a job gets
completed, the next job from the job spool gets executed without any user interaction. The batch operating
system also eliminates the setup time issue.
6
UNIT - I INTRODUCTION
Since the batch operating system was very simple, it always resided in the memory and its major task was
to transfer control from one job to another job.
There major drawbacks of the batch operating system were:
We could not set the priority of the jobs as jobs were scheduled only based on similarities.
The CPU was not utilized to its maximum potential as the CPU becomes idle when the operator was
loading jobs.
Multiprogramming
In the multiprogramming operating system, several jobs or processes can be loaded into the main memory
simultaneously with the help of a single processor (a single processing unit was there and programs were
scheduled on a certain basis). Now, it was the duty of a subpart of the operating system called job scheduler
to schedule these processes in such a way that maximum processes can be executed in minimum time. So,
better CPU and memory utilization along with the execution of several processes at a time was the main
aim of the multiprogramming operating system.
The benefits of a multiprogramming operating system are:
Multiple processes can be loaded into the main memory.
The multiprogramming operating system was able to use both primary and secondary memory.
Users can interact with the processes through input and output devices.
There was no sequential process execution hence the later processes need not wait for a large amount
of time.
The CPU was better utilized. If there is any process that waits for an I/O, then the CPU will change
the job and takes another job from the job pool so that the CPU will never sit idle.
7
UNIT - I INTRODUCTION
Time-sharing System
In the time-sharing operating system, several jobs or processes can be loaded into the main memory
simultaneously and several users can share the system as well. We can hence, say that the time-sharing
operating system was a logical extension of the multiprogramming operating system. The name time-
sharing was used because the processes used to share an equal amount of time specified by the operating
system developer.
The main aim of the time-sharing operating system was to reduce the overall process response time. The
CPU could execute several processes by providing an equal amount of time to each process, so the CPU
utilization became better than the multiprogramming operating system.
Note:
Response time is the total amount of time it takes to respond to a process. It should not be confused with
the execution time. The switching between several operating system processes was handled by an operating
system subprocess knew as the CPU scheduler.
8
UNIT - I INTRODUCTION
Simple Structure
It is the simplest Operating System Structure and is not well defined; It can only be used for small and
limited systems. In this structure, the interfaces and levels of functionality are well separated; hence
programs can access I/O routines which can cause unauthorized access to I/O routines.
9
UNIT - I INTRODUCTION
10
UNIT - I INTRODUCTION
Layered Approach
In this type of structure, OS is divided into layers or levels. The hardware is on the bottom layer (layer 0),
while the user interface is on the top layer (layer N). These layers are arranged in a hierarchical way in
which the top-level layers use the functionalities of their lower-level levels.
In this approach, functionalities of each layer are isolated, and abstraction is also available. In layered
structure, debugging is easier as it is a hierarchical model, so all lower-level layered is debugged, and then
the upper layer is checked. So all the lower layers are already checked, and the current layer is to be
checked only.
Micro-kernel
Micro-Kernel structure designs the Operating System by removing all non-essential components of the
kernel. These non-essential components of kernels are implemented as systems and user programs. Hence
these implemented systems are called as Micro-Kernels.
Each Micro-Kernel is made independently and is isolated from other Micro-Kernels. So this makes the
system more secure and reliable. If any Micro-Kernel fails, then the remaining operating System remains
untouched and works fine.
11
UNIT - I INTRODUCTION
12
UNIT - I INTRODUCTION
Program execution
To execute a program, several tasks need to be performed. Both the instructions and data must be loaded
into the main memory. In addition, input-output devices and files should be initialized, and other resources
must be prepared. The Operating structures handle these kinds of tasks. The user now no longer should fear
the reminiscence allocation or multitasking or anything.
Program Creation
The Operating system offers the structures and tools, including editors and debuggers, to help the
programmer create, modify, and debugging programs.
While working with computers, errors may occur quite often. Errors may occur in the:
Input/ Output devices: For example, connection failure in the network, lack of paper in the printer, etc.
User program: For example: attempt to access illegal memory locations, divide by zero, use too much
CPU time, etc.
Memory hardware: For example, Memory error, the memory becomes full, etc.
To handle these errors and other types of possible errors, the operating system takes appropriate action and
generates messages to ensure correct and consistent computing.
Accounting
An Operating device collects utilization records for numerous assets and tracks the overall performance
parameters and responsive time to enhance overall performance. These personal records are beneficial for
additional upgrades and tuning the device to enhance overall performance.
13
UNIT - I INTRODUCTION
For Example:
When a user downloads something from the internet, that program may contain malicious code that may
harm the already existing programs. The operating system ensures that proper checks are applied while
downloading such programs.
If one computer system is shared amongst a couple of users, then the various processes must be protected
from another intrusion. For this, the operating system provides various mechanisms that allow only those
processes to use resources that have gained proper authorization from the operating system. The
mechanism may include providing unique users ids and passwords to each user.
File management
Computers keep data and information on secondary storage devices like magnetic tape, magnetic disk,
optical disk, etc. Each storage media has its capabilities like speed, capacity, data transfer rate, and data
access methods.
For file management, the operating system must know the types of different files and the characteristics of
different storage devices. It has to offer the proportion and safety mechanism of documents additionally.
Communication
The operating system manages the exchange of data and programs among different computers connected
over a network. This communication is accomplished using message passing and shared memory.
14
UNIT - I INTRODUCTION
15
UNIT - I INTRODUCTION
Choice of interface
The interface that is used with the help of OS for a particular task and that task can be performed with
minimum possible time and the output is shown on the screen in that case we use the choice of interface.
The choice of interface means the OS checks the task and finds out which interface can be suitable for a
particular task. So that type of interface is called the choice of interface and this can be done with the help
of an OS.
SYSTEM CALLS
System calls provide the interface between a process and the operating system.
These calls are generally available as assembly-language instructions.
1. Process Control
end,abort
load, execute
Create process and terminate process
get process attributes and set process attributes.
wait for time, wait event, signal event
Allocate and free memory.
2. File Management
Create file, delete file
Open , close
Read, write, reposition
Get file attributes, set file attributes.
3. Device Management
Request device, release device.
Read, write, reposition
Get device attribtues, set device attributes
Logically attach or detach devices
4. Information maintenance
Get time or date, set time or date
Get system data, set system data
Get process, file, or device attributes
Set process, file or device attributes
16
UNIT - I INTRODUCTION
5. Communications
Create, delete communication connection
Send, receive messages
Transfer status information
Attach or detach remote devices
Two types of communication models
(a) Message passing model
(b) Shared memory model
SYSTEM PROGRAMS
System programs provide a convenient environment for program development and execution.
They can be divided into several categories:
1. File management:
These programs create, delete, copy, rename, print, dump, list and generally manipulate files and
directories.
2. Status information:
The status such as date, time, amount of available memory or diskspace, number of users or
similar status information.
3. File modification:
Several text editors may be available to create and modify the content of files stored on disk or tape.
4. Programming-language support:
Compilers, assemblers and interpreters for common programming languages are often provided to the
user with the operating system.
5. Program loading and execution:
The system may provide absolute loaders, relocatable loaders, linkage editors, and overlay loaders.
6. Communications:
These programs provide the mechanism for creating virtual connections among processes, users, and
different computer systems. (email, FTP, Remote log in)
7. Application programs:
Programs that are useful to solve common problems, or to perform common operations.
Eg. Web browsers, database systems.
17
UNIT - I INTRODUCTION
There are basically two types of goals while designing an operating system. These are −
User Goals
The operating system should be convenient, easy to use, reliable, safe and fast according to the users.
However, these specifications are not very useful as there is no set method to achieve these goals.
System Goals
The operating system should be easy to design, implement and maintain. These are specifications required
by those who create, maintain and operate the operating system. But there is not specific method to achieve
these goals as well.
A subtle difference between mechanism and policy is that mechanism shows how to do something and
policy shows what to do. Policies may change over time and this would lead to changes in mechanism. So,
it is better to have a general mechanism that would require few changes even when a policy change occurs.
For example - If the mechanism and policy are independent, then few changes are required in mechanism
if policy changes. If a policy favours I/O intensive processes over CPU intensive processes, then a policy
change to preference of CPU intensive processes will not change the mechanism.
18
UNIT - I INTRODUCTION
19
UNIT - I INTRODUCTION
20
UNIT - I INTRODUCTION
21
UNIT - I INTRODUCTION
22