KEMBAR78
Operating System Unit-1 | PDF | Computer Data Storage | Operating System
0% found this document useful (0 votes)
24 views17 pages

Operating System Unit-1

An Operating System (OS) serves as an interface between users and hardware, managing processes, resource allocation, and file management to provide an efficient environment for program execution. Key functions include security, memory management, processor management, and device management, with various types of operating systems such as batch, time-sharing, distributed, network, and real-time systems, each with their own advantages and disadvantages. Additionally, protection mechanisms are essential to safeguard resources and ensure secure access for multiple users in a multiprogramming environment.

Uploaded by

gdsahi90
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)
24 views17 pages

Operating System Unit-1

An Operating System (OS) serves as an interface between users and hardware, managing processes, resource allocation, and file management to provide an efficient environment for program execution. Key functions include security, memory management, processor management, and device management, with various types of operating systems such as batch, time-sharing, distributed, network, and real-time systems, each with their own advantages and disadvantages. Additionally, protection mechanisms are essential to safeguard resources and ensure secure access for multiple users in a multiprogramming environment.

Uploaded by

gdsahi90
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/ 17

OPERATING SYSTEM

UNIT-1

An Operating System can be defined as an interface between user and hardware. It is


responsible for the execution of all the processes, Resource Allocation, CPU management,
File Management and many other tasks.

The purpose of an operating system is to provide an environment in which a user can


execute programs in convenient and efficient manner. 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.

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

Important functions of an operating System:


1. Security –
The operating system uses password protection to protect user data and similar other
techniques. it also prevents unauthorized access to programs and user data.

2. Control over system performance –


Monitors overall system health to help improve performance. records the response
time between service requests and system response to having a complete view of the
system health. This can help improve performance by providing important information
needed to troubleshoot problems.

3. Job accounting –
Operating system Keeps track of time and resources used by various tasks and users,
this information can be used to track resource usage for a particular user or group of
users.

4. Error detecting aids –


The operating system constantly monitors the system to detect errors and avoid the
malfunctioning of a computer system.

5. Coordination between other software and users –


Operating systems also coordinate and assign interpreters, compilers, assemblers, and
other software to the various users of the computer systems.

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

7. Processor Management –
In a multi-programming environment, the OS decides the order in which processes
have access 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.

8. Device Management –
An OS manages device communication via their respective drivers. It performs the
following activities for device management. Keeps track of all devices connected to the
system. designates a program responsible for every device known as the Input/Output
controller. Decides which process gets access to a certain device and for how long.
Allocates devices in an effective and efficient way. Deallocates devices when they are
no longer required.

9. File Management –
A file system is organized into directories for efficient or easy navigation and usage.
These directories may contain other directories and other files. An Operating System
carries out the following file management activities. It keeps track of where information
is stored, user access settings and status of every file, and more… These facilities are
collectively known as the file system.
TYPES OF OPERATING SYSTEM:
An Operating System performs all the basic tasks like managing files, processes, and
memory. Thus operating system acts as the manager of all the resources, i.e. resource
manager. Thus, the operating system becomes an interface between user and machine.

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 OS:
• 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.

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. 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
Examples of Distributed Operating System are- LOCUS, etc.

4. Network Operating System –


These systems run on a server and provide the capability to manage data, users, groups,
security, applications, and other networking functions. These types of operating systems
allow shared access of files, printers, security, applications, and other networking functions
over a small private network. One more important aspect of Network Operating Systems is
that all the users are well aware of the underlying configuration, of all other users within the
network, their individual connections, etc. and that’s why these computers are popularly
known as tightly coupled systems.

Advantages of Network Operating System:


• Highly stable centralized servers
• Security concerns are handled through servers
• New technologies and hardware up-gradation are easily integrated into the system
• Server access is possible remotely from different locations and types of systems
Disadvantages of Network Operating System:
• Servers are costly
• User has to depend on a central location for most operations
• Maintenance and updates are required regularly
Examples of Network Operating System are: Microsoft Windows Server 2003, Microsoft
Windows Server 2008, UNIX, Linux, Mac OS X, Novell NetWare, and BSD, etc.

