KEMBAR78
Os Notes | PDF | Ios | Operating System
0% found this document useful (0 votes)
22 views29 pages

Os Notes

An operating system (OS) serves as an intermediary between users and computer hardware, managing resources and providing an environment for executing programs efficiently. It encompasses functions such as resource management, process scheduling, memory management, and security, while also facilitating user interaction through various interfaces. The document outlines different types of operating systems, including batch, time-sharing, and distributed systems, along with their advantages and disadvantages.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views29 pages

Os Notes

An operating system (OS) serves as an intermediary between users and computer hardware, managing resources and providing an environment for executing programs efficiently. It encompasses functions such as resource management, process scheduling, memory management, and security, while also facilitating user interaction through various interfaces. The document outlines different types of operating systems, including batch, time-sharing, and distributed systems, along with their advantages and disadvantages.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 29

1

UNIT 1
1.1Introduction of Operating System
An operating system acts as an intermediary between the user of a computer and
computer hardware. The purpose of an operating system is to provide an
environment in which a user can execute programs conveniently and efficiently.
An operating system is a software that manages computer hardware. The hardware
must provide appropriate mechanisms to ensure the correct operation of the
computer system and to prevent user programs from interfering with the proper
operation of the system.
Operating System – 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.
A more common definition is that the operating system is the one program running
at all times on the computer (usually called the kernel), with all else being application
programs.
An operating system is concerned with the allocation of resources and services, such
as memory, processors, devices, and information. The operating system
correspondingly includes programs to manage these resources, such as a traffic
controller, a scheduler, a memory management module, I/O programs, and a file
system.
Functions of Operating system :
Convenience: An OS makes a computer more convenient to use.
Efficiency: An OS allows the computer system resources to be used efficiently.
Ability to Evolve: An OS should be constructed in such a way as to permit the
effective development, testing, and introduction of new system functions at the
same time without interfering with service.
Throughput: An OS should be constructed so that It can give maximum
throughput(Number of tasks per unit time).
Components of Operating System:
2

Resource Management: When parallel accessing happens in the OS means when


multiple users are accessing the system the OS works as Resource Manager, Its
responsibility is to provide hardware to the user. It decreases the load in the system.
Process Management: In a multi-programming environment, the OS decides the
order in which processes have assign to the processor, and how much processing
time each process has. This function of OS is called process scheduling. An Operating
System performs the following activities for processor management.
Keeps track of the status of processes. The program which performs this task is
known as a traffic controller. Allocates the CPU that is a processor to a process. De-
allocates processor when a process is no more required.
It includes various tasks like scheduling, termination of the process. OS manages
various tasks at a time. Here CPU Scheduling happens means all the tasks would be
done by the many algorithms that use for scheduling.
Storage Management: The file system mechanism used for the management of the
storage. NIFS, CFS, CIFS, NFS, etc. are some file systems. All the data stores in various
tracks of Hard disks that all managed by the storage manager. It included Hard Disk.
Memory Management: The operating system manages the Primary Memory or Main
Memory. Main memory is made up of a large array of bytes or words where each
byte or word is assigned a certain address. Main memory is fast storage and it can be
accessed directly by the CPU. For a program to be executed, it should be first loaded
in the main memory. An Operating System performs the following activities for
memory management:
It keeps track of primary memory, i.e., which bytes of memory are used by which
user program. The memory addresses that have already been allocated and the
memory addresses of the memory that has not yet been used. In multiprogramming,
the OS decides the order in which processes are granted access to memory, and for
how long. It Allocates the memory to a process when the process requests it and
deallocates the memory when the process has terminated or is performing an I/O
operation.
Refers to the management of primary memory. The operating system has to keep
track, how much memory has been used and by whom. It has to decide which
process needs memory space and how much. OS also has to allocate and deallocate
the memory space.
3

Security/Privacy Management: Privacy is also provided by the Operating system by


means of passwords so that unauthorized applications can’t access programs or data.
For example, Windows uses Kerberos authentication to prevent unauthorized access
to data. The operating system uses password protection to protect user data and
similar other techniques. it also prevents unauthorized access to programs and user
data.

The process operating system as User Interface:


