Operating Systems
Operating Systems
Introduction
Operating system is a program,which act as an interface between user of a computer and computer
hardware.it provides an environment to run other programs also.it makes system convenient to use. It
also perform basis task like input and output management.i.e it helps in using hardware inefficient
manner.
1.Information Management
2.Process Management
3.Memory Management
1.Information Management
It refers to a set of services used for storing,retrieving,modifying or removing the information on various
devices. It manages the organization of information in terms of directories and
files,allocating,deallocating the sector to various files ensuring right people have access to information
and driving various devices.
Some of the system calls in this category are as follow:
1.Create a file
2.Create directory
3.Open a file
4.close a file
8.Create a link
2.Process Management
If operating system supports multiple user then services under this are very important.in this regard
operating system has to keep track of all the completing process(running program),schedule
them,dispatch them one after another.but user should feel that he has the full control of the cpu.
Ex:
2.Terminate a process
7.Dispatch a process
8.Suspend a process
9.Resume a process
10.Delay a process
11.Fork a process
3.Memory Management
The Services provided under memory management are directed to keeping track of memory and
allocating,deallocating it to various process.the operating system keeps a list of free memory locations.
Before a program is loaded in memory from the disk, this module consults this free list,allocates the
memory to the process,depending upon program size and updates the list of free memory.
Overview of O/S
Operating system first developed by Microsoft was DOS.but it was a single user o/s.After DOS a
complete new system with graphical user interface was developed. It was window 3.1 later on window
95 an upgraded version of window was launched. After that window 98 a new version of window was
launced. If is multitasking and again GUI based o/s.Some of the main feature are:
2.Easy to use.
Web integration
Power management
4.Help
Windows NT
Object manager: It creates manages and deletes objects, which are processes.
Virtual memory manager: it manages the memory for processes.it also allocates and free memory
Security references monitor: it enforce security policy and keeps treack of file access right basd on
ownership and permission for the user.
Local procedures call facility: it is used to pass messages between client systems and subsystem on one
system.
I/O subsystem: It handles devices and passes data to and receives data from the devices of all
subsystem.
Linux
2.Linux is a multi-user
3.Linux is open
4.Linux is free
File system
Block
It is unit of data,which the operating system defines for the sake of
convenience.normally operating system also keeps all its data structure in
terms of blocks.
Operating system would view the disk as compairing of no.blocks.From
hardware point of view a disk consists of no. of sectors,but from the point of
view of the operating system it consists of no blocks where each block is
having one or more sectors. Due to this operating system has to translate a
block number into physical sector number.
Disk
It is main secondary device.various types of secondary devices are there like
floopy disk and hard disk. Hard disk can be considered as being made up
multiple floopy disks put one above the other.
Floppy disk
Hard disk
File
A collection of related information is termed as file,for each file created by
the operating system maintains a directory entry also called volume table of
contents
File operations
Create a file
Write a file
Reading a file
Rewind a file
Delete a file
Allocations Methods
The allocation methods define how the files are stored in the disk blocks.
1)Contiguous 2)noncontiguous
In this schema user estimate maximum file size that the file will grow
to,considering the future expansions and then request the operating system
to allocate those blocks at the time of creation of file.
Operating system normally uses blocks allocation list to manages the disk
spaces.
It alos gives you whether the block is free or allocated.it is more useful to
maintain two differerent tables:
1.Allocated blocks 2.Free blocks.
Methods
1.First fit: If suppose file requires 7 blocks,the os goes through block list and
allocates the entry blocks equal or more than 7
2.Best fit: for this method free blocks list is to be sorted by no of free blocks.it
would choose that entry which is the smallest amongst all the entries,which
are equal or bigger than required one.
3.Worst fit: it allocated free blocks that is equal to or larger than our
environment.
Non-contigouous Allocation
In this maximum size of file does not have to be predicted at the beginning.
The file can grows with time as per the needs. This reduce wastage of
spaces and operating system automatically allocates additional blocks as per
requirement without aborting program.
1.chained allocation
2.indexed allocation
Indexed allocation
In this scheme, a special block known as the Index block contains the
pointers to all the blocks occupied by a file. Each file has its own index block.
The ith entry in the index block contains the disk address of the ith file block.
The directory entry contains the address of the index block as shown in the
image:
File organization
For ease of access or reference, each record is allocated a key field, that is a
field by which it is identified.
Direct file organization accesses the records through record’s physical addresses on a direct access
storage device.
Device Driver
Device driver are software program required for each device.each device will require different driver for
different device as per functionality. A device driver knows how the buffer,flags,register control and
status bits should be used for a particular device.a simply reading character from a device involves
complex sequences of device specific operations.
Terminal i/o
Terminal hardware can be divided into two parts the keyboard which is used for input medium and
video screen,which useful as an output medium combination of these two is termed as VDU.
1.Dumb terminal : It is responsible for basic input and output of characters. It is called dumb because it
does no processing on the input characters.
2.Intelligent terminal: The terminal can do processing on the up. So it requires more powerful hardware
and software for it.
Multiprogramming
Multiprogramming means more than one program can be active at the same
time. Before the operating system concept, only one program was to be
loaded at a time and run. These systems were not efficient as the CPU was
not used efficiently. For example, in a single-tasking system, the CPU is not
used if the current program waits for some input/output to finish. The idea of
multiprogramming is to assign CPUs to other processes while the current
process might not be finished.
Degree of multiprogramming
The no of processes running simultaneously competing for CPU is called degree of multiprogramming
Context switching
In multiprogramming at a time multiple processes are running simultaneously. Suppose there are two
processes. Process1 and process 2
Then there would be time lost in turning attention from process 1 to process 2 this is called context
switching.
States of a Process
a process is a program that is being executed. During its execution, a
process goes through different states.
New: This state represents a newly created process that hasn’t started
running yet. It has not been loaded into the main memory, but its process
control block (PCB) has been created, which holds important information
about the process.
Ready: A process in this state is ready to run as soon as the CPU
becomes available. It is waiting for the operating system to give it a
chance to execute.
Running: This state means the process is currently being executed by
the CPU. Since we’re assuming there is only one CPU, at any time, only
one process can be in this state.
Blocked/Waiting: This state means the process cannot continue
executing right now. It is waiting for some event to happen, like the
completion of an input/output operation (for example, reading data from a
disk).
Exit/Terminate: A process in this state has finished its execution or has
been stopped by the user for some reason. At this point, it is released by
the operating system and removed from memory.
CPU Scheduling
CPU scheduling is a process used by the operating system to decide which
task or process gets to use the CPU at a particular time. This is important
because a CPU can only handle one task at a time, but there are usually
many tasks that need to be processed. The following are different purposes
of a CPU scheduling time.
Maximize the CPU utilization
Minimize the response and waiting time of the process.
Terminologies Used in CPU Scheduling
Arrival Time: The time at which the process arrives in the ready queue.
Completion Time: The time at which the process completes its
execution.
Burst Time: Time required by a process for CPU execution.
Turn Around Time: Time Difference between completion time and arrival
time.
Turn Around Time = Completion Time – Arrival Time
Waiting Time(W.T): Time Difference between turn around time and burst
time.
Waiting Time = Turn Around Time – Burst Time
CPU Utilization: The main purpose of any CPU algorithm is to keep the
CPU as busy as possible. Theoretically, CPU usage can range from 0 to
100 but in a real-time system, it varies from 40 to 90 percent depending
on the system load.
Throughput: The average CPU performance is the number of processes
performed and completed during each unit. This is called throughput. The
output may vary depending on the length or duration of the processes.
Turn Round Time: For a particular process, the important conditions are
how long it takes to perform that process. The time elapsed from the time
of process delivery to the time of completion is known as the conversion
time. Conversion time is the amount of time spent waiting for memory
access, waiting in line, using CPU, and waiting for I / O.
Waiting Time: The Scheduling algorithm does not affect the time required
to complete the process once it has started performing. It only affects the
waiting time of the process i.e. the time spent in the waiting process in the
ready queue.
Response Time: In a collaborative system, turn around time is not the
best option. The process may produce something early and continue to
computing the new results while the previous results are released to the
user. Therefore another method is the time taken in the submission of the
application process until the first response is issued. This measure is
called response time.
Different Types of CPU Scheduling Algorithms
There are mainly two types of scheduling methods:
Preemptive Scheduling: Preemptive scheduling is used when a process
switches from running state to ready state or from the waiting state to the
ready state.
Non-Preemptive Scheduling: Non-Preemptive scheduling is used when
a process terminates , or when a process switches from running state to
waiting state.