5. 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.
• 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.

MULTIPROGRAMMING OS:

Multiprogramming is an extension to batch processing where the CPU is always kept busy.
Each process needs two types of system time: CPU time and IO time. In a multiprogramming
environment, when a process does its I/O, The CPU can start the execution of other
processes. Therefore, multiprogramming improves the efficiency of the system. A
multiprogramming operating system can run several programs on a single processor
machine. If a single application has to wait for I/O transfer in a multiprogramming operating
system, other programs are always ready to use the CPU. As a result, numerous jobs can
share the CPU's time. However, in a multiprogramming operating system, it is not predefined
that their jobs would be executed simultaneously.
Advantages of Multiprogramming OS

• Throughout the system, it increased as the CPU always had one program to execute.
• Response time can also be reduced.
• It provides high CPU utilization.
• It has a shorter response time.
• It can assign priority to the jobs.

Disadvantages
• Its scheduling implementation is not easy.
• It required more management.
• Multiprogramming systems provide an environment in which various systems
resources are used efficiently, but they do not provide any user interaction with the
computer system.
A modern computer system

Computer-System Operation

• Bootstrap program
• Shared memory between CPU and I/O cards
• Time slicing for multi-process operation
• Interrupt handling - clock, HW, SW
• Implementation of system calls

I/O STRUCTURE- IN NB
Storage Structure in Operating Systems

• Basically we want the programs and data to reside in main


memory permanently. Main memory ( RAM )
o Programs must be loaded into RAM to run.
o Instructions and data fetched from RAM into registers.
o RAM is volatile
o "Medium" size and speed
• Other electronic ( volatile ) memory is faster, smaller, and more expensive per
bit:
o Registers
o CPU Cache
• Non-volatile memory ( "permanent" storage ) is slower, larger, and less
expensive per bit:
o Electronic disks
o Magnetic disks
o Optical disks
o Magnetic Tapes

This arrangement is usually not possible for the following two reasons:

1. Main memory is usually too small to store all needed programs and data permanently.
2. Main memory is a volatile storage device that loses its contents when power is turned
off or otherwise lost.
There are two types of storage devices:-

• Volatile Storage Device –


It loses its contents when the power of the device is removed.
• Non-Volatile Storage device –
It does not loses its contents when the power is removed. It holds all the data when the
power is removed.
Secondary Storage is used as an extension of main memory. Secondary storage devices
can hold the data permanently.
Storage devices consists of Registers, Cache, Main-Memory, Electronic-Disk, Magnetic-
Disk, Optical-Disk, Magnetic-Tapes. Each storage system provides the basic system of
storing a datum and of holding the datum until it is retrieved at a later time. All the storage
devices differ in speed, cost, size and volatility. The most common Secondary-storage
device is a Magnetic-disk, which provides storage for both programs and data.
In this fig Hierarchy of storage is shown –
• In this hierarchy all the storage devices are arranged according to speed and cost.
The higher levels are expensive, but they are fast.
• As we move down the hierarchy, the cost per bit generally decreases, where as the
access time generally increases.
• The storage systems above the Electronic disk are Volatile, where as those below
are Non-Volatile.
An Electronic disk can be either designed to be either Volatile or Non-Volatile.
During normal operation, the electronic disk stores data in a large DRAM array,
which is Volatile.
• But many electronic disk devices contain a hidden magnetic hard disk and a battery
for backup power. If external power is interrupted, the electronic disk controller
copies the data from RAM to the magnetic disk. When external power is restored,
the controller copies the data back into the RAM.
• The design of a complete memory system must balance all the factors. It must use
only as much expensive memory as necessary while providing as much inexpensive,
Non-Volatile memory as possible. Caches can be installed to improve performance
where a large access-time or transfer-rate disparity exists between two
components.
• <IN NB NOTES>

What is Protection in Operating System?

A mechanism that controls the access of programs, processes, or users to the resources
defined by a computer system is referred to as protection. You may utilize protection as a
tool for multi-programming operating systems, allowing multiple users to safely share a
common logical namespace, including a directory or files.

