0% found this document useful (0 votes)
7 views49 pages

Module 1. Operating System Overview

The document provides an overview of operating systems, detailing their functions, structures, and types. It explains the role of an operating system as an intermediary between users and hardware, managing resources, processes, and security. Additionally, it covers the booting process, objectives of operating systems, and various types including batch, time-sharing, and real-time operating systems.

Uploaded by

tomioka.giyu2716
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views49 pages

Module 1. Operating System Overview

The document provides an overview of operating systems, detailing their functions, structures, and types. It explains the role of an operating system as an intermediary between users and hardware, managing resources, processes, and security. Additionally, it covers the booting process, objectives of operating systems, and various types including batch, time-sharing, and real-time operating systems.

Uploaded by

tomioka.giyu2716
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

VASANTDADA PATIL PRATISHTHAN’SCOLLEGE OF ENGINEERING & VISUAL ARTS, SION, MUMBAI - 22

DEPARTMENT OF COMPUTER ENGINEERING

“Operating System”
Course Code: 2114113

S.E. | Div A & B | Sem. IV | Computer Engineering

Module 1: Operating System Overview

By Prof. P. M. Mangeopale
Module 1.
Fundamentals of Operating System
• Contents
• Introduction of Operating Systems: System Boot,
• Objectives of Operating System
• Functions of Operating System,
• Operating System Structure and Operations,
• Operating System Services,
• Multiprogramming, Multitasking, Multithreading,
• Types of Operating System,
• Types of System Calls.
1.1 A. Introduction
 An Operating System is system software which manages, operates and
communicates with the computer hardware and software.

 It acts as an intermediary/interface between


the user of a computer and computer
hardware.
 To complete an execution, a user program
requires many resources. Thus, the main job
of an operating system is to provide resources
and services to user programs. Without an
O.S., a computer would be useless.

Examples of O.S.

 It also controls and monitors the execution of all other programs that reside
in the computer, which includes application programs and other system
software of the computer.
Introduction
• What is an Operating System?
• An Operating System is a System software that manages all the
resources of the computing device.
• Acts as an interface between the software and different parts of the
computer or the computer hardware.
• Manages the overall resources and operations of the computer.
• Controls and monitors the execution of all other programs that reside
in the computer, which also includes application programs and other
system software of the computer.
• Examples of Operating Systems are Windows, Linux, macOS,
Android, iOS, etc.
System Booting

• When a computer or any other computing device is in a powerless state, its


operating system remains stored in secondary storage like a hard disk or SSD. But,
when the computer is started, the operating system must be present in the main
memory or RAM of the system in order to perform all the functioning.
• the process by which a computer starts up, initializing its hardware components and
launching its operating system (OS) from the computer's storage into its working
memory is called booting.
• Power button ON computer system,
• all the devices get the power and they are initialized.
• Initially RAM is empty
• small set of instructions present in the non-volatile memory called ROM passed to
the CPU and the execution of instructions takes place
• check all the hardware connected with the system.
• If there are any problems with the hardware, we will get the alert by beep sounds or
even on-screen messages.
• After the testing of the hardware is completed, the booting process continues and
loads the operating system.
Modern Computer System
Modern Computer System
Steps in the Booting Process
[Link] of BIOS: The small set of
instructions present in the ROM is loaded
into the computer memory and the CPU
executes those instructions.
[Link]-On Self Test (POST): In order to
check the operability of all the hardware
connected to our computer system, BIOS
carries out POST which will check the
hardware components and if any problem is
found user is alerted with POST beeps and
POST screen messaged.
[Link] of Operating System:
the bootable sequence present
in CMOS is read by BIOS.
it will search for Master Boot Record
[Link] Configuration is Accomplished: After the OS (MBR) in bootable devices like floppy
is loaded, device drivers are loaded into the memory so disk, CD-ROM, and hard disk.
that our devices can function correctly. If MBR is not found in any of them, the
[Link] Utilities are Loaded: System utilities like system will halt by displaying “No Boot
antivirus, volume control, etc. are loaded into the Device Found”.
memory in this step if MBR is found, the BIOS will load the
[Link] Authentication: on receiving the correct special application program called Boot
credentials the computer system will run GUI shell (in Loader, which will eventually load the
most cases) or CLI shell. Operating system.
Computer System Structure