User
System and application programs
Operating system
Hardware
Every general-purpose computer consists of the hardware, operating system, system
programs, and application programs. The hardware consists of memory, CPU, ALU,
and I/O devices, peripheral devices, and storage devices. System program consists of
compilers, loaders, editors, OS, etc. The application program consists of business
programs, database programs.

fig1: Conceptual view of a computer system


Every computer must have an operating system to run other programs. The
operating system coordinates the use of the hardware among the various system
programs and application programs for various users. It simply provides an
environment within which other programs can do useful work.
The operating system is a set of special programs that run on a computer system that
allows it to work properly. It performs basic tasks such as recognizing input from the
4

keyboard, keeping track of files and directories on the disk, sending output to the
display screen, and controlling peripheral devices.
OS is designed to serve two basic purposes:
It controls the allocation and use of the computing System’s resources among the
various user and tasks.
It provides an interface between the computer hardware and the programmer that
simplifies and makes it feasible for coding, creation, debugging of application
programs.
The Operating system must support the following tasks. The tasks are:
Provides the facilities to create, modification of programs and data files using an
editor.
Access to the compiler for translating the user program from high-level language to
machine language.
Provide a loader program to move the compiled program code to the computer’s
memory for execution.
Provide routines that handle the details of I/O programming.
I/O System Management –
The module that keeps track of the status of devices is called the I/O traffic
controller. Each I/O device has a device handler that resides in a separate process
associated with that device.
The I/O subsystem consists of
A memory Management component that includes buffering caching and spooling.
A general device driver interface.
Drivers for specific hardware devices.
Assembler –
The input to an assembler is an assembly language program. The output is an object
program plus information that enables the loader to prepare the object program for
execution. At one time, the computer programmer had at his disposal a basic
machine that interpreted, through hardware, certain fundamental instructions. He
5

would program this computer by writing a series of ones and Zeros (Machine
language), place them into the memory of the machine.
Compiler –
The High-level languages- examples are FORTRAN, COBOL, ALGOL, and PL/I are
processed by compilers and interpreters. A compiler is a program that accepts a
source program in a “high-level language “and produces a corresponding object
program. An interpreter is a program that appears to execute a source program as if
it was machine language. The same name (FORTRAN, COBOL, etc.) is often used to
designate both a compiler and its associated language.
Loader –
A Loader is a routine that loads an object program and prepares it for execution.
There are various loading schemes: absolute, relocating, and direct-linking. In
general, the loader must load, relocate and link the object program. The loader is a
program that places programs into memory and prepares them for execution. In a
simple loading scheme, the assembler outputs the machine language translation of a
program on a secondary device and a loader places it in the core. The loader places
into memory the machine language version of the user’s program and transfers
control to it. Since the loader program is much smaller than the assembler, those
make more core available to the user’s program.
-----------------------------------------------------------------------------------------------------------------
------------------------------
1.2 Views of os : User view and System view
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. Some attention is also paid to the
performance of the system, but there is no need for the operating system to
worry about resource utilization. This is because the personal computer uses
all the resources available and there is no sharing.
 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
6

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. This happens because the
workstation exclusively uses its own resources but it also needs to share files
etc. with other workstations across 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.
The battery level of the device is also taken into account.
There are some devices that contain very less or no user view because there is no
interaction with the users. Examples are embedded computers in home devices,
automobiles etc.

System View
According to the computer system, the operating system is the bridge between
applications and hardware. It is most intimate with the hardware and is used to
control it as required.The different types of system view for operating system can be
explained as follows:
 The 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. It is the duty of the operating
system to allocate these resources judiciously to the processes so that the
computer system can run as smoothly as possible.
 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
7

the application programs. This is the definition of the operating system that is
generally followed.
1.3 Operating system Operation
Dual mode
An error in one program can adversely effect many processes, it might modify data of
another program, or also can effect the operating system. For example, if a process
stuck in infinite loop then this infinite loop could effect correct operation of other
processes. So to ensure the proper execution of the operating system there are two
modes of operation:
User mode –
When the computer system run user application like creating a text document or
using any application program, then the system is in user mode. When the user
application requests for a service from the operating system or an interrupt occurs or
system call, then there there will be a transition from user to kernel mode to fulfill
the requests.
Note: To switch from kernel mode to user mode, mode bit should be 1.
Given below image describes what happen interrupt occurs:

