OS Unit - 1
OS Unit - 1
resource manager
– Manages all resources.
– Decides between conflicting requests for efficient and fair
resource use.
• control program
– Controls execution of programs to prevent errors and improper
use of the computer.
pg. 1
• extended machine
– Turns complicated hardware into nice abstractions.
Architecture
Hardware:
pg. 2
The hardware consists of the memory, CPU, arithmetic-
logic unit, various bulk storage devices, I/O, peripheral
devices and other physical devices.
Kernel:
In computing, the kernel is the central component of most
computer operating systems; it is a bridge between applications
and the actual data processing done at the hardware level. The
kernel's responsibilities include managing the system's
resources (the communication between hardware and software
components). Usually as a basic component of an operating
system, a kernel can provide the lowest-level abstraction layer
for the resources (especially processors and I/O devices) that
application software must control to perform its function. It
typically makes these facilities available to application processes
through inter-process communication mechanisms and system
calls.
Shell:
A shell is a piece of software that provides an interface for users
to an operating system which provides access to the services of
a kernel. The name shell originates from shells being an outer
layer of interface between the user and the innards of the
operating system.
Operating system shells generally fall into one of two categories:
command-line and graphical. Command-line shells provide a
command-line interface (CLI) to the operating system, while
graphical shells provide a graphical user interface (GUI). In either
category the primary purpose of the shell is to invoke or
"launch" another program; however, shells frequently have
additional capabilities such as viewing the contents of
directories.
pg. 3
Design Goals in Operating Systems.
The design requirements are quite hard to specify in an operating system. They
are basically divided into two parts: User design requirements and System
design requirements.
pg. 4
There are many design goals that modern operating systems have to fulfil to be
considered successful.
Concurrent Systems:
Modern operating systems should be able to handle multiple users
as well as multiple devices at the same time. This is necessary for
the modern multi-core architectures. Because of these
specifications, the operating system design can be quite complex
and difficult to create.
pg. 5
Resource Sharing:
The operating system should make sure that resources are shared
in a correct manner between multiple user processes. This can get
quite complex when multiple users share the same device as well.
Backward Compatibility:
The new operating systems created should be compatible with the
previous models i.e. they should contain backward compatibility.
Basic functions:
Security –
The operating system uses password protection to protect user data
and similar other techniques. it also prevents unauthorized access to
pg. 6
programs and user data.
Job accounting –
Memory Management –
pg. 7
memory, and for how long. It Allocates the memory to a process
when the process requests it and deallocates the memory when
the process has terminated or is performing an I/O operation.
Processor Management –
Device Management –
File Management –
pg. 8
System calls:
A system call is a method for a computer program to request a service from the
kernel of the operating system on which it is running. A system call is a method
of interacting with the operating system via programs. A system call is a request
from computer software to an operating system's kernel.
1. Process Control
2. File Management
3. Device Management
4. Information Maintenance
5. Communication
pg. 9
Process Control
Process control is the system call that is used to direct the
processes. Some process control examples include creating, load,
abort, end, execute, process, terminate the process, etc.
File Management
File management is a system call that is used to handle the files.
Some file management examples include creating files, delete files,
open, close, read, write, etc.
Device Management
Device management is a system call that is used to deal with
devices. Some examples of device management include read,
device, write, get device attributes, release device, etc.
Information Maintenance
Information maintenance is a system call that is used to maintain
information. There are some examples of information
maintenance, including getting system data, set time or date, get
time or date, set system data, etc.
Communication
Communication is a system call that is used for communication.
There are some examples of communication, including create,
delete communication connections, send, receive messages, etc.
pg. 10
Interaction of O.S. & Hardware Architecture:
o We write code in a text editor using any language like C++, JAVA,
Python, etc.
o This code is given to the compiler and it actually converts it to
assembly code that is very close to machine hardware as it
depends on an instruction set which is then converted to the
binary that is 0s and 1s which actually represent digital voltage
fed to transistors inside the chip.
pg. 11
can store data temporarily and a Hard disk that can permanently
store data.
o The operating system is also responsible for feeding the software
to the right hardware like the keyboard, mouse, screen, etc.
Batch:
Batch processing was very popular in the 1970s. The
jobs were executed in batches. People used to have a
single computer known as a mainframe. Users using
batch operating systems do not interact directly with
the computer. Each user prepares their job using an
offline device like a punch card and submitting it to
the computer operator. Jobs with similar
requirements are grouped and executed as a group to
speed up processing. Once the programmers have
left their programs with the operator, they sort the
programs with similar needs into batches.
pg. 12
The batch operating system grouped jobs that perform similar functions. These
job groups are treated as a batch and executed simultaneously. A computer
system with this operating system performs the following batch processing
activities:
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 is finished, without any manual intervention.
Disadvantages
Multiprogramming:
Sharing the processor, when two or more programs reside in memory at the
same time, is referred as multiprogramming. Multiprogramming assumes a
single shared processor. Multiprogramming increases CPU utilization by
organizing jobs so that the CPU always has one to execute.
pg. 13
The following figure shows the memory layout for a multiprogramming system.
pg. 14
Advantages
Disadvantages
Multitasking:
Multitasking is when 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. An OS 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.
The OS 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 the 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.
pg. 15
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 slower speeds, it may take a long
time to complete. During this time, a CPU can be utilized by another
process.
The 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.
Time Sharing:
The operating system performs time sharing through CPU scheduling and
multiprogramming. Let us study closely the process in a time sharing system. It is
as follows:
It is the division of CPU time for each process when more than one
task are given by the user.
pg. 16
A short duration of time is chosen for each process. Moreover, this
time duration is very small in the order of 10-100 milliseconds. This
time duration is known as time slot, time slice, or quantum.
Suppose three processes namely, P1, P2, and P3 are running on the
system. Now, suppose that the quantum is 4 nanoseconds (ns). Now,
they will execute in the following manner.
Process P1 will execute for 4 ns, as soon a sit gets over, process p2
starts executing for a duration of 4 ns. Further, when p2 gets
complete process P3 executes for 4ns. This process continues till all
the processes gets complete.
In this way, only one process runs at a time but, the switching
between the processes is very fast. Hence, the user feels that all the
processes are running at the same time.
The above diagram shows the working of a time sharing OS. In this diagram,
process 4 is in the active state. Process 5 is in a ready state while, processes 1, 2,
3, and 6 are in a waiting state.
pg. 17
Ready State: In this state, the process is ready for execution but, it is
waiting for its turn to use the CPU. More than one process can be in
the ready state at a time.
Waiting State: In this state, the process is not ready for execution. It
is waiting for some input/output process to get complete.
Parallel Systems:
Parallel System are designed to speed up the execution of programs by
diving the programs into multiple fragments and processing these fragments
at the same time. Flynn has classified computer systems into four types based
on parallelism in the instructions and in the data streams.
pg. 18
A distributed operating system is system software over a collection of
independent, networked, communicating, and physically separate
computational nodes. They handle jobs which are serviced by multiple
CPUs. Each individual node holds a specific software subset of the global
aggregate operating system.
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.
pg. 19