• Computer system can be divided into four components:


– Hardware – provides basic computing resources
• CPU, memory, I/O devices
– Operating system
• Controls and coordinates use of hardware among various
applications and users
– Application programs – define the ways in which the system
resources are used to solve the computing problems of the
users
• Word processors, compilers, web browsers, database
systems, video games
– Users
• People, machines, other computers
Four Components of a Computer System
What is an Operating System Used for?
• As a platform for Application programs: It provides a platform, on
top of which, other programs, called application programs can run.
• Managing Input-Output unit: It also allows the computer to manage
its own resources such as memory, monitor, keyboard, printer, etc.
• Management of these resources is required for effective and fair
utilization.
• Multitasking: It manages memory and allows multiple programs to
run in their own space and even communicate with each other through
shared memory.
• Manages memory and Files: It manages the computer’s main
memory and second storage. Additionally, it allows and deallocates
memory to all tasks and applications.
• Provides Security: It helps to maintain the system and applications
safe through the authorization process. Thus, the OS provides security
to the system.
Functions of the Operating System
• Resource Management: The operating system manages and allocates
memory, CPU time, and other hardware resources among the various
programs and processes running on the computer.
• Process Management: The operating system is responsible for starting,
stopping, and managing processes and programs. It also controls the
scheduling of processes and allocates resources to them.
• Memory Management: The operating system manages the computer’s
primary memory and provides mechanisms for optimizing memory usage.
• Security: The operating system provides a secure environment for the
user, applications, and data by implementing security policies and
mechanisms such as access controls and encryption.
• Job Accounting: It keeps track of time and resources used by various jobs
or users.
• File Management: The operating system is responsible for organizing and
managing the file system, including the creation, deletion, and
manipulation of files and directories.
• Device Management: The operating system manages input/output devices
such as printers, keyboards, mice, and displays. It provides the necessary
drivers and interfaces to enable communication between the devices and
the computer.
• Networking: The operating system provides networking capabilities such
as establishing and managing network connections, handling network
protocols, and sharing resources such as printers and files over a network.
• User Interface: The operating system provides a user interface that enables
users to interact with the computer system.
• This can be a Graphical User Interface (GUI), a Command-Line Interface
(CLI), or a combination of both.
• Backup and Recovery: The operating system provides mechanisms for
backing up data and recovering it in case of system failures, errors, or
disasters.
• Virtualization: The operating system provides virtualization capabilities
that allow multiple operating systems or applications to run on a single
physical machine. This can enable efficient use of resources and flexibility
in managing workloads.
• Performance Monitoring: The operating system provides tools for
monitoring and optimizing system performance, including identifying
bottlenecks, optimizing resource usage, and analyzing system logs and
metrics.
• Time-Sharing: The operating system enables multiple users to share a
computer system and its resources simultaneously by providing time-
sharing mechanisms that allocate resources fairly and efficiently.
• System Calls: The operating system provides a set of system calls that
enable applications to interact with the operating system and access its
resources. System calls provide a standardized interface between
applications and the operating system, enabling portability and
compatibility across different hardware and software platforms.
• Error-detecting Aids: These contain methods that include the error
messages, and other debugging and error-detecting methods.
Objectives/Goals of OS

• Convenient to use: One of the objectives is to make the computer


system more convenient to use in an efficient manner.
• User Friendly: To make the computer system more interactive with
a more convenient interface for the users.
• Easy Access: To provide easy access to users for using resources by
acting as an intermediary between the hardware and its users.
• Management of Resources: For managing the resources of a
computer in a better and faster way.
• Controls and Monitoring: By keeping track of who is using which
resource, granting resource requests, and mediating conflicting
requests from different programs and users.
• Fair Sharing of Resources: Providing efficient and fair sharing of
resources between the users and programs.
Types of Operating System