It needs the protection of computer resources like the software, memory, processor, etc.
Users should take protective measures as a helper to multiprogramming OS so that multiple
users may safely use a common logical namespace like a directory or data. Protection may
be achieved by maintaining confidentiality, honesty and availability in the OS. It is critical to
secure the device from unauthorized access, viruses, worms, and other malware.

Need of Protection in Operating System

• There may be security risks like unauthorized reading, writing, modification, or


preventing the system from working effectively for authorized users.
• It helps to ensure data security, process security, and program security against
unauthorized user access or program access.
• It is important to ensure no access rights' breaches, no viruses, no unauthorized
access to the existing data.
• Its purpose is to ensure that only the systems' policies access programs, resources,
and data.

<DIFFERENT TYPES OF PROTECTION IN NB>

OPERATING SYSTEM STRUCTURES: + NOTES

SINGLE LAYERED/ MONOLITHIC-Monolithic systems provides a basic structure for the


operating system.

• a main program that invokes the requested service procedure


• a set of service procedures that carry out the system calls
• a set of utility procedures that help the service procedure

In Monolithic system model, there is one service procedure for each system call, that takes
care of it. The utility procedures do jobs that are needed by several service procedures, such
as fetching the data from the user programs.This division of the procedures into the following
three layers:

1. Main Procedure
2. Service Procedures
3. Utility Procedures
Layered Systems

This system has 6 layers as shown in the table given below.

Layer Function

5 The operator

4 User programs

3 I/O management

2 Operator-process communication

1 Memory and drum management

0 Processor allocation and multiprogramming

Here, are the description provided layer by layer.

• Layer 0 - This layer dealt with allocation of the processor, switching between
processes when interrupts occurred or timers expired
• Layer 1 - This layer did the memory management
• Layer 2 - This layer handled the communication between each process and the
operator console
• Layer 3 - This layer took care of managing the Input/Output devices and buffering
the information streams to and from them
• Layer 4 - On this layer, user programs were found
• Layer 5 - On this layer, the system operator process was located

Virtual Machines

The system originally called CP/CMS, later renamed VM/370, was based on an astute
observation. That was a time sharing system, provides multiprogramming and an extended
machine with a more convenient interface than the bare hardware.The heart of the system
known as virtual machine monitor that runs on the bare hardware and does the
multiprogramming, providing several virtual machines to next layer up as shown in the given
figure.
These virtual machines aren't extended machines, with files and other nice features. They
are the exact copies of the bare hardware, including the kernel/user mode, Input/Output,
interrupts, and everything else the real machine has.

OPERATING SYSTEM SERVIVES:

An operating system is an interface which provides services to both the user and to the
programs. It provides an environment for the program to execute. It also provides users with
the services of how to execute programs in a convenient manner. The operating system
provides some services to program and also to the users of those programs. The specific
services provided by the OS are off course different.

Following are the common services provided by an operating system:

1. Program execution
2. I/O operations
3. File system manipulation
4. Communication
5. Error detection
6. Resource allocation
7. Protection

1) Program Execution

• An operating system must be able to load many kinds of activities into the memory
and to run it. The program must be able to end its execution, either normally or
abnormally.
• A process includes the complete execution of the written program or code. There are
some of the activities which are performed by the operating system:
o The operating system Loads program into memory
o It also Executes the program
o It Handles the program’s execution
o It Provides a mechanism for process synchronization
o It Provides a mechanism for process communication

2) I/O Operations

• The communication between the user and devices drivers are managed by the
operating system.
• I/O devices are required for any running process. In I/O a file or an I/O devices can be
involved.
• I/O operations are the read or write operations which are done with the help of
input-output devices.
• Operating system give the access to the I/O devices when it required.

3) File system manipulation

