Os Unit-1
Os Unit-1
Os Unit-1
Definition:
An Operating System is a program that controls the execution of application programs and acts
as an interface between the user of a computer and the computer hardware.
Varieties of Operating Systems have emerged over the years having different features and
functionalities like Windows, Linux, MacOS, iOS, Android etc.
Every computer system including desktops, laptops, tablets, supercomputers, hand held and
even video game consoles use some type of Operating system.
Operating systems are there from the very first computer generation and they keep evolving
with time. There are various types of operating systems used today depending on the device,
manufacturer, and user preferences.
Purpose:
To provide an environment in which a user can execute programs conveniently and
efficiently. It is responsible for the management and coordination of activities and the sharing
of the resources of the computer.
OS is a System Software (Tested Program + Documentation).
• General Motors Research Lab implemented the first OS in 1956 for their IBM 701 (central
computer)
• In 1960’s IBM started developing their own OS and distributed it.
• In late 1960’s, first version of UNIX OS was developed and was written in C language
• In 1981, first OS built by Microsoft was DOS known as MS-DOS.
• In 1985, first version of Windows OS came into existence when a GUI created and paired
with MS-DOS.
Abstract View (or) Generic Architecture of Components of OS:
Computer System consists of the following components:
• Computer Users are the users who use the overall computer system.
• Application Softwares are the softwares which users use directly to perform different
activities. These softwares are simple and easy to use like Browsers, Word, Excel,
different Editors, Games etc. These are usually written in high-level languages, such as
Python, Java and C++.
• System Softwares are the softwares which are more complex in nature and they are more
near to computer hardware. These softwares are usually written in low-level languages
like assembly language and includes Operating Systems (Microsoft Windows, macOS,
and Linux), Compiler, and Assembler etc.
• Computer Hardware includes Monitor, Keyboard, CPU, Disks, Memory, etc.
The below figure shows the Realtime examples of the generic components of a Computer
System OS.
Kernel:
• It is the first program that is loaded in memory when system bootsup. A kernel is the
core component of an operating system that acts as a bridge between the hardware and
software.
• It manages system resources such as memory, CPU, and input/output devices, and
provides a layer of abstraction between the hardware and higher-level software
components.
USER VIEW:
The user view depends on the system interface that is used by the users. The different types of
user view experiences can be explained as follows −
• If the user is using a personal computer, the operating system is largely designed to
make the interaction easy. There is no need for the operating system to worry about
resource utilization. This is because the personal computer uses all the resources
available.
• If the user is using a system connected to a mainframe or a minicomputer, the
operating system is largely concerned with resource utilization. This is because there may
be multiple terminals connected to the mainframe and the operating system makes sure
that all the resources such as CPU, memory, I/O devices etc. are divided uniformly
between them.
• If the user is sitting on a workstation connected to other workstations through networks,
then the operating system needs to focus on both individual usage of resources and
sharing though the network.
• If the user is using a handheld computer such as a mobile, then the operating system
handles the usability of the device including a few remote operations.
SYSTEM VIEW:
The different types of system view for operating system can be explained as follows –
• In system views the operating system as a resource allocator. There are many resources
such as CPU time, memory space, file storage space, I/O devices etc. that are required by
processes for execution.
• The operating system can also work as a control program. It manages all the processes
and I/O devices so that the computer system works smoothly and there are no errors. It
makes sure that the I/O devices work in a proper manner without creating problems.
• Operating systems can also be viewed as a way to make using hardware easier.
• Computers were required to easily solve user problems. However, it is not easy to work
directly with the computer hardware. So, operating systems were developed to easily
communicate with the hardware.
• An operating system can also be considered as a program running at all times in the
background of a computer system (known as the kernel) and handling all the application
programs.
Clustered Systems:
Cluster systems are similar to parallel systems because both systems use multiple CPUs. They
have independent computer systems and a shared storage media, and all systems work together
to complete all tasks. All cluster nodes use two different approaches to interact with one another,
like message passing interface (MPI) and parallel virtual machine (PVM).
The clustered systems are a combination of hardware clusters and software clusters. Hardware
clusters aid in the sharing of high-performance disks among all computer systems, while
software clusters give a better environment for all systems to operate.
Protection – Is any mechanism for controlling access of processes or users to resources defined
by the OS.
Protection can improve the reliability by detecting latent errors at the interface. An unprotected
resource cannot defend against use by an unauthorized user. So, a protected-oriented system
provides a means to distinguish between authorized and unauthorized usage.
Security – Is the defense of system against internal and external attacks. Security protects the
information stored in the system (both data and code), as well as the physical resources of the
computer system, from unauthorized access, malicious destruction or alteration, and accidental
introduction of inconsistency.
Protection and security require that computer resources such as CPU, Software’s, memory etc.
are protected.
This extends to the operating system as well as the data in the system. This can be done by
ensuring integrity, confidentiality and availability in the operating system. The system must be
protected against unauthorized access, viruses, worms etc.
Most Operating systems maintain a list of user names and associated User Identifiers (user IDs).
When a user logs in to the system, the authentication stage determines the ID for user.
The operating systems are large and complex. A common approach is to partition the task into
small components, or modules, rather than have one monolithic system.
1. Simple Structure:
• This structure was followed by most of the OS designed long ago. But it lacks
definition and is only appropriate for usage with tiny and restricted systems. Since
the interfaces and degrees of functionality were not well separated, which may result
in unauthorized access to I/O procedures.
• This organizational structure is used by the MS-DOS operating system.
• These layers include ROM BIOS device drivers, MS-DOS device drivers, application
programs, and system programs.
• Here the base hardware ROM-BIOS controls the system hardware and acts as an
interface between OS and system Hardware. Where system BIOS contains in ROM
Chip.
• The Pre – installed programs on Windows based computer starts before actual OS
begins.
• Application programs and System programs have direct access to BIOS drivers, if any
program running in phase fails, it crashes the entire system.
2. Monolithic Structure:
• The Monolithic operating System in which the kernel acts as a manager by managing
all things like file management, memory management, device management, and
operational processes of the Operating System.
• Every functionality packed into one level in a kernel is known as Monolithic kernel.
• This organizational structure is used by the UNIX operating system.
3. Layered Structure:
• 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.
• Layering makes it easier to enhance the operating system as implementation of a
layer can be changed easily without affecting the other layers.
• Each layer can interact only with layer above or below. Where hardware is protected
without direct contact with user interface.
• Debugging is simpler because the lower layers are examined first, followed by the
top layers.
5. Modular Structure:
• It is considered as the best approach for an OS. It involves designing of a modular
kernel.
• The kernel has only set of core components and other services are added as
dynamically loadable modules to the kernel either during run time or boot time.
• It resembles layered structure due to the fact that each kernel has defined and protected
interfaces but it is more flexible than the layered structure as a module can call any
other module.
There are several types of Operating Systems which are mentioned below.
• Due to the multiple CPU, it can be more complex and somehow difficult to understand.
5. Distributed OS:
• Distributed systems are also known as loosely coupled systems.
• Here multiple central processors are used to serve multiple real-time applications and
multiple users.
• Data processing & jobs are distributed among the processors accordingly.
• The processors communicate with one another through various communication lines
(such as high-speed buses or telephone lines).
Advantages of Distributed Operating System
• Failure of one will not affect the other network communication, as all systems are
independent of each other.
• Since resources are being shared, computation is highly fast and durable.
Disadvantages of Distributed Operating System
Structure
6. Real time OS:
• It serves real-time systems. The time interval required to process and respond to inputs is
very small. This time interval is called response time.
• Real-time systems are used when there are time requirements that are very strict like missile
systems, air traffic control systems, robots, etc.
• It is used when a large number of events are processed in a short interval of time.
• In Real-Time Systems, each job carries a certain deadline within which the job is supposed to
be completed.
Hard Real-Time OSs are meant for applications where time constraints are very strict and even
the shortest possible delay is not acceptable. Virtual memory is rarely found in these systems.
Soft Real-Time OSs are for applications where time-constraint is less strict.
Advantages of RTOS
• Maximum Consumption: Maximum utilization of devices and systems, thus more
output from all the resources.
• Task Shifting: The time assigned for shifting tasks in these systems is very less.
• Real-time operating system in the embedded system: Since the size of programs is
small, RTOS can also be used in embedded systems like in transport and others.
• Limited Tasks: Very few tasks run at the same time and their concentration is very less
on a 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.
• Thread Priority: It is not good to set thread priority as these systems are very less prone
to switching tasks.
7. Personal Computing Environment:
In the personal computing environment, there is a single computer system. All the system
processes are available on the computer and executed there. The different devices that
constitute a personal computing environment are laptops, mobiles, printers, computer systems,
scanners etc.
Personal computing is a stand-alone machine. In a personal computing environment, the
complete program resides on the stand-alone machine and executed from the same machine.
1. Process Management:
The process management component is the way to manage the multiple processes running
simultaneously on the OS. Process management manages all the running processes and
makes sure that all of them run efficiently. It also uses the memory allocated to them and
shuts them down when required.
2. File Management:
Files are used for long-term storage. Files are used for both input and output. This file
management service can also be treated as an abstraction as it hides the information about the
disks from the user. The operating system also provides a system call for file management.
3. I/O Device Management:
I/O device management hides the variations of some hardware devices from the user.
Following are the features of I/O device management:
• Buffers caching system
• Provides general device driver code
• Provides drivers for particular hardware devices.
• Helps know the individualities of a device.
4. Network Management:
Network management is the process of administering and managing computer networks. It
includes performance management, fault analysis, provisioning of networks, and
maintaining the quality of service.
Network management helps connect the network fully or partially so that users can design
routing and connection strategies with no connection and security issues.
5. Storage Management:
Programs help access data in the main memory during execution. The main memory is too
small and cannot store all the data and programs permanently. Thus, secondary storage acts
as a backup to the main memory. Assemblers and compilers are stored on the disk until they
are loaded into the memory and use the disk for processing.
6. Security Management:
It is necessary to protect the processes from each other’s activities. Security management
ensures that the operating files, memory, CPU, and other hardware resources have proper
authorization from the OS. No process can do its own I/O, this maintains the integrity of
peripheral devices.
User interface is essential and all operating systems provide it. Users either interface with the
operating system through the command-line interface or GUI. The command interpreter
executes the next user-specified command.
Program execution
The Operating System is responsible for the smooth execution of both user and system
programs. It utilizes various resources available for the efficient running of all types of
functionalities.
I/O Operations
Operating System manages the input-output operations and establishes communication between
the user and device drivers. Device drivers are software that is associated with hardware that is
being managed by the OS so that the sync between the devices works properly.
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.
Operating device affords safety to the statistics and packages of a person and protects any
interference from unauthorized users. The safety feature counters threats, which are published
via way of individuals out of doors the manage of the running device.
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.
Error Handling
The Operating System also handles the error occurring in the CPU, in Input-Output devices,
etc. It also ensures that an error does not occur frequently and fixes the errors. It also prevents
the process from coming to a deadlock. It also looks for any type of error or bugs that can
occur while any task.
SYSTEMS CALLS
A system call is a mechanism that provides the interface between a process and the operating
system. It is a programmatic method in which a computer program requests a service from the
kernel of the OS.
System call offers the services of the operating system to the user programs via API (Application
Programming Interface). System calls are the only entry points for the kernel system.
In operating systems, the user is not allowed to directly access the kernel from user mode, and
the user needs an interface between the user process and operating systems to access the kernel
services. System calls provide this interface.
How System Call Works?
Step 1) The processes executed in the user mode till the time a system call interrupts it.
Step 2) After that, the system call is executed in the kernel-mode on a priority basis.
Step 3) Once system call execution is over, control returns to the user mode.
Step 4) The execution of user processes resumed in Kernel mode.
2. fork()
The fork system call in OS is used by processes to make copies of themselves. By using this
system, the Call parent process can create a child process, and the parent process's execution will
be halted while the child process runs.
3. exec()
When an executable file replaces an earlier executable file within the context of an active
process, this system call is executed. The original process identifier is still present even though a
new process is not created; instead, the new process replaces the old one's stack, data, head, data,
etc.
4. kill()
The OS uses the kill() system call to urge processes to terminate by sending them a signal. A kill
system call can have different meanings and is not always used to end a process.
5. exit()
An exit system call is used when the programme must be stopped. When the exit system call is
used, the resources that the process was using were released.