• Batch Operating System(1970) It is a type of operating system that does


not interact with the computer directly.
• User gives their jobs in the form of punch card.
• There is an operator who takes similar jobs having the same requirements
and groups them into batches.
• speed up processing
• Advantages:
• Resource Efficiency: Due to use of batches
• High Throughput:
• Cost Efficiency:
• Error Reduction:
• Disadvantages
• Limited functionality: solve only simple tasks not solve more complex
tasks
• Security issues: not more secure because they are not typically used for
day-to-day tasks, so they are not as secure as more common
• Inefficiency: Batch systems are often slow and difficult to use, which can
lead to inefficiency in the workplace.
Multiprogramming in OS

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. This has the below advantages.
Types of Operating System

• Time-sharing Operating System: Time-sharing Operating


System is a type of operating system that allows many users to share
computer resources (maximum utilization of the resources).
• Distributed Operating System:
• Distributed Operating System is a type of operating system that
manages a group of different computers and makes appear to be a
single computer.
• These operating systems are designed to operate on a network of
computers. They allow multiple users to access shared resources and
communicate with each other over the network.
• Examples include Microsoft Windows Server and various
distributions of Linux designed for servers.
• Multiprocessing Operating System: Multiprocessor Operating
Systems are used in operating systems to boost the performance of multiple
CPUs within a single computer system. Multiple CPUs are linked together
so that a job can be divided and executed more quickly.
• Single-User Operating Systems: Single-User Operating Systems are
designed to support a single user at a time. Examples include Microsoft
Windows for personal computers and Apple macOS.
• Multi-User Operating Systems: Multi-User Operating Systems are
designed to support multiple users simultaneously. Examples include Linux
and Unix.
• Embedded Operating Systems: Embedded Operating Systems are
designed to run on devices with limited resources, such as smartphones,
wearable devices, and household appliances. Examples include Google’s
Android and Apple’s iOS.
• Cluster Operating Systems: Cluster Operating Systems are designed to
run on a group of computers, or a cluster, to work together as a single
system. They are used for high-performance computing and for
applications that require high availability and reliability. Examples include
Rocks Cluster Distribution and OpenMPI.
• Network Operating System: Network Operating System is a type of
operating system that runs on a server and provides the capability
to manage data, users, groups, security, applications, and other
networking functions.
• Real-time Operating System: Real-time Operating System is a type
of operating system that serves a real-time system and the time
interval required to process and respond to inputs is very small.
These operating systems are designed to respond to events in real
time.
• They are used in applications that require quick and deterministic
responses, such as embedded systems, industrial control systems,
and robotics.
Evolution of Operating System

Era Key Developments Examples


The first Operating System
1956 was GN-NAA I/O in 1956 by GM-NAA I/O (1956)
Genera; Motors.

IBM developed a time sharing OS/360, DOS/360


1960s
system TSS/360 and TSS/360

Unix popularized simplicity


and multitasking; rise of Unix (1971), CP/M
1970s
personal computers with basic (1974)
OSs.
Era Key Developments Examples
GUI-based OSs gained Apple Macintosh
1980s traction; networking features (1984), Windows
became standard. (1985)
Open-source Linux emerged;
Linux (1991),
1990s GUIs in Windows and Mac
Windows 95 (1995)
OS improved.
Mobile OSs dominated; cloud
2000s- and virtualization iOS (2007), Android
Present technologies advanced (2008)
computing.
Operating System Structure

• An operating system is a design that enables user application


programs to communicate with the hardware of the machine.
• The operating system should be built with the utmost care
because it is such a complicated structure and should be simple
to use and modify.
• Partially developing the operating system is a simple approach
to accomplish this.
• Each of these components needs to have distinct inputs,
outputs, and functionalities.
Operating System Structure

• The OS structure provides an idea of how different components are