Kernel Mode –
When system boots then hardware starts in kernel mode and when operating system
is loaded then it start user application in user mode. To provide protection to the
hardware, we have privileged instructions which execute only in kernel mode. If user
attempt to run privileged instruction in user mode then it will treat instruction as
illegal and traps to OS. Some of the privileged instructions are:
1.Handling Interrupt
8

2.To switch from user mode to kernel mode.


3.Input Output management.
Note: To switch from user mode to kernel mode mode bit should be 0.
The dual mode of operation provides us with the means for protecting the
operating system from errant users—and errant users from one another.

We accomplish this protection by designating some of the machine


instructions that may cause harm as privileged instructions. The hardware
allows privileged instructions to be executed only in kernel mode. If an attempt
is made to execute a privileged instruction in user mode, the hardware does
not execute the instruction but rather treats it as illegal and traps it to the
operating system. The instruction to switch to user mode is an example of a
privileged instruction. Some other examples include I/O control, timer
management, and interrupt management. As we shall see throughout the text,
there are many additional privileged instructions.

Timer
We must ensure that the operating system maintains control over the CPU. We must
prevent a user program from getting stuck in an infinite loop or not calling system
services and never returning control to the operating system. To accomplish this goal,
we can use a timer. A timer can be set to interrupt the computer after a specified
period. The period may be fixed (for example, 1/60 second) or variable (for example,
from 1 millisecond to 1 second). A variable timer is generally implemented by a fixed-
rate clock and a counter.
The operating system sets the counter. Every time the clock ticks, the counter is
decremented. When the counter reaches 0, an interrupt occurs. For instance, a 10-bit
counter with a 1-millisecond clock allows interrupts at intervals from 1 millisecond to
1,024 milliseconds, in steps of 1 millisecond. Before turning over control to the user,
the operating system ensures that the timer is set to interrupt. If the timer interrupts,
control transfers automatically to the operating system, which may treat the
interrupt as a fatal error or may give the program more time. Clearly, instructions
that modify the content of the timer are privileged. Thus, we can use the timer to
prevent a user program from running too long. A simple technique is to initialize a
9

counter with the amount of time that a program is allowed to run. A program with a
7-minute time limit, for example, would have its counter initialized to 420.
Every second, the timer interrupts and the counter is decremented by 1. As long as
the counter is positive, control is returned to the user program. When the counter
becomes negative, the operating system terminates the program for exceeding the
assigned time limit.
1.4 Special Purpose system
1. Batch Operating System –
This type of operating system does not interact with the computer directly. There is
an operator which takes similar jobs having the same requirement and group them
into batches. It is the responsibility of the operator to sort jobs with similar needs.

Advantages of Batch Operating System:


It is very difficult to guess or know the time required for any job to complete.
Processors of the batch systems know how long the job would be when it is in queue
 Multiple users can share the batch systems
 The idle time for the batch system is very less
 It is easy to manage large work repeatedly in batch systems
Disadvantages of Batch Operating System:
 The computer operators should be well known with batch systems
 Batch systems are hard to debug
 It is sometimes costly
 The other jobs will have to wait for an unknown time if any job fails Examples
of Batch based Operating System: Payroll System, Bank Statements, etc.
10

2. Time-Sharing Operating Systems –


Each task is given some time to execute so that all the tasks work smoothly. Each
user gets the time of CPU as they use a single system. These systems are also known
as Multitasking Systems. The task can be from a single user or different users also.
The time that each task gets to execute is called quantum. After this time interval is
over OS switches over to the next task.

Advantages of Time-Sharing OS:


 Each task gets an equal opportunity
 Fewer chances of duplication of software
 CPU idle time can be reduced
Disadvantages of Time-Sharing OS:
 Reliability problem
 One must have to take care of the security and integrity of user programs and
data
 Data communication problem