• The collection of related information which represent some content is known as a file.
The computer can store files on the secondary storage devices. For long-term storage
purpose. examples of storage media include magnetic tape, magnetic disk and
optical disk drives like CD, DVD.
• A file system is a collection of directories for easy understand and usage. These
directories contain some files. There are some major activities which are performed
by an operating system with respect to file management.
o The operating system gives an access to the program for performing an
operation on the file.
o Programs need to read and write a file.
o The user can create/delete a file by using an interface provided by the
operating system.
o The operating system provides an interface to the user creates/ delete
directories.
o The backup of the file system can be created by using an interface provided
by the operating system.

4)Communication

In the computer system, there is a collection of processors which do not share memory
peripherals devices or a clock, the operating system manages communication between all
the processes. Multiple processes can communicate with every process through
communication lines in the network. There are some major activities that are carried by an
operating system with respect to communication.

• Two processes may require data to be transferred between the process.


• Both the processes can be on one computer or a different computer, but are
connected through a computer network.

5) Error handling

An error is one part of the system that may cause malfunctioning of the complete system.
The operating system constantly monitors the system for detecting errors to avoid some
situations. This give relives to the user of the worry of getting an error in the various parts of
the system causing malfunctioning.

The error can occur anytime and anywhere. The error may occur anywhere in the computer
system like in CPU, in I/O devices or in the memory hardware. There are some activities that
are performed by an operating system:
• The OS continuously checks for the possible errors.
• The OS takes an appropriate action to correct errors and consistent computing.

6) Resource management

When there are multiple users or multiple jobs running at the same time resources must be
allocated to each of them. There are some major activities that are performed by an
operating system:

• The OS manages all kinds of resources using schedulers.


• CPU scheduling algorithm is used for better utilization of CPU.

7) Protection

The owners of information stored in a multi-user computer system want to control its use.
When several disjoints processes execute concurrently it should not be possible for any
process to interfere with another process. Every process in the computer system must be
secured and controlled.

What is a System Call?

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. A system call is a method of interacting with the
operating system via programs. A system call is a request from computer software to an
operating system's kernel.

The Application Program Interface (API) connects the operating system's functions to user
programs. It acts as a link between the operating system and a process, allowing user-level
programs to request operating system services. The kernel system can only be accessed
using system calls. System calls are required for any programs that use resources.

Why do you need system calls in Operating System?


There are various situations where you must require system calls in the operating system.
Following of the situations are as follows:

1. It is must require when a file system wants to create or delete a file.


2. Network connections require the system calls to sending and receiving data packets.
3. If you want to read or write a file, you need to system calls.
4. If you want to access hardware devices, including a printer, scanner, you need a
system call.
5. System calls are used to create and manage new processes.

How System Calls Work

The Applications run in an area of memory known as user space. A system call connects to
the operating system's kernel, which executes in kernel space. When an application creates a
system call, it must first obtain permission from the kernel. It achieves this using an interrupt
request, which pauses the current process and transfers control to the kernel.

If the request is permitted, the kernel performs the requested action, like creating or deleting
a file. As input, the application receives the kernel's output. The application resumes the
procedure after the input is received. When the operation is finished, the kernel returns the
results to the application and then moves data from kernel space to user space in memory.

A simple system call may take few nanoseconds to provide the result, like retrieving the
system date and time. A more complicated system call, such as connecting to a network
device, may take a few seconds. Most operating systems launch a distinct kernel thread for
each system call to avoid bottlenecks. Modern operating systems are multi-threaded, which
means they can handle various system calls at the same time.

Step 1) The processes executed in the user mode till the time a system call interrupts it.
Step 2) After that, the system call is executed in the kernel-mode on a priority basis.
Step 3) Once system call execution is over, control returns to the user mode.,
Step 4) The execution of user processes resumed in Kernel mode.

Types of System calls


Here are the five types of System Calls in OS:

• Process Control-This system calls perform the task of process creation, process
termination, etc.
• File Management-File management system calls handle file manipulation jobs like
creating a file, reading, and writing, etc.
• Device Management-Device management does the job of device manipulation like
reading from device buffers, writing into device buffers, etc.
• Information Maintenance-It handles information and its transfer between the OS and
the user program.
• Communications-These types of system calls are specially used for interprocess
communications.
o

You might also like