connected and integrated within the kernel, which is the central part of the
OS.
• The kernel carries out sensitive tasks such as memory management, process
scheduling, and interaction with hardware.
• Simple Structure
• Monolithic Structure
• Layered Approach Structure
• Micro-Kernel Structure
• Exo-Kernel Structure
• Virtual Machines
• Simple Structure
• It is the most straightforward operating system structure
• There are many operating systems that have a rather simple structure.
• A common example of this is MS-DOS.
Advantages of Simple Structure:
•It is easy to develop as it contains only a few
interfaces and levels.
•It executes faster because there are fewer layers
between the hardware and applications.
•Direct access to hardware provides faster
operations.
•Light in weight hence suitable for small or even
embedded systems.
Disadvantages of Simple Structure:
Frequent System Failures - Being poorly designed,
such a system is not robust. If one program fails,
entires operating system crashses.
Poor Maintainability - As all layers of operating
systems are tightly coupled, change in one layer can
impact other layers heavily and making code
unmanageable over a period of time.
Monolith Structure
• In monolith structured operating system, a central piece of code called kernel is
responsible for all major operations of an operating system.
• Such operations includes file management, memory management, device
management and so on.
• The kernel is the main component of an operating system and it provides all the
services of an operating system to the application programs and system programs.

• The kernel has access to the all the resources and it acts as an interface with
application programs and the underlying hardware.
• A monolithic kernel structure promotes timesharing, multiprogramming model and
was used in old banking systems.
• Advantages
• Easy Development - As kernel is the only layer to develop with all major
functionalities, it is easier to design and develop.
• Performance - As Kernel is responsible for memory management, other operations
and have direct access to the hardware, it performs better.

• Disadvantages
Crash Prone - As Kernel is responsible for all functions, if one function fails
entire operating system fails.
• Difficult to enhance - It is very difficult to add a new service without impacting
other services of a monolith operating system.
Monolith Structure
Micro-Kernel Structure

• As in case monolith structure, there was single kernel, in micro-kernel, we have multiple
kernels each one specilized in particular service.
• Each microkernel is developed independent to the other one and makes system more stable.
• If one kernel fails the operating system will keep working with other kernel's
functionalities.

• Advantages

• Reliable and Stable - As multiple kernels are working simultaneously, chances of failure
of operating system is very less. If one functionlity is down, operating system can still
provide other functionalities using stable kernels.
• Maintainability - Being small sized kernels, code size is maintainable. One can enhance a
microkernel code base without impacting other microkernel code base.

• Disadvantages

• Complex to Design - Such a microkernel based architecture is difficult to design.


• Performance Degradation - Multi kernel, Multi-modular communication may hamper the
performance as compared to monolith architecture.

LAYERED STRUCTURE
• The OS is separated into layers or levels
• Layer 0 (the lowest layer) contains the hardware, and layer 1 (the highest
layer
• The functionalities of each layer are separated in this method, and
abstraction is also an option) contains the user interface (layer N).
• debugging is simpler, therefore all lower-level layers are debugged before
the upper layer is examined.
• As a result, the present layer alone has to be reviewed since all the lower
layers have already been examined.
• For example, memory management may have to rely on process
scheduling, while higher layers use it here with respect to user interaction.
• This approach also introduces abstraction between layers, whereby the
system is also easier to manage and debug. In case any issue arises, testing
and debugging can be performed at lower layers before going onto higher
layers
LAYERED STRUCTURE
• Advantages of Layered Structure:
•Development, maintenance, and understanding are much easier, as every
layer is assigned a specific role.
•It can isolate problems in individual layers because testing and debugging
would be less demanding.
•Sensitive operations can be confined to specific layers; thus, unauthorized
access can be minimized to such layers because the concerns have been
clearly separated.
•Modifying or updating one layer will not affect other independent layers
directly; thus, upgrading or fixing could be done more easily.
•With layers, basic operations can be entrusted to lower layers, and hence, the
layers above need not be concerned with the minute details, thereby reducing
the complexity of the overall management.
• Disadvantages of Layered Structure:
• The layered approach adds delays due to the fact that data and commands
must pass through several layers, thus slowing down the system in
general.
• Layers are generally dependent on lower layers; thus skipping layers and
directly accessing the lower-level functionalities becomes harder, hence
reducing flexibility in many systems.
• System performance optimization becomes challenging due to the extra
abstractions introduced by the layers, which harden the tuning of
individual parts of the system to make them run more effectively.
• Unless the lower-layer design is lousy or inefficient, the whole system will
suffer since the higher layer depends on them for functionality.
Linux Operating System

