Unit - 1 Os
Unit - 1 Os
2.Operating system:
It provides environment where we can execute programs.
It controls and co-ordinates use of hardware among various applications and
users.
3.System Program and application program
System program:
Application Program:
These are the set of programs that view computer as a tool for solving a particular
problem.
Application software is a software that are been used by the end user.
Application programming is used to build application software which includes
software like notepad, Word Pad, calculator, web browser, Microsoft excel and
many more.
It interacts with system software which in turn interacts and makes physical
hardware functional.
Examples: Word Processing, Hotel Management System, Accounting Package etc.
1) It is the collection of components and art or 1) It is the set of programs that view computer as a tool
designing of a given program. for solving a particular problem.
2) Programming is done using assembly language 2) Application programming is used to build application
which interacts with hardware. software which includes software.
3) System software that executes the application 3) Application software is a software that are been used
software. by the end user.
4) System programming is used to write low level 4)Application Programming is used to write High level
instructions instructions
System Program Application Program
4.User:peoples,machines,othercomputers .
Booting
Booting is a process of starting the computer operating system starts the computer to work. It checks the
computer and makes it ready to work.
Two types
Memory Management
operating system. The memory cannot be managed without operating system. Different programs and
data execute in memory at one time. if there is no operating system, the programs may mix with each
other. The system will not work properly.
A program is loaded in the memory before it can be executed. Operating system provides the facility to
load programs in memory easily and then execute it.
Data security
Data is an important part of computer system. The operating system protects the data stored on the
computer from illegal use, modification or deletion.
Disk Management
Operating system manages the disk space. It manages the stored files and folders in a proper way.
Process Management
CPU can perform one task at one time. if there are many tasks, operating system decides which task should
get the CPU.
Device Controlling
operating system also controls all devices attached to computer. The hardware devices are controlled with
the help of small software called device drivers..
Providing interface
It is used in order that user interface acts with a computer mutually. User interface controls how you input
data and instruction and how information is displayed on screen. The operating system offers two types of
the interface to the user:
Shell is interface between user and kernel and converts the high level instructions to low
level instruction and hand over to kernel.
Kernel is heart of computer which do operations of operating system and also protects
hardware .
If user wants to access any data it has to communicate with kernel to access the hardware
to perform execution.
main difference between kernel and shell is that the kernel is the core of the operating
system that controls all the tasks of the system while the shell is the interface that
allows the users to communicate with the kernel. Unix is an operating system.
Different approaches or Structures of Operating
System
Operating system can be implemented with the help of various structures. The structure
of the OS depends mainly on how the various common components of the operating
system are interconnected and melded into the kernel. Depending on this we have
following structures of the operating system:
1.Simple structure:
Such operating systems do not have well defined structure and are small, simple and
limited systems. The interfaces and levels of functionality are not well separated. MS-DOS
is an example of such operating system. In MS-DOS application programs are able to
access the basic I/O routines. These types of operating system cause the entire system to
crash if one of the user programs fails.
Diagram of the structure of MS-DOS is shown below.
Fig:Simple structure
Advantages of Simple structure:
It delivers better application performance because of the few interfaces between the
application program and the hardware.
Easy for kernel developers to develop such an operating system.
Disadvantages of Simple structure:
The structure is very complicated as no clear boundaries exists between modules.
It does not enforce data hiding in the operating system.
2.Monolithical structures:
The monolithic operating system is a very basic operating system in which file
management, memory management, device management, and process management are
directly controlled within the kernel. The kernel can access all the resources present in the
system. In monolithic systems, each component of the operating system is contained
within the kernel. Operating systems that use monolithic architecture were first time used
in the 1970s.
The monolithic operating system is also known as the monolithic kernel. This is an old
operating system used to perform small tasks like batch processing and time-sharing
tasks in banks. The monolithic kernel acts as a virtual machine that controls all hardware
parts.
It is different from a microkernel, which has limited tasks. A microkernel is divided into
two parts, kernel space, and user space. Both parts communicate with each other through
IPC (Inter-process communication). Microkernel's advantage is that if one server fails,
then the other server takes control of it.
-Monolithic kernel
A monolithic kernel is an operating system architecture where the entire operating system
is working in kernel space. The monolithic model differs from other operating system
architectures, such as the microkernel architecture, in that it alone defines a high-level
virtual interface over computer hardware.
A set of primitives or system calls implement all operating system services such as
process management, concurrency, and memory management. Device drivers can be
added to the kernel as modules.
o The execution of the monolithic kernel is quite fast as the services such as memory
o If any service fails in the monolithic kernel, it leads to the failure of the entire
system.
o The entire operating system needs to be modified by the user to add any new
service.
3.Layered structure:
An OS can be broken into pieces and retain much more control on system. In this
structure the OS is broken into number of layers (levels). The bottom layer (layer 0) is the
hardware and the topmost layer (layer N) is the user interface.
These layers are so designed that each layer uses the functions of the lower level layers
only.
This simplifies the debugging process as if lower level layers are debugged and an error
occurs during debugging then the error must be on that layer only as the lower level
layers have already been debugged.
The main disadvantage of this structure is that at each layer, the data needs to be
modified and passed on which adds overhead to the system. Moreover careful planning
of the layers is necessary as a layer can use only lower level layers. UNIX is an example of
this structure.
Advantages of Layered structure:
Layering makes it easier to enhance the operating system as implementation of a
layer can be changed easily without affecting the other layers.
It is very easy to perform debugging and system verification.
Disadvantages of Layered structure:
In this structure the application performance is degraded as compared to simple
structure.
It requires careful planning for designing the layers as higher layers use the
functionalities of only the lower layers.
4.Micro-kernel:
This structure designs the operating system by removing all non-essential components
from the kernel and implementing them as system and user programs. This result in a
smaller kernel called the micro-kernel.
Advantages of this structure are that all new services need to be added to user space and
does not require the kernel to be modified. Thus it is more secure and reliable as if a
service fails then rest of the operating system remains untouched. Mac OS is an example
of this type of OS.
Advantages of Micro-kernel structure:
It makes the operating system portable to various platforms.
As microkernels are small so these can be tested effectively.
Disadvantages of Micro-kernel structure:
Increased level of inter module communication degrades system performance.
Personal computer operating systems are widely used for word processing, spreadsheets
and Internet access.
You can say that your laptops, computer systems, tablets etc. are your personal computers
and the operating system such as windows 7, windows 10, android, etc. are your personal
computer operating system.
And you can use your personal computer operating system for your personal purposes,
for example, to chatting with your friends using some social media sites, reading some
articles from internet, making some projects through microsoft powerpoint or any other,
designing your website, programming something, watching some videos and movies,
listening to some songs and many more.
5.Parallel/Multiple-processing operating system:
A multiprocessing operating system (OS) is one in which two or more central
processing units (CPUs) control the functions of the computer. Each CPU contains a
copy of the OS, and these copies communicate with one another to coordinate operations.
zmultiple programs (more than one program) are executed on different processors
at the same time. This type of processing is known as multiprocessing. Some operating
systems have features of multiprocessing. UNIX is an example of multiprocessing
operating system. Some versions of Microsoft Windows also support multiprocessing.
The multiprocessing system, in which each processor is assigned a specific task, is known
as Asymmetric Multiprocessing System. For example, one processor is dedicated for
handling user's requests, one processor is dedicated for running application program, and
one processor is dedicated for running image processing and so on. In this system, one
processor works as master processor, while other processors work as slave processors.
The master processor controls the operations of system. It also schedules and distributes
tasks among the slave processors. The slave processors perform the predefined tasks.
ii)Symmetric Multiprocessing System(SMP):
The multiprocessing system, in which multiple processors work together on the same
task, is
known as Symmetric Multiprocessing System. In this system, each processor can perform
all types of tasks. All processors are treated equally and no master-slave relationship
exists between the processors.
For example, different processors in the system can communicate with each other.
Similarly, anI/O can be processed on any processor. However, I/O must be controlled to
ensure that the data reaches the appropriate processor. Because all the processors share
the same memory, so the input data given to the processors and their results must be
separately controlled. Today all modern operating systems including Windows and Linux
provide support for SMP.
Advantages :
1)Max throughput
2)More Reliable system
3)Fast processing
4)Efficiency improved
5)More economic system
Failure of one will not affect the other network communication, as all systems are
independent from each other
Electronic mail increases the data exchange speed
Since resources are being shared, computation is highly fast and durable
Load on host computer reduces
These systems are easily scalable as many systems can be easily added to the
network
Delay in data processing reduces
Advantages of RTOS:
Maximum Consumption: Maximum utilization of devices and system, thus more
output from all the resources
Task Shifting: The time assigned for shifting tasks in these systems are very less. For
example, in older systems, it takes about 10 microseconds in shifting one task to
another, and in the latest systems, it takes 3 microseconds.
Focus on Application: Focus on running applications and less importance to
applications which are in the queue.
Real-time operating system in the embedded system: Since the size of programs are
small, RTOS can also be used in embedded systems like in transport and others.
Error Free: These types of systems are error-free.
Memory Allocation: Memory allocation is best managed in these types of systems.
Disadvantages of RTOS:
Limited Tasks: Very few tasks run at the same time and their concentration is very
less on few applications to avoid errors.
Use heavy system resources: Sometimes the system resources are not so good and
they are expensive as well.
Complex Algorithms: The algorithms are very complex and difficult for the designer
to write on.
Device driver and interrupt signals: It needs specific device drivers and interrupts
signals to respond earliest to interrupts.
Thread Priority: It is not good to set thread priority as these systems are very less
prone to switching tasks.
Examples of Real-Time Operating Systems are: Scientific experiments, medical
imaging systems, industrial control systems, weapon systems, robots, air traffic control
systems, etc.
1. Process Management
2. File Management
3. Network Management
4. Main Memory Management
5. Secondary Storage Management
6. I/O Device Management
7. Security Management
8. Command Interpreter System
1. Process Management
The term ‘Process Management’ means a mechanism which is used to handle
multiple processes that are running in the operating system concurrently. Each
software application program contains processes that are associated with the
software application program when they are running.
For example: - If we use Google Chrome browserthen a process also run for the
browser program. In the operating system, there are various processes which also
run and perform several functions.
With the help of the process management, all the processes are managed and kept
running effectively.
Functions of Process Management
Synchronization Process
Suspension and Resumption.
Communication Process
Process Creation and Deletion.
2. File Management
. In a distributed system, each processor has its separate memory, and the
communication between A file is defined as a set of correlated information and it is
defined by the creator of the file. Mostly files represent data, source and object
forms, and programs. Data files can be of any type like alphabetic, numeric, and
alphanumeric.
Functions of File Management
There are various functions of file management:
3. Network Management
We can understand from the network management that it is the process of
managing and administering the computer network. Network management
comprises fault analysis, maintaining the quality of service, provisioning of
networks, and performance management.
The collection of a computer/processors is known as a distributed system.
A distributed system is one which does not share its memorythe processors takes place
with the help of different communication lines such as telephone lines, fiber optics, etc.
In the network, with the help of the computer network, computers are connected, and it is
configured in various ways. Network management provides the facility of network
connection, whether it is fully or partially connected network. And it helps to design
routing and connection strategies, which helps in overcoming the issues of security and
connection.
7. Security Management
In an operating system, there are several processes that are required to be secured from
different activities. For this purpose, there are different types of procedures we use, which
ensures that the processes that you want to operate for the hardware resources such as
memory CPU, files, etc. must have appropriate authorization from the operating system.
For Example: With the help of the memory addressing hardware, we can ensure that a
process cannot execute outside its own address space or vice versa. Time confirms that
there is no process that has control over the CPU without leaving it.
Finally, to protect the process, there is no process that can do its own Input/Output. And
it helps to maintain the integrity of different peripheral devices.
One set of operating-system services provides functions that are helpful to the user Communications –
Processes may exchange information, on the same computer or between computers over a network
Communications may be via shared memory or through message passing (packets movedby the OS)
1)Error detection – OS needs to be constantly aware of possible errors May occur in the CPU and memory
hardware, in I/O devices, in user program For each type of error, OS should take the appropriateaction to
ensure correct and consistent computing Debugging facilities can greatly enhance the user’s and
programmer’s abilities to efficiently use the system
Another set of OS functions exists for ensuring the efficient operation of the system itself via resource
sharing
2)Resource allocation - When multiple users or multiple jobs running concurrently, resources mustbe
allocated to each of them
Many types of resources - Some (such as CPU cycles, main memory, and file storage) may have special
allocation code, others (such as I/O devices) may have general request and release code
3)Accounting - To keep track of which users use how much and what kinds of computer resource
4)Protection and security - The owners of information stored in a multiuser or networked computer
system may want to control use of that information, concurrent processes should not interfere with each
other
-Security of the system from outsiders requires user authentication, extends to defending external I/O
devices from invalid access attempts
If a system is to be protected and secure, precautions must be instituted throughout it. A chain is only as
strong as its weakest link.
User Operating System Interface - CLI
Command Line Interface (CLI) or command interpreter allows direct command entry
User-friendly desktop metaphor interfaceUsually mouse, keyboard, and monitorIcons represent files,
programs, actions, etc
Various mouse buttons over objects in the interface cause various actions (provide information, options,
execute function, open directory (known as a folder)
Many systems now include both CLI and GUI interfaces Microsoft Windows is GUI with CLI “command”
shell
Apple Mac OS X as “Aqua” GUI interface with UNIX kernel underneath and shells available Solaris is CLI
with optional GUI interfaces (Java Desktop, KDE)
To understand system calls, first one needs to understand the difference between kernel
mode
and user mode of a CPU. Every modern operating system supports these two modes.
When CPU is in kernel mode, the code being executed can access any memory
address and any hardware resource.
Hence kernel mode is a very privileged and powerful mode.
If a program crashes in kernel mode, the entire system will be halted.
User Mode
When CPU is in user mode, the programs don't have direct access to memory
and hardware resources.
In user mode, if any program crashes, only that particular program is halted.
That means the system will be in a safe state even if a program in user mode
System Call
When a program in user mode requires access to RAM or a hardware resource, it must
ask the kernel to provide access to that resource. This is done via something called a
system call.
When a program makes a system call, the mode is switched from user mode to kernel
mode. This is called a context switch.
Then the kernel provides the resource which the program requested. After that, another
context switch happens which results in change of mode from kernel mode back to user
mode.
Programming interface to the services provided by the OS Typically written in a high-level
language (C or C++)
Mostly accessed by programs via a high-level Application Program Interface (API) rather than
direct system call usenThree most common APIs are Win32 API for Windows, POSIX API for
POSIX- based systems (including virtually all versions of UNIX, Linux, and Mac OS X), and Java
API for the Java virtual machine (JVM)
Why use APIs rather than system calls?(Note that the system-call names used throughout this text
are generic)
The system calls acts as an interface between a user process and the Operating system
kernel. When a process in user mode needs to access a resource, a request is sent to the
kernel.
Often, more information is required than simply identity of desired systemcall Exact type and
amount of information vary according to OS and call Three general methods used to pass
parameters to the
Parameters stored in a block, or table, in memory, and address of block passed as a parameter
in a register
Parameters placed, or pushed, onto the stack by the program and popped off the stack by the
operatingsystem
Block and stack methods do not limit the number or length of parameters being
passed Parameter Passing via Table
TYPES OF SYSTEM CALLS.
There are mainly five types of system calls. These are explained in detail as
follow
1)Process Control: These system calls deal with process management and control.
2)File Management: These system calls deals with file manipulation and
management.
3)Device Management: These system calls deals with device manipulation and
management.
4)Information Maintenance: These system calls handle information and its
transfer between the operating system and the user program.
5)Communication: These system calls are useful for inter-process communication.
-Process control
end, abort
load, execute
create process, terminate process
get process attributes, set process attributes
wait for time
wait event, signal event
-File management
Process requires several resources to execute, if these resources are available, they will be
granted and control retuned to user process. Some are physical such as video card and
other such as file. User program request the device and release when finished
-Information maintenance
System calls exist purely for transferring information between the user program and OS.
It can return information about the system, such as the number of current users, the
version number of the operating system, the amount of free memory or disk space and so
on.
-Communications