Examples of Time-Sharing OSs are: Multics, Unix, etc.
3. Distributed Operating System –
These types of the operating system is a recent advancement in the world of
computer technology and are being widely accepted all over the world and, that too,
with a great pace. Various autonomous interconnected computers communicate
with each other using a shared communication network. Independent systems
possess their own memory unit and CPU. These are referred to as loosely coupled
systems or distributed systems. These system’s processors differ in size and function.
11

The major benefit of working with these types of the operating system is that it is
always possible that one user can access the files or software which are not actually
present on his system but some other system connected within this network i.e.,
remote access is enabled within the devices connected in that network.

Advantages of Distributed Operating 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
Disadvantages of Distributed Operating System:
 Failure of the main network will stop the entire communication
 To establish distributed systems the language which is used are not well
defined yet
 These types of systems are not readily available as they are very expensive.
Not only that the underlying software is highly complex and not understood
well yet
12

Examples of Distributed Operating System are- LOCUS, etc.


4. Real-Time Operating System –
These types of OSs serve 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.
Two types of Real-Time Operating System which are as follows:
Hard Real-Time Systems:
These OSs are meant for applications where time constraints are very strict and even
the shortest possible delay is not acceptable. These systems are built for saving life
like automatic parachutes or airbags which are required to be readily available in
case of any accident. Virtual memory is rarely found in these systems.
Soft Real-Time Systems:
These OSs are for applications where for time-constraint is less strict.

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.
13

 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.
4.Mobile OS
Android
Android is a mobile operating system which is successfully developed by Google. The
Android OS is based on Linux operating system and open source operating system
which is specially developed for touchscreen mobile devices like tablet, smartphones,
AndroidTv, wear OS, etc. Android os is written in java. Android brought a drastic
change in the mobile technology.
Evolution of Android: Originally android is developed by Android Inc. and in 2007
Google brought android.
Examples:
Android 1.0: Name-unnamed, Year-2008
Android 6.0: Name-Marshmallow, Year-2015
Android 7.0: Name-Nougat, Year-2016
14

Android 8.0: Name-Oreo, Year-2017


Android 9.0: Name-Pie, Year-2018
Features Of Android: Basic features of hardware is divided into two parts:
Hardware based features: Audio, Bluetooth, GSM, Microphone, NFC, and sensors.
Software based features:app widgets, home screen, input method, live wallpapers,
layout, storage, messaging, multi-language support, browser, Java support, media
support, multi-touch, calls, multitasking, accessibility, external storage, video calling,
optimized graphics, etc.
Advantages Of Android:

 Android can be built by anyone because it is based on Linux open source.


 Android phones are multitasking, you can perform multiple tasks at the same
time. For example, while listening to music you can chat with your friend.
 Android provides app market known as Play Store. From the play store, you
can download and install different types of apps in your mobile phones.
 Android provides a notification facility. Whenever new message comes, an
email arrived on the phone it automatically shows on the home screen of the
phone.
 Android provides a widget. With the help of a widgets, you can easily change
or access an app.
Disadvantages of Android:

 Most of the apps and features of android required an active internet


connection. Without the active internet connection, you cannot access them.
 In android OS the wastage of battery is more due to the background
processing.
 Many of the android application contains virus, for example counter strike
ground force was supposed to have virus.
 Android system is not safe as iOS.
iOS
iOS(iPhone OS) is a mobile operating system which is successfully designed and
developed by the Apple Inc. iOS is the largest used mobile operating system after
15

Android. It is basically designed for iPhone, iPad, and iPod Touch. In terms of security,
iOS is more secure than Android. The iOS interface depends upon the direct
manipulation by using touch gestures. Evolution of iOS: The concept of iPhone was
innovated by the Steve Jobs in 2005The latest version of iOS is 11 and it is available
for iPhone 5S, iPad Pro, iPad Mini2 and sixth generation iPod Touch.
Examples
iPhone OS 1:Year-2007
iPhone OS 2:Year-2008
iPhone OS 3:Year-2009
iOS 4:Year-2010
iOS 5:Year-2011
iOS 10:Year-2016
iOS 11:Year-2017
Features Of iOS: iOS contains home screen, touchID for apps, icloud drive, health,
Siri(personal assistant), Safari(browser), multitasking, message, interactive
notification, camera, icloud photo library, game center, bluetooth, calls, accessibility,
voice recognition, face recognition, battery usage indicator, Wi-Fi etc.
Advantages Of iOS:
 In terms of performance iOS is magnificent and smooth.
 iOS generate less heat while processing as compare to Android.
 iOS are best for gaming and business purposes.
 iOS provides excellent security.
 It provides Jailbreaking for customization.
 It provides good face recognition security.
