0% found this document useful (0 votes)
22 views58 pages

Operating System: Prepared By: Prof. Sayalee Narkhede ©

This document provides an overview of operating systems, including definitions, structures, and concepts. It begins by defining an operating system as software that acts as an interface between computer hardware and users. It describes the differences between system software and application software. It outlines the objectives and functions of operating systems, including user interface, program execution, process management, I/O management, memory management, error detection, communication, accounting, and protection/security. It discusses the evolution of operating systems through four generations and describes common operating system structures like monolithic and layered architectures.

Uploaded by

kartikpatil0211
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)
22 views58 pages

Operating System: Prepared By: Prof. Sayalee Narkhede ©

This document provides an overview of operating systems, including definitions, structures, and concepts. It begins by defining an operating system as software that acts as an interface between computer hardware and users. It describes the differences between system software and application software. It outlines the objectives and functions of operating systems, including user interface, program execution, process management, I/O management, memory management, error detection, communication, accounting, and protection/security. It discusses the evolution of operating systems through four generations and describes common operating system structures like monolithic and layered architectures.

Uploaded by

kartikpatil0211
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
You are on page 1/ 58

Module 1

Operating System
Overview

Prepared By: Prof. Sayalee Narkhede ©


What is Operating System?
System Software VS Application Software
Objectives of Operating System
Functions of Operating System
Evolution of Operating System
Operating System structures
Monolithic Vs. Microkernel
Module 1 Linux
Layers of Linux
Operating System Overview Linux Kernel
Linux Shell
System Calls
How System Calls work?
Types of System calls
Process Control System Calls
File Manipulation System Calls
Information Maintenance System calls
Prepared By: Prof. Sayalee Narkhede ©
WHAT IS OPERATING SYSTEM?
An Operating System is a software that acts as an interface between computer
hardware components and the user

Prepared By: Prof. Sayalee Narkhede ©


SYSTEM SOFTWARE VS APPLICATION SOFTWARE

System Software is a set of programs that control System Software is a computer program
and manage the operations of computer hardware that performs specific task for a user

System Software Application Software

Prepared By: Prof. Sayalee Narkhede ©


SYSTEM SOFTWARE VS APPLICATION SOFTWARE

Prepared By: Prof. Sayalee Narkhede ©


OBJECTIVES OF OPERATING SYSTEM

Convenience • An OS makes a computer more convenient to use

• An OS allows the computer system resources to be used in


Efficiency
an efficient manner

• An OS should be constructed in such a way as to permit


Ability to Evolve the effective development, testing, and introduction of
new system functions without interfering with service

Prepared By: Prof. Sayalee Narkhede ©


FUNCTIONS OF OPERATING SYSTEM
User
Interface
Protection
Program
and
Execution
Security

Process
Accounting
Management
Operatin
g System

Communi I/O
cation Management

Error Memory
Detection Management

Prepared By: Prof. Sayalee Narkhede ©


FUNCTIONS OF OPERATING SYSTEM

1. User Interface

CLI uses text commands GUI uses a pointing device to direct I/0,
choose from menus, and make selections

Prepared By: Prof. Sayalee Narkhede ©


FUNCTIONS OF OPERATING SYSTEM

2. Program Execution

Prepared By: Prof. Sayalee Narkhede ©


FUNCTIONS OF OPERATING SYSTEM

3. Process Management

Prepared By: Prof. Sayalee Narkhede ©


FUNCTIONS OF OPERATING SYSTEM

4. I/O Management

Prepared By: Prof. Sayalee Narkhede ©


FUNCTIONS OF OPERATING SYSTEM

5. Memory Management

Prepared By: Prof. Sayalee Narkhede ©


FUNCTIONS OF OPERATING SYSTEM

6. Error Detection

Prepared By: Prof. Sayalee Narkhede ©


FUNCTIONS OF OPERATING SYSTEM

7. Communication

Prepared By: Prof. Sayalee Narkhede ©


FUNCTIONS OF OPERATING SYSTEM

8. Accounting

Prepared By: Prof. Sayalee Narkhede ©


FUNCTIONS OF OPERATING SYSTEM

9. Protection and Security

Protection
Protection provides a mechanism for controlling access to processes, programs, and user
resources.

Security
Security provides a mechanism to safeguard the system resources and the user resources
from all external users.

Prepared By: Prof. Sayalee Narkhede ©


EVOLUTION OF OPERATING SYSTEM
The evolution of operating system went through four generations:

❖ First Generation

❖ Second Generation

❖ Third Generation

❖ Fourth Generation

Prepared By: Prof. Sayalee Narkhede ©


EVOLUTION OF OPERATING SYSTEM
First Generation (1945 to 1955):

❖ User provide instructions through punch cards, magnetic tape

❖ Run one job at a time

❖ No operating system is used

