operating systems unit-1
operating systems unit-1
OPERATING SYSTEMS
What is an Operating System?
Resource allocater – manages and allocates resources.
Control program – controls the execution of user programs and operations of
I/O devices .
1. Execute user programs:Execute user programs and make solving user problems
easier.
2.Easy to use computer: Make the computer system convenient to use.
Process Management
A process is a program in execution
In multi programming environment, OS decides which process gets the processor
when and how much time. This function is called process scheduling.
Operating System does the following activities for main memory management.
Keeps tracks of primary memory i.e. what part of it are in use by
whom,what part are not in use.
Allocates the memory when the process requests it to do so.
De-allocates the memory when the process no longer needs it or has been
terminated.
Secondary-Storage Management
Main memory (primary storage) is volatile and too small to accommodate all data and
programs permanently, the computer system must provide secondary storage to back
up main memory.Most modern computer systems use disks as the principle on-line
storage medium, for both programs and data.
File Management:
File means collection of related information.A file system is normally organized into
directories for easy navigation and usage. .These directories may contain files and
other directories.
Following are some of the important activities that Operating System does:
Security -- By means of password and similar other techniques, preventing
unauthorized access to programs and data.
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 Softwares and users -- Coordination and assignment
of compilers, interpreters, assemblers and other software to the various users of the
computer systems.
Types of an operating system
1.Batch Systems:
This type of OS accepts more than one jobs and these jobs are batched/
grouped together according to their similar requirements. This is done by
computer operator.
Whenever the computer becomes available, the batched jobs are sent for
execution and gradually the output is sent back to the user
It allowed only one program at a time.
This OS is responsible for scheduling the jobs according to priority and the
resource required
JOB1 Batch
Opera
ting
syste CPU
JOB2
m Batch
JOB2
Batch
1) Problem of reliability.
1. Program Execution:
The purpose of computer systems is to allow the user to execute
programs. So the operating system provides an environment where the user
can conveniently run programs. Running a program involves the allocating
and deallocating memory, CPU scheduling in case of multiprocessing.
Following are the major activities of an operating system with respect to program
management.
2. I/O Operations
Each program requires an input and produces output. This involves the use of I/O.
So the operating systems are providing I/O makes it convenient for the users to run
programs.
Following are the major activities of an operating system with respect to I/O
Operation.
I/O operation means read or write operation with any file or any specific I/O
device.
Operating system provides the access to the required I/O device when required.
3. File System Manipulation
A file represents a collection of related information. Computer can store files on the
disk (secondary storage), for long term storage purpose. Few examples of storage
media are magnetic tape, magnetic disk and optical disk drives like CD, DVD. Each
of these media has its own properties like speed, capacity, data transfer rate and data
access methods.
A file system is normally organized into directories for easy navigation and usage.
These directories may contain files and other directions. Following are the major
activities of an operating system with respect to file management.
The Operating system gives the permission to the program for operation on
file.
4)Communication
In case of Distributed systems which are a collection of processors that do not share
memory, peripheral devices, or a clock, Operating system manages communications
between processes. Multiple processes with one another through communication lines
in the network.
OS handles routing and connection strategies, and the problems of contention and
security. Following are the major activities of an operating system with respect to
communication.
Both the processes can be on the same computer or on different computer but
are connected through computer network.
Communication may be implemented by two methods either by Shared
Memory or by Message Passing.
5)Error Detection
Error can occur anytime and anywhere. Error may occur in CPU, in I/O devices or in
the memory hardware. Following are the major activities of an operating system with
respect to error handling.
6)Resource allocator
Following are the major activities of an operating system with respect to resource
management.
7)Accounting
The operating systems keep track of which users use how many and
which kinds of computer resources. This record keeping may be used for
accounting (so that users can be billed) or simply for accumulating usage
statistics.
OS ensures that external I/O devices are protected from invalid access
attempts.
System Call:
System calls provide an interface between the process and the operating
system.
System calls allow user-level processes to request some services from the
operating system which process itself is not allowed to do.
For example, for I/O a process involves a system call telling the operating
system to read or write particular area and this request is satisfied by the
operating system.
System calls occur in different ways depending on the computer in use.Each system
call will send additional information to the operating system in the form of
parameters.
Three general methods used to pass parameters to the OS
1. Pass the parameters in registers.
2. Parameters stored in a block:In some cases may be more parameters than
registers,parameters are placed in a block/table in in memory, and address of block
passed as a parameter in a register. This approach taken by Linux and Solaris.
3. Parameters pushed onto the stack by the program and popped off the stack by the
operating system.
Following different types of system calls provided by an operating system:
Process control
end, abort
load, execut
create process, terminate process
get process attributes, set process attributes
wait for time
wait event, signal event
allocate and free memory
File management
create file, delete file
open, close
read, write, reposition
get file attributes, set file attributes
Device management
request device, release device
read, write, reposition
get device attributes, set device attributes
logically attach or detach devices
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
Communications
create, delete communication connection
send, receive messages
transfer status information
attach or detach remote devices
System calls in UNIX/Windows
1. Simple Structure :
The kernel
Provides the file system, CPU scheduling, memory management, and other
operating-system functions; a large number of functions for one level
2. Layered Approach
The operating system is divided into a number of layers (levels), each built on
top of lower layers. The bottom layer (layer 0), is the hardware; the highest
(layer N) is the user interface.
With modularity, layers are selected such that each uses functions (operations)
and services of only lower-level layers
Layered Operating System
messages messages
microkernel
hardware
More secure
Detriments:
4. Module Structure
What CPU will be used? What options (extended instruction sets, floating
point arithmetic, and so on) are installed? For multiple-CPU systems, each CPU
must be described.
How much memory is available? Some systems will determine this value
themselves by referencing memory location after memory location until an
"illegal address" fault is generated. This procedure defines the final legal
address and hence the amount of available memory.
What devices are available? The system will need to know how to address
each device (the device number), the device interrupt number, the device's type
and model, and any special device characteristics.
What operating-system options are desired, or what parameter values are
to be used? These options or values might include how many buffers of which
sizes should be used, what type of CPU-scheduling algorithm is desired, what
the maximum number of processes to be supported is.
Generations of Operating Systems:
The changes that we can see in the operating system from its beginning to now
are divided into four major generations. Let us see the four generations of
operating systems in detail one by one and understand them in a better way.
The first generation of the operating system is described between the years 1945
to 1955. This was the time of the Second World War. Even digital computers
were not built till then. For calculation purposes, people use a machine
called calculating engines that are constructed using mechanical relays. These
mechanical relays work very slowly and for that reason, the mechanical relays
were replaced with vacuum tubes with the passing of time. These are slow
machines. All the tasks related to these machines like designing, building, and
maintaining were managed by a single group of people.
At that time, the concept of programming language was totally unknown and no
operating system was there present at that time. So, all the programming and
calculations were done using machine language. After that punch cards were
introduced in 1950. Now, the programs are written on these punch cards and
inserted into the system where the system reads the cards. These punch cards
improved the performance of the computer system.
The operating system of these periods makes the transition between jobs smooth.
This operating system was the starting of the batch processing system in which
jobs are gathered together and executed in a sequence. When one job was
running, total control of the machine was at that job only. Other jobs are then
held in waiting until the running job gets totally executed. After that, the other
job starts to run.
The Second Generation ( 1955 - 1965 ): Transistors and
Batch Systems
The second generation of operating systems, let to face the development of the
shared system with multiprogramming and the beginning of
multiprocessing. Multiprogramming is defined as the system in which many user
programs are stored in the main storage at once and switching between the jobs is
done by the processor. In multiprogramming, the power of a machine is increased
by using many processors in a single machine. In this generation, real-time
systems are emerged to get a quick and real-time response where computers are
used to control the working and functionality of industries like oil refineries, coal
factories, etc.
Also, these generation operating systems are used in military operations to keep
an eye on enemies and predict any kind of attack from the enemies because this
operating system works in real-time and real-time data can be accessed and
processed. Transistors were invented during this time which leads to the
invention of computer systems that were called Main-frame. These mainframes
were stored in big air-conditioned rooms and staff were deputed to operate them.
The batch system leads to improvement in the job execution time. Now,
computers were fast from an early time. The jobs were gathered in a tray and
then they were stored in a room called the Input room.
A magnetic tape is used to read the input. Then these magnetic tapes were placed
on a tape driver and a batch operating system was loaded. The first job was read
from the drive and running the job was the work of this batch operating system.
And then the output of that is written on the second tape. When all the batch gets
executed, the input tape and the output tape are removed and the tape that
contains the output was printed.Two types of computer systems were invented
during this time ( 1965-1980 ), these are a scientific calculator and a commercial
calculator. Both these systems were combined in the system/360 by a company
named IBM. Integrated circuits become in use in computer systems these times.
The use of integrated circuits increased the performance of systems many times
as compared to the second-generation systems. The price of systems also
decreased due to the use of integrated circuits as making integrated circuits on
large scale requires a setup that costs high but can be produced the circuits in
very large numbers costs cheaper, from that setup.
Third-generation operating systems were also introduced by multiprogramming.
It means when there is one job that is under process, there is no need to wait in
queue for other jobs to get executed. Other jobs also get scheduled in the
processor which ensures that there should no waste of time for the processor.