• Linux is an open-source UNIX-based operating system.


• The main component of the Linux operating system is Linux kernel.
• It is developed to provide low-cost or free operating system service to
personal system users, which includes an X-window system, Emacs editor,
IP/TCP GUI, etc.
• Components of Linux:
• Like any operating system, Linux consists of software, computer programs,
documentation, and hardware.
• The main components of Linux operating system are: Application, Shell,
Kernel, Hardware, Utilities
Linux Operating System Architecture
Kernel:-
The kernel is the core component of the operating
system that manages system resources and provides
services to other programs running on the system.
It acts as a bridge between the user and the resources
of the system .
It is responsible for tasks such as memory
management, process scheduling, and device drivers.
The kernel operates at a lower level than the shell and
interacts directly with the hardware of the computer.
Advantages
Efficient Resource Management
Process Management
Hardware Abstraction
Disadvantages
Limited Flexibility
Dependency on Hardware
• Main Subsystems of kernel:
• Process scheduler: Responsible for fairly distributing the processing time
among all the concurrently running process.
• Memory management unit: This kernel sub unit is responsible for proper
distribution of memory resources among the concurrently running process.
• Virtual file system: This subsystem provides interface to access stored data
across different file system and different physical media.
Shell
• The shell is a command-line interface that allows the user to enter
commands to interact with the operating system.
• It acts as an intermediary between the user and the kernel,
interpreting commands entered by the user and translating them
into instructions that the kernel can execute.
• The shell also provides various features like command history, tab
completion, and scripting capabilities to make it easier for the user
to work with the system.
• Advantages
• Efficient Command Execution
• Scripting capability
• Disadvantages
• Limited Visualization
• Steep Learning Curve
Different types of shell
• Command Line shell:
• Executes the command provided by user given in the form command. A
special program called terminal in executed and the result is displayed in
the terminal itself.
• Graphical User Interface:
• Executes the process provided by user in graphical way and output is
displayed in the graphical window.
Shell Kernel
Shell allows the users to communicate Shell allows the users to communicate
with the kernel. with the kernel.
It is the interface between kernel and user. It is the core of the operating system.
It is a command line interpreter (CLI). Its a low level program interfacing with
the hardware (CPU, RAM, disks) on top
of which applications are running.
Its types are – Bourne Shell, C shell, Korn Its types are – Monolithic Kernel, Micro
Shell, etc. kernel, Hybrid kernel, etc.
It carries out commands on a group of It performs memory management.
files by specifying a pattern to match
Shell commands like ls, mkdir and many It performs process management.
more can be used to request to complete
the specific operation to the OS.
Command-line interface that allows user Core component of the operating system
interaction that manages system resources
Shell Kernel
Interprets and translates user commands Provides services to other programs
running on the system
Acts as an intermediary between the user Operates at a lower level than the shell
and the kernel and interacts with hardware

Provides various features like command responsible for tasks such as memory
history, tab completion, and scripting management, process scheduling, and
capabilities device drivers

Executes commands and programs Enables user and applications to interact


with hardware resources
System call
• A system call is a programmatic way in which a computer program requests a
service from the kernel of the operating system it is executed on.
• A system call is a way for programs to interact with the operating system.
• A computer program makes a system call when it requests the operating
system’s kernel.
• System call provides the services of the operating system to the user programs
via the Application Program Interface(API).
• It provides an interface between a process and an operating system to allow
user-level processes to request services of the operating system.
• System calls are the only entry points into the kernel system.
• All programs needing resources must use system calls.
Features of System Calls
• Interface: System calls provide a well-defined interface between user programs and
the operating system. Programs make requests by calling specific functions, and the
operating system responds by executing the requested service and returning a result.
• Protection: System calls are used to access privileged operations that are not available
to normal user programs. The operating system uses this privilege to protect the system
from malicious or unauthorized access.
• Kernel Mode: When a system call is made, the program is temporarily switched from
user mode to kernel mode. In kernel mode, the program has access to all system
resources, including hardware, memory, and other processes.
• Context Switching: A system call requires a context switch, which involves saving the
state of the current process and switching to the kernel mode to execute the requested
service. This can introduce overhead, which can impact system performance.
• Error Handling: System calls can return error codes to indicate problems with the
requested service. Programs must check for these errors and handle them appropriately.
• Synchronization: System calls can be used to synchronize access to shared resources,
such as files or network connections. The operating system provides synchronization
mechanisms, such as locks or semaphores, to ensure that multiple programs can access
these resources safely.
How does System Call Work?
• Users need special resources: Sometimes programs need to do some
special things that can’t be done without the permission of the OS like
reading from a file, writing to a file, getting any information from the
hardware, or requesting a space in memory.
• The program makes a system call request: There are special predefined
instructions to make a request to the operating system. These instructions
are nothing but just a “system call”. The program uses these system calls in
its code when needed.
• Operating system sees the system call: When the OS sees the system call
then it recognizes that the program needs help at this time so it temporarily
stops the program execution and gives all the control to a special part of
itself called ‘Kernel’. Now ‘Kernel’ solves the need of the program.
• The operating system performs the operations: Now the operating
system performs the operation that is requested by the program. Example:
reading content from a file etc.
• Operating system give control back to the program : After performing
the special operation, OS give control back to the program for further
execution of program .
Examples of a System Call in Windows and Unix
Process Windows Unix
Process Control CreateProcess() Fork()
ExitProcess() Exit()
WaitForSingleObject() Wait()
File manipulation Create File() Open()
Read File() Read()
Write File() Write()
Close()

SetConsoleMode() Ioctl()
Device Management ReadConsole() Read()
WriteConsole() Write()

GetCurrentProcessID() Getpid()
Information Maintenance SetTimer() Alarm()
Sleep() Sleep()

CreatePipe() Pipe()
Communication CreateFileMapping() Shmget()
MapViewOfFile() Mmap()

SetFileSecurity() Chmod()
Protection InitializeSecurityDescriptor() Umask()
• Open(): Accessing a file on a file system is possible with the open() system
call. It gives the file resources it needs and a handle the process can use. A
file can be opened by multiple processes simultaneously or just one
process. Everything is based on the structure and file system.
• Read(): Data from a file on the file system is retrieved using it. In general,
it accepts three arguments:
• A description of a file.
• A buffer for read data storage.
• How many bytes should be read from the file
Before reading, the file to be read could be identified by its file descriptor
and opened using the open() function.
• Wait(): In some systems, a process might need to hold off until another
process has finished running before continuing. When a parent process
creates a child process, the execution of the parent process is halted until
the child process is complete. The parent process is stopped using the
wait() system call. The parent process regains control once the child
process has finished running.
• Write(): Data from a user buffer is written using it to a device like a
file. A program can produce data in one way by using this system
call. generally, there are three arguments:
• A description of a file.
• A reference to the buffer where data is stored.
• The amount of data that will be written from the buffer in bytes.
• Fork(): The fork() system call is used by processes to create copies
of themselves. It is one of the methods used the most frequently in
operating systems to create processes. When a parent process creates
a child process, the parent process’s execution is suspended until the
child process is finished. The parent process regains control once the
child process has finished running.
• Exit(): A system call called exit() is used to terminate a program. In
environments with multiple threads, this call indicates that the
thread execution is finished. After using the exit() system function,
the operating system recovers the resources used by the process.

You might also like