❖ Serial processing

❖ Drawback:

Less speed and more errors

Prepared By: Prof. Sayalee Narkhede ©


EVOLUTION OF OPERATING SYSTEM
Second Generation (1955 to 1965):

❖ Batch operating system was used

❖ Jobs consist of program instructions, input data and control instructions

❖ Jobs were prepared using punch cards

❖ Jobs were grouped based on similar requirements into batches by operator

❖ Drawback:

No priority to jobs was given

CPU remained idle when I/O operations were carried out

Prepared By: Prof. Sayalee Narkhede ©


EVOLUTION OF OPERATING SYSTEM

Third Generation (1965 to 1980):

❖ Multiprogramming operating system was used

❖ Serves more than one user at a time

❖ User communicates with operating system

using Command Line Interface (CLI)

Prepared By: Prof. Sayalee Narkhede ©


EVOLUTION OF OPERATING SYSTEM

Fourth Generation (1980 onwards):

❖ Multitasking / time sharing operating system is used

❖ Modern operating system: Windows, Linux, MacOS

❖ User communicates with operating system using

Graphical User Interface (GUI)

Prepared By: Prof. Sayalee Narkhede ©


EVOLUTION OF OPERATING SYSTEM

Prepared By: Prof. Sayalee Narkhede ©


OPERATING SYSTEM STRUCTURES
1. Simple Structures

❖ Do not have well defined structure


❖ MS-DOS – written to provide the most
functionality in the least space
❖ The interfaces and levels of functionality are not
well separated leaving MS-DOS vulnerable to
malicious programs
❖ If one user program fails, the entire operating
system gets crashed

Prepared By: Prof. Sayalee Narkhede ©


OPERATING SYSTEM STRUCTURES
1. Simple Structures

Advantages
1.It provides superior application performance due to the limited interfaces between the
application program and the hardware.
2.It is simple for kernel developers to create such an operating system.

Disadvantages
1.The structure is quite complex because there are no apparent boundaries between modules.
2.It does not impose data concealment in the operating system.

Prepared By: Prof. Sayalee Narkhede ©


OPERATING SYSTEM STRUCTURES
2. Monolithic Structure

❖ The kernel acts as a manager by managing all


things like file management, memory
management, device management, and
operational processes of the Operating System
❖ The monolithic kernel acts as a virtual machine
that controls all hardware parts
❖ If any service fails in the monolithic kernel, it
leads to the failure of the entire system
❖ The entire operating system needs to be
modified by the user to add any new service

Prepared By: Prof. Sayalee Narkhede ©


OPERATING SYSTEM STRUCTURES
2. Monolithic Structure

Advantages:
❖ The execution of the monolithic kernel is quite fast as the services such as memory
management, file management, process scheduling, etc., are implemented under the same
address space.
❖ A process runs completely in single address space in the monolithic kernel.
❖ The monolithic kernel is a static single binary file.

Disadvantages:
❖ If any service fails in the monolithic kernel, it leads to the failure of the entire system.
❖ The entire operating system needs to be modified by the user to add any new service.

Prepared By: Prof. Sayalee Narkhede ©


OPERATING SYSTEM STRUCTURES
3. Layered Architecture

❖ The operating system is divided into number of layers


❖ The hardware is on the bottom layer (layer 0), while the user
interface is on the top layer (layer N)
❖ Layers are arranged in hierarchical way in which the top-level
layers use the functionalities of their lower-level levels
❖ Functionalities are isolated and abstraction is provided
❖ Less efficient, as a request for service from a higher layer has
to filter through all lower layers before it reaches the HW,
possibly with significant processing at each step

Prepared By: Prof. Sayalee Narkhede ©


OPERATING SYSTEM STRUCTURES
3. Layered Architecture

Prepared By: Prof. Sayalee Narkhede ©


OPERATING SYSTEM STRUCTURES
3. Layered Architecture

Advantages:
❖ Modularity: This design promotes modularity as each layer performs only the tasks it is scheduled to
perform.
❖ Easy debugging: As the layers are discrete so it is very easy to debug
❖ Easy update: A modification made in a particular layer will not affect the other layers.
❖ No direct access to hardware: The hardware layer is the innermost layer present in the design. So a
user can use the services of hardware but cannot directly modify or access it, unlike the Simple system
in which the user had direct access to the hardware.
❖ Abstraction: Every layer is concerned with its functions. So the functions and implementations of the
other layers are abstract to it.

Prepared By: Prof. Sayalee Narkhede ©


OPERATING SYSTEM STRUCTURES
3. Layered Architecture

Disadvantages:
❖ Complex and careful implementation: As a layer can access the services of the layers below it, so the
arrangement of the layers must be done carefully
❖ Slower in execution: If a layer wants to interact with another layer, it requests to travel through all the
layers present between the two interacting layers
❖ Functionality: It is not always possible to divide the functionalities
❖ Communication: No communication between non-adjacent layers.

Prepared By: Prof. Sayalee Narkhede ©


OPERATING SYSTEM STRUCTURES
4. Microkernels

❖ Removes all non-essential components of


the kernel and these non-essential
components of kernels are implemented as
systems and user programs
❖ All new services are added to user space
and consequently do not require
modification of the kernel

Prepared By: Prof. Sayalee Narkhede ©


OPERATING SYSTEM STRUCTURES
4. Microkernels
Advantages
1.Microkernels are secure since only those parts are added, which might disturb the system's functionality.
2.Microkernels are modular, and the various modules may be swapped, reloaded, and modified without
affecting the kernel.
3.Microkernel architecture is compact and isolated, so it may perform better.
4.The system expansion is more accessible, so it may be introduced to the system application without
disrupting the kernel.
5.When compared to monolithic systems, microkernels have fewer system crashes. Furthermore, due to the
modular structure of microkernels, any crashes that do occur are simply handled.
6.The microkernel interface helps in enforcing a more modular system structure.
7.Server failure is treated the same as any other user program failure.
8.It adds new features without recompiling.

Prepared By: Prof. Sayalee Narkhede ©


OPERATING SYSTEM STRUCTURES
4. Microkernels

Disadvantages
1.When the drivers are implemented as procedures, a context switch or a function call is needed.
2.In a microkernel system, providing services are more costly than in a traditional monolithic system.
3.The performance of a microkernel system might be indifferent and cause issues.

Prepared By: Prof. Sayalee Narkhede ©


MONOLITHIC VS MICROKERNEL

Prepared By: Prof. Sayalee Narkhede ©


MONOLITHIC VS MICROKERNEL

Prepared By: Prof. Sayalee Narkhede ©


LINUX
❖ Linux is an open source operating system
❖ Developed by Linus Torvalds in 1991
❖ Idea behind development of Linux was to improve the UNIX OS
❖ Created for personal computers and used in other machines like mainframe computers,
supercomputers, servers, etc
❖ Also used in embedded systems like automation controls, routers, televisions, digital video
recorders, video game consoles, etc
❖ Designed mainly for the (CLI) command-line interface, but graphical environment is provided
using GNOME or KDE Desktop environment

Prepared By: Prof. Sayalee Narkhede ©


LINUX

Prepared By: Prof. Sayalee Narkhede ©


LAYERS OF LINUX

Prepared By: Prof. Sayalee Narkhede ©


LINUX KERNEL
❖ Linux kernel is a free, open-source, monolithic, modular, Unix-like operating system kernel
❖ The kernel is a core part of the Linux operating system that connects the system hardware to the
application software

Responsibilities of Linux Kernel:


❖ Device Management:
A kernel stores all the data related to all the devices in the device driver
It also manages communication between all the devices
❖ Process Management
Determine which processes can use the central processing unit (CPU), when, and for how long
❖ Memory Management
The kernel keeps track of used and unused memory and makes sure that processes shouldn't
manipulate data of each other using virtual memory addresses
❖ Handling System calls and Security
A programmer can write a query or ask the kernel to perform a task

Prepared By: Prof. Sayalee Narkhede ©


LINUX SHELL
❖ The shell is a program that runs other programs
❖ It is a command interpreter that executes commands read from the user with a few input data

Prepared By: Prof. Sayalee Narkhede ©


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
❖ 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

Prepared By: Prof. Sayalee Narkhede ©


HOW SYSTEM CALLS WORK?
Need of the system calls:
❖ To read and write from files.
❖ To create or delete files.
❖ To create and manage new processes.
❖ To send and receive packets, through network connections.
❖ To access hardware devices.

Prepared By: Prof. Sayalee Narkhede ©


TYPES OF SYSTEM CALLS

Prepared By: Prof. Sayalee Narkhede ©


TYPES OF SYSTEM CALLS

Prepared By: Prof. Sayalee Narkhede ©


PROCESS CONTROL SYSTEM CALLS
fork()
❖ Used to create a new process called as child process
❖ Child and parent process runs concurrently
❖ A child process uses the same pc(program counter), same CPU registers, same
open files which use in the parent process
❖ It returns process ID and does not take any parameter
❖ Return value:
Negative Value: creation of a child process was unsuccessful.
Zero: Returned to the newly created child process.
Positive value: Returns process ID of child process to parent process

❖ Syntax:
pid_t fork(void);

Prepared By: Prof. Sayalee Narkhede ©


PROCESS CONTROL SYSTEM CALLS
fork()

❖ fork() is defined in <unistd.h> header file


❖ Type pid_t is defined in <sys/types.h>

Prepared By: Prof. Sayalee Narkhede ©


PROCESS CONTROL SYSTEM CALLS
fork()

Prepared By: Prof. Sayalee Narkhede ©


PROCESS CONTROL SYSTEM CALLS

exit()

❖ Terminates a process and returns status value to parent


❖ Resources are returned to the operating system after termination of process
❖ Status value:
Integer between 0 to 255
status value is returned to the parent via wait()
0 Exit status: Process didn’t encounter any problem
Non-zero value: Process exited with some problem

❖ Syntax:
void exit ( int status );

Prepared By: Prof. Sayalee Narkhede ©


PROCESS CONTROL SYSTEM CALLS
wait()

❖ A call to wait() blocks the calling process until one of its child
processes exits or a signal is received
❖ After child process terminates, parent continues its execution
❖ wait() takes the address of an integer variable and returns
the process ID of the completed process
❖ Child process may terminate due to:
It calls exit();
It returns (an int) from main
It receives a signal (from the OS or another process)
whose default action is to terminate

Prepared By: Prof. Sayalee Narkhede ©


FILE MANUPULATION SYSTEM CALLS
open()

❖ Open a file specified in a path

File that you want to


Mode in which to Access permissions
open for reading or
open file for the user
writing

int open(const char *pathname, int flags, [mode_t mode]);

❖ Return Value:
Returns a file descriptor – positive integer value greater than 2
Returns -1 if failed to open a file

Prepared By: Prof. Sayalee Narkhede ©


FILE MANUPULATION SYSTEM CALLS
open()
❖ <fcntl.h> header file is used for this system call and flags used in it
File Descriptor:
0 – Standard input
1 – Standard output
2 - Standard error
Flags:
O_RDONLY : Read only mode
O_WRONLY : Write only mode
O_RDWR : Read and write mode
O_CREAT : Create file if done not exists
O_APPEND : Append mode
O_EXCL : Prevent creation if file exists

Prepared By: Prof. Sayalee Narkhede ©


FILE MANUPULATION SYSTEM CALLS
read()
❖ Read from a file descriptor
❖ Read number of bytes into memory area pointed by buffer
❖ Returns number of bytes read from a file

File descriptor from Buffer where read Number of bytes to


where to read a data data will be saved read

size_t read(int fd, void *buff, size_t cnt);

❖ If fd = 0 then it reads input typed by user through keyboard


❖ <unistd.h> header file is required to use read() system call

Prepared By: Prof. Sayalee Narkhede ©


FILE MANUPULATION SYSTEM CALLS
write()
❖ Write to a file descriptor
❖ Returns number of bytes written to a file

File descriptor where Buffer where data to Number of bytes to


to write a data be written is saved write

size_t write(int fd, const void *buff, size_t cnt);

❖ If fd = 1 then it prints output on the screen


❖ <unistd.h> header file is required to use write() system call

Prepared By: Prof. Sayalee Narkhede ©


FILE MANUPULATION SYSTEM CALLS
close()

❖ Close a file descriptor


File descriptor to
❖ Close a file pointed by a file descriptor
close

❖ Return Value:
0 : on successful closing of a file int close(int fd);
-1 : if error exists while closing a file

❖ It destroys file table entry returned by fd


❖ <unistd.h> header file is required to use close() system call

Prepared By: Prof. Sayalee Narkhede ©


FILE MANUPULATION SYSTEM CALLS
lseek()
❖ Reposition read/write file offset
❖ Changes position of read/write pointer in a file

File descriptor of a How much to move a Reference point of a


file pointer movement

off_t lseek(int fd, off_t offset, int whence);


❖ Reference pointer:
SEEK_SET: Set pointer to the beginning of the file
SEEK_CUR: Set pointer to the current position
SEEK_END: Set pointer to the end of the file

Prepared By: Prof. Sayalee Narkhede ©


FILE MANUPULATION SYSTEM CALLS
lseek()
❖ Returns the position of a pointer measured in bytes from the beginning of the file

❖ Example:
File Content: “1234567890”
Update it to: “12345hello”

Reposition pointer after 5 then start writing hello

Prepared By: Prof. Sayalee Narkhede ©


INFORMATION MAINTAINANCE SYSTEM CALLS
getpid()

❖ Returns the process ID of the calling process

❖ Syntax:
pid_t getpid(void);

❖ Return type:
returns the process ID of the current process
It never throws any error therefore is always successful

❖ <unistd.h> header file is required to use getpid() system call

Prepared By: Prof. Sayalee Narkhede ©


INFORMATION MAINTAINANCE SYSTEM CALLS
getppid()

❖ returns the process ID of the parent of the calling process

❖ Syntax:
pid_t getppid(void);

❖ Return type:
returns the process ID of the parent of the current process
It never throws any error therefore is always successful

❖ <unistd.h> header file is required to use getppid() system call

Prepared By: Prof. Sayalee Narkhede ©

You might also like