Disadvantages of iOS:
 iOS is depends upon iOS devices.
 iOS is not an open source.
 The price of iOS devices are very high.
 The cost of iOS apps are very high.
 iOS devices supports only single SIM.
 iOS applications are larger in size as compared to other mobile platforms.
16

1.5 Open source operating system :


Linux
Linux is a community of open-source Unix like operating systems that are based on
the Linux Kernel. It was initially released by Linus Torvalds on September 17, 1991. It
is a free and open-source operating system and the source code can be modified and
distributed to anyone commercially or noncommercially under the GNU General
Public License. Initially, Linux was created for personal computers and gradually it
was used in other machines like servers, mainframe computers, supercomputers, etc.
Nowadays, Linux is also used in embedded systems like routers, automation controls,
televisions, digital video recorders, video game consoles, smartwatches, etc. The
biggest success of Linux is Android(operating system) it is based on the Linux kernel
that is running on smartphones and tablets. Due to android Linux has the largest
installed base of all general-purpose operating systems. Linux is generally packaged
in a Linux distribution.

Linux architecture:
Advantages of Linux
 The main advantage of Linux, is it is an open-source operating system. This
means the source code is easily available for everyone and you are allowed to
contribute, modify and distribute the code to anyone without any permissions.
 In terms of security, Linux is more secure than any other operating system. It
does not mean that Linux is 100 percent secure it has some malware for it but
is less vulnerable than any other operating system. So, it does not require any
anti-virus software.
 The software updates in Linux are easy and frequent.
17

 Various Linux distributions are available so that you can use them according to
your requirements or according to your taste.
 Linux is freely available to use on the internet.
 It has large community support.
 It provides high stability. It rarely slows down or freezes and there is no need
to reboot it after a short time.
 It maintain the privacy of the user.
 The performance of the Linux system is much higher than other operating
systems. It allows a large number of people to work at the same time and it
handles them efficiently.
 It is network friendly.
 The flexibility of Linux is high. There is no need to install a complete Linux suit;
you are allowed to install only required components.
 Linux is compatible with a large number of file formats.
 It is fast and easy to install from the web. It can also install on any hardware
even on your old computer system.
 It performs all tasks properly even if it has limited space on the hard disk.
Disadvantages of Linux
 It is not very user-friendly. So, it may be confusing for beginners.
 It has small peripheral hardware drivers as compared to windows.

BSD
BSD refers to the Berkeley Software Distribution OS. The BSD OS is a Unix-based OS.
The pure BSD OS was officially supported from 1977 to 1995. It passed through four
major forms and various revisions of each over that time. Although the original BSD
operating system is no longer in use, the underlying BSD model lives on in various
forms. Later versions of BSD and any operating systems based on it no longer adhere
to the basic UNIX standards, and they are officially classified as Unix-like operating
systems.
Here, you will learn about all BSD-based operating systems. These BSD based
operating systems are as follows
 FreeBSD Operating System
 OpenBSD Operating System
 NetBSD Operating System
18

 DragonFly BSD Operating System


 GhostBSD Operating System
 MidnightBSD Operating System
 NomadBSD Operating System

Unix
UNIX is a powerful Operating System initially developed by Ken Thompson, Dennis
Ritchie at AT&T Bell laboratories in 1970. It is prevalent among scientific, engineering,
and academic institutions due to its most appreciative features like multitasking,
flexibility, and many more. In UNIX, the file system is a hierarchical structure of files
and directories where users can store and retrieve information using the files.
19

Architecture of unix
================================================================
==================

UNIT2

1.1 Different Services of Operating System


1.User Interface
Almost all operating system have a user interface (ui).Two fundamentals
approaches for users to interface with the operating system are command line
interface and graphical user interface or GUI. Command interpreter executes next
user_specified command.A GUI provides a mouse based window and menu
system as an interface.
2.Program execution
Operating systems handle many kinds of activities from user programs to system
programs like printer spooler, name servers, file server, etc. Each of these
activities is encapsulated as a process.
20

A process includes the complete execution context (code to execute, data to


manipulate, registers, OS resources in use). Following are the major activities of
an operating system with respect to program management −
 Loads a program into memory.
 Executes the program.
 Handles program's execution.
 Provides a mechanism for process synchronization.
 Provides a mechanism for process communication.
 Provides a mechanism for deadlock handling.

3. I/O Operation
An I/O subsystem comprises of I/O devices and their corresponding driver
software. Drivers hide the peculiarities of specific hardware devices from the
users.

An Operating System manages the communication between user and device


drivers.

 I/O operation means read or write operation with any file or any specific
I/O device.
 Operating system provides the access to the required I/O device when
required.

4. File system manipulation


A file represents a collection of related information. Computers can store files on
the disk (secondary storage), for long-term storage purpose. Examples of storage
media include magnetic tape, magnetic disk and optical disk drives like CD, DVD.
Each of these media has its own properties like speed, capacity, data transfer rate
and data access methods.

A file system is normally organized into directories for easy navigation and usage.
These directories may contain files and other directions. Following are the major
activities of an operating system with respect to file management −

Program needs to read a file or write a file.


 The operating system gives the permission to the program for operation on
file.
21

 Permission varies from read-only, read-write, denied and so on.


 Operating System provides an interface to the user to create/delete files.
 Operating System provides an interface to the user to create/delete
directories.
 Operating System provides an interface to create the backup of file system.
5.Communication
In case of distributed systems which are a collection of processors that do not
share memory, peripheral devices, or a clock, the operating system manages
communications between all the processes. Multiple processes communicate
with one another through communication lines in the network.

The OS handles routing and connection strategies, and the problems of


contention and security. Following are the major activities of an operating system
with respect to communication −

 Two processes often require data to be transferred between them


 Both the processes can be on one computer or on different computers, but
are connected through a computer network.
 Communication may be implemented by two methods, either by Shared
Memory or by Message Passing.
6.Error handling
Errors can occur anytime and anywhere. An error may occur in CPU, in I/O
devices or in the memory hardware. Following are the major activities of an
operating system with respect to error handling −

 The OS constantly checks for possible errors.


 The OS takes an appropriate action to ensure correct and consistent
computing.
1.2 System Call
Intro
In computing, a system call is the 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 makes a request to the operating
system’s kernel. System call provides the services of the operating system to the
user programs via Application Program Interface(API). It provides an interface
between a process and operating system to allow user-level processes to request
22

services of the operating system. System calls are the only entry points into the
kernel system. All programs needing resources must use system calls.

Services Provided by System Calls :


1) Process creation and management
2) Main memory management
3) File Access, Directory and File system management
4) Device handling(I/O)
5) Protection
6) Networking, etc.

1. Initially, a processor executes a user program in the user mode.


2. Then if the program needs the services of the operating system the processor
is interrupted by the system call.
3. A system call is always prioritized over the other executions and the system call
is then executed in the kernel mode.
4. Once the system call is executed completely the control goes back to the user
mode.
5. And the execution of the program resumes back in the user mode.

Types of System Calls : There are 5 different categories of system calls –


23

Examples of Windows and Unix System Calls –

Windows Unix

Process Control CreateProcess() fork()


ExitProcess() exit()
WaitForSingleObject() wait()

File Manipulation CreateFile() open()


ReadFile() read()
WriteFile() write()
CloseHandle() close()

Device SetConsoleMode() ioctl()


Manipulation ReadConsole() read()
WriteConsole() write()

Information GetCurrentProcessID() getpid()


Maintenance SetTimer() alarm()
Sleep() sleep()

Communication CreatePipe() pipe()


CreateFileMapping() shmget()
MapViewOfFile() mmap()

Protection SetFileSecurity() chmod()


InitlializeSecurityDescriptor() umask()
SetSecurityDescriptorGroup( chown()
)

2.3 OS components
24

1. Process Management
The process management component is a procedure for managing many processes
running simultaneously on the operating system. Every running software application
program has one or more processes associated with them.
For example, when you use a search engine like Chrome, there is a process running
for that browser program.
Process management keeps processes running efficiently. It also uses memory
allocated to them and shutting them down when needed.
The execution of a process must be sequential so, at least one instruction should be
executed on behalf of the process.

Functions of process management


Here are the following functions of process management in the operating system,
such as:
 Process creation and deletion.
 Suspension and resumption.
 Synchronization process
 Communication process

2. File Management
25

A file is a set of related information defined by its creator. It commonly represents


programs (both source and object forms) and data. Data files can be alphabetic,
numeric, or alphanumeric.
Function of file management

The operating system has the following important activities in connection with file
management:
 File and directory creation and deletion.
 Give permissions For manipulating files and directories.
 Mapping files onto secondary storage.
 Backup files on stable storage media.

3. Main Memory management


Main memory is a large array of storage or bytes, which has an address. The memory
management process is conducted by using a sequence of reads or writes of specific
memory addresses.
It should be mapped to absolute addresses and loaded inside the memory to execute
a program. The selection of a memory management method depends on several
factors.
However, it is mainly based on the hardware design of the system. Each algorithm
requires corresponding hardware support. Main memory offers fast storage that can
26

be accessed directly by the CPU. It is costly and hence has a lower storage capacity.
However, for a program to be executed, it must be in the main memory.

Functions of Memory management


An Operating System performs the following functions for Memory Management in
the operating system:
 It helps you to keep track of primary memory.
 Determine what part of it are in use by whom, what part is not in use.
 In a multiprogramming system, the OS decides which process will get memory
and how much.
 Allocates the memory when a process requests.
 It also de-allocates the memory when a process no longer requires or has been
terminated.

4. Secondary-Storage Management
The most important task of a computer system is to execute programs. These
programs help you to access the data from the main memory during execution. This
memory of the computer is very small to store all data and programs permanently.
The computer system offers secondary storage to back up the main memory.

Today modern computers use hard drives/SSD as the primary storage of both
programs and data. However, the secondary storage management also works with
storage devices, such as USB flash drives and CD/DVD drives. Programs like
assemblers and compilers are stored on the disk until it is loaded into memory, and
then use the disk is used as a source and destination for processing.
27

Functions of Secondary storage management


Here are some major functions of secondary storage management in the operating
system:
 Storage allocation
 Free space management
 Disk scheduling

5. I/O Device Management


One of the important use of an operating system that helps to hide the variations of
specific hardware devices from the user.

Functions of I/O management


The I/O management system offers the following functions, such as:
 It offers a buffer caching system
 It provides general device driver code
 It provides drivers for particular hardware devices.
 I/O helps you to know the individualities of a specific device.

2.4 Use of operating tools


28

User management
There are three types of accounts on a Unix system −
Root account
This is also called superuser and would have complete and unfettered control of the
system. A superuser can run any commands without any restriction. This user should
be assumed as a system administrator.
System accounts
System accounts are those needed for the operation of system-specific components
for example mail accounts and the sshd accounts. These accounts are usually needed
for some specific function on your system, and any modifications to them could
adversely affect the system.
User accounts
User accounts provide interactive access to the system for users and groups of users.
General users are typically assigned to these accounts and usually have limited access
to critical system files and directories.
Unix supports a concept of Group Account which logically groups a number of
accounts. Every account would be a part of another group account. A Unix group
plays important role in handling file permissions and process management.
Managing Users and Groups
There are four main user administration files −
/etc/passwd − Keeps the user account and password information. This file holds the
majority of information about accounts on the Unix system.
/etc/shadow − Holds the encrypted password of the corresponding account. Not all
the systems support this file.
/etc/group − This file contains the group information for each account.
/etc/gshadow − This file contains secure group account information.
Check all the above files using the cat command.
The following table lists out commands that are available on majority of Unix systems
to create and manage accounts and groups −
29

Sr.No.Command Description
1 useradd Adds accounts to the system

2 usermod Modifies account attributes

3 userdel Deletes accounts from the system

4 groupadd Adds groups to the system

5 groupmod Modifies group attributes

6 groupdel Removes groups from the system

You might also like