0% found this document useful (0 votes)
17 views13 pages

Chap #1-Introduction To OS

An operating system (OS) is essential system software that manages computer hardware and software resources, providing an environment for executing programs and a user interface for interaction. Key functions of an OS include process management, memory management, file system management, and device management, along with services like program execution and error detection. Different types of operating systems include batch, multi-programmed, timesharing, real-time, distributed, and network operating systems.

Uploaded by

afianawaz131
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)
17 views13 pages

Chap #1-Introduction To OS

An operating system (OS) is essential system software that manages computer hardware and software resources, providing an environment for executing programs and a user interface for interaction. Key functions of an OS include process management, memory management, file system management, and device management, along with services like program execution and error detection. Different types of operating systems include batch, multi-programmed, timesharing, real-time, distributed, and network operating systems.

Uploaded by

afianawaz131
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/ 13

Unit # 1 Introduction to Operating System (1)

Q: – What is an operating system?

Ans: Operating System:


An operating system is the most important system software. It consists of a set of programs
running in the background of a computer system. It provides an environment in which other
programs can be executed. It also provides an interface for the user to interact with the computer
efficiently. It manages the computer's memory and processes, as well as all of its software and
hardware.
Some commonly uses operating systems are:
DOS, Windows 2000, Windows 7, Unix.

Purpose of an operating system:


There are two basic purposes of an operating system.
i. It manages the hardware and software resources of the system. These resources may
include the processor, memory, disk space, etc.
ii. It provides a stable, consistent way for applications to deal with the hardware without
knowing all the details of the hardware.

Needs of an operating system:


Operating System is system software that is used to control, manage and run the computer
system. It provides support to run application software on the computer system. Computer cannot
perform any task without operating system. That’s why a computer system needs an operating
system.

Q: – Define user interface. Describe different types of interfaces used by operating system.

Ans: A user interface refers to as the part of operating system. It allows the user to enter and receive
information. Basically it provides the facility to user to interact with computer.
There are two types of user interfaces.
Unit # 1 Introduction to Operating System (2)

 GUI (Graphical User Interface)


 CLI (Command Line Interface)

i. Graphical User Interface:


A GUI operating system provides a graphical interface to the user to communicate with the
computer. It consists of graphical objects like Icon, Buttons, Windows and Menus etc. Users can use
graphical object to interact with computer to perform different tasks.
User do not require to remember commands to perform various tasks such as copy a file,
opening a document, printing a spreadsheet. He/she just requires to recognize various graphical
objects and tasks that can be performed with them. He/she can use pointing devices to select and
issue a command just by clicking.
A GUI is very easy to use and learn. It provides an attractive way to interact the computer
without a deep knowledge.
Example of GUI: Windows 98, Windows 2000, Windows 7 etc.

Figure: Graphical User


Interface
ii. Command Line Interface:
A command line operating system provides a command prompt to the user for typing
commands. User interacts with the computer using commands. User has to remember commands to
perform different tasks. It is difficult for user to remember the commands for each task. A little
mistake in the syntax of command generates an error.
Example of CLI: MS DOS.

Figure: Command Line


Interface
Unit # 1 Introduction to Operating System (3)

Q: – Describe different tasks of operating system.

Ans: There are following tasks of Operating System:

i. Process Management
ii. Memory Management
iii. File System Management
iv. Device Management
 Process Management:
The most important task of operating system is to manage and monitor different processes
executing in the computer. A program in execution is called process. A process is considered as a unit
of work in a system. Thus the system becomes a collection of processes. Some of these processes are
operating system processes, while the remaining are user processes. The process management
component of the operating system manages all these processes in all respects. A process always needs
some resources for its execution such as CPU time, memory access, and I/O devices etc. The operating
system fulfills these requirements for the process. If multiple processes are executing simultaneously,
the operating system must be capable of providing each process with an appropriate virtual
environment in which it can run.
The operating system also performs the following major activities for process management:-

o Creation and deletion of user and system processes.


o Suspension (to stop) and resumption (to restart) of processes.
o Provision of a mechanism for process synchronization (to update processes with respect
to each other).
o Provision of a mechanism for communication (sharing of information) among process.

 Memory Management
Computer system's main memory is an area where data and information are kept with unique
address for easy and quick access. Thus the memory unit has very important role in the computer
system. Processor takes data and program instructions from memory, executes them, and stores the
results in the main memory. It is the responsibility of operating system to manage the allocation of
memory to all existing processes.
Therefore, the operating, system performs following major memory management tasks:-
Unit # 1 Introduction to Operating System (4)

o Keep track of which parts of memory are being used by which processes.
o Keep track of which parts of memory are available for allocation.
o Allocate memory space to the newly loaded and other needing processes.
o De-allocate memory space allocated to the program (or process) when it terminated.
o Swap-in and swap-out processes to the memory space, whenever required.

 File System Management


Processed data must be stored in the form of files on secondary storage devices (such as
magnetic disk, optical disks, magnetic tape etc.) from where it can be retrieved when required for use.
A file is a storage unit and it is a collection of related information. A file may be a set of program
instructions or it may be set of data to be used by another program. Files are stored permanently on the
storage devices and are organized in folders or directories so that a particular file can be accessed
easily.
The operating system must be capable of understanding the type of storage devices and the
structure of the data contained in the files on the storage medium. In case of a system with multiple
users, the operating system must provide protection mechanisms to control access to these files. File
management is the most visible components of an operating system.
Operating system performs the following major file management tasks:-

o File operations such as creating, deleting, opening, closing, copying, renaming etc.
o Directory operations such as creating new directory, deleting existing directory, renaming
directory etc.
o File organization such as arrangement of records into files and the ways for accessing these
records.
o File protections to control access to the files etc.

 Device Management:
A computer communicates information through its input and output devices. Processes access
those devices through the operating system supervisor calls provided for that purpose. The operating
system attempts to manage those devices in a manner that allows them to be efficiently shared among
the processes requiring them.

Operating system performs the following I/O related tasks:-


o Buffer caching i.e. keeping frequently need data in main memory for quick access.
o Device drivers (programs to operate hardware component) management.
o Handle I/O errors that may occur in read and write operations etc.

Q: – Explains different services provided by operating system.

Ans: Different services provided by the operating system are as follows:


 User Interface
 Program Execution
Unit # 1 Introduction to Operating System (5)

 Access to I/O Devices


 File System Manipulation
 Error Detection
 Communications
 Resource Allocation
 Protection

1. User Interface:
All operating systems provide a user interface. The user interface can be of different types such
as command-line interface and graphical user interface.

 Command-Line Interface: The command-line interface uses text commands and a


method for entering them.
 Graphical User Interface: The graphical user interface (GUI) is a window system with
pointing device to give instructions, select menus and make selections etc. It is the most
popular type of user interface.

2. Program Execution:
Operating system provides the services to execute programs. It handles many kinds of
activities from user programs to system programs like printer spooler, name servers, file server,
etc.
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. Access to I/O Devices:


The operating system provides an interface to the programmer to access I/O devices easily.

4. File System Manipulation:


The operating system provides the capability to read, write, create and delete files from a user
program. 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 OS gives the permission to the program for operation on file.
Unit # 1 Introduction to Operating System (6)

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


 OS provides an interface to the user to create/delete files.
 OS provides an interface to the user to create/delete directories.

5. Error Detection:
Operating system provides the facility of error detection and response. It is the ability to detect
errors in CPU, memory hardware, I/O devices or in user programs. Error detection occurs at both
hardware and software levels. At hardware level, all data transfers must be checked to ensure that
data have not been corrupted or changed. At software level, media must be checked for data
consistency.
For example, the number of allocated and unallocated blocks of storage should match the total
number of blocks on the device.

6. Communications:
It is the exchange of information between processes that may be executing on the same
computer or on completely different computers. It is usually implemented via shared memory or
message passing.

7. Resource Allocation:
It is the ability to allocate resources to multiple users or to multiple jobs running at the same
time. 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.

8. Protection:
It is an ability to ensure all access to system resources is controlled. 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.

Q: – Describe different functions of Operating system.

Ans: Functions of Operating Systems:


 Manage Hardware Resources:
 Memory Management
 Load and Execute programs
 Data Security
 Providing Interface to user
Unit # 1 Introduction to Operating System (7)

i. Manage Hardware Resources:


The operating system must provide programs for managing the hardware resources of the
computer like disks, memory and CPU.

ii. Memory Management:


In the stored program computer every program has to be loaded into the computer’s main
memory during the execution. Multiple programs and data may be loaded in the main memory at a
time. In this situation, OS system uses time-sharing method and protects the data and program
from the actions of other programs.

iii. Load and Execute programs:


A program has to be loaded into the main memory before the processor can execute it. The
OS provides the facility of loading a program into the memory and starts its execution.

iv. Data Security:


The OS also protect the user data against illegal access and modification. For this OS
provide the facility of login-password and user rights etc.

v. Providing Interface to user:


The OS provides an interface between the user and the computer and also between software
and the computer. User interface is used for input process.
OS provides the following two types of interfaces to their users:
 Command Prompt
 Graphical user Interface

a. Command Prompt:
A command line operating system provides a command prompt to the user for typing
commands. User interacts with the computer using commands. User has to remember
commands to perform different tasks. It is difficult for user to use as he/she has to
remember the commands. A little mistake in the syntax of command generates an error.
Example of CLI: MS DOS.

b. Graphical user Interface


A GUI operating system provides a graphical interface for the user to communicate
with the computer. It consists of graphical objects like Icon, Buttons, Windows and
Menus etc. Users can use graphical object to interact the computer to perform different tasks.
User communicates with the OS by just selecting commands from the menus or by
selecting different icons with the pointing device.
Example of GUI: Windows 2000, Windows XP, Windows 7 etc.

Q: – Describe different types of operating system.


Unit # 1 Introduction to Operating System (8)

Ans: There are different types of network:


 Batch Operating System
 Multi-Programmed Batch System
 Timesharing Operating
 Real-Time Operating System
 Distributed Operating System
 Network Operating System

 Batch Operating System


In early computer systems, the user did not interact directly with the computer system. The
data and programs (referred to as Job) were first prepared on the input media such as punched cards or
punched tape. These jobs were submitted to the computer operator at specific location. The computer
operator would arrange the jobs into proper sequence known as batches and run the batches through
the computer. The batch operating system used to manage and control the jobs.
The batch operating system transfers the jobs to the processor one by one. When a job is
completed, the control is transferred to next job. For example, if first job is about to print a document
on a printer and second job is to execute a program for creating and editing text document. In this
case, on the completion of first job, the second job can be started.

 Multi-Programmed Batch System


In multiprogramming environment, multiple programs (or jobs) of different users can be
executed at the same time. The multiple jobs that are to be executed must be kept in main memory and
the operating system must execute them in parallel fashion i.e. CPU switches between the jobs so fast
that the jobs seem to be executing simultaneously. Before starting execution, operating system will
decide which job to run first, which one to second and so on. This decision is called "CPU
Scheduling".
In multi-programmed batch system, the operating system keeps multiple jobs in main memory
at a time. Since, in general, main memory is limited space and may not accommodate all the jobs to be
executed. So the jobs that enter the system to be executed are kept initially on the disk in the job pool.
When the operating system selects a job from a job pool, it loads that job into memory for execution.
Normally, the jobs in main memory are kept in smaller size than the jobs in job pool.
The multi-programmed system takes comparatively less time to complete the jobs than the
simple batch system.
Unit # 1 Introduction to Operating System (9)

 Timesharing Operating System:


Timesharing system is a multiprogramming, multiprocessing and interactive system. It allows
multiple users to share the computer at the same time. This system executes multiple jobs of users by
switching among them. Timesharing is used when multiple users are connected to a single computer in
a communication network. Each user accesses the computer with its own terminal.

Timesharing operating systems allow for interaction between user and process. It supports an
environment that allows programs to respond to user inputs in a reasonable amount of time. The
operating system must not only share resources among the various processes, but it must create the
illusion that processes are running simultaneously. It does this by shifting execution rapidly among all
the active process.

 Real-Time Operating System


Unit # 1 Introduction to Operating System (10)

The real-time operating system is designed to support executions of tasks within specific time
limits. The real-time system requires the correct results within specified time period. The correctness
of the processing task's result is totally dependent on completion of the job within the specified time.
For example, a real-time system sensing loss of coolant to a nuclear reactor may be required to
initiate a backup system within a fraction of second. The operating system must guarantee the task can
be executed within a specified time constraint.
Many real-time systems are embedded in specialized devices, such as microwave ovens,
washing machines, digital cameras, cellular telephones.

 Distributed Computer System


A computer system, in which different computing resources like processors, storage devices,
printers, software, data etc. are physically distributed through a networked system, is called distributed
computer system. The computers that are in a distributed system can be physically close together and
connected by a local network, or they can be geographically distant and connected by a wide area
network. The resources of the distributed system are networked to provide access to its users in the
system.

In distributed system, two types of operating system are used:


 Network operating system
 Distributed operating system

i. Network Operating System


In a network, each computer or node has its own operating system. With a network
operating system, the resources on each machine on the network are managed by that
machine's operating system. The network operating system is simply an addition of local
operating system that
allows application
machines to interact with
monk machines.
Unit # 1 Introduction to Operating System (11)

ii. Distributed Operating System


In a distributed operating system, the users access remote resources in the same way
they access local resources. The computers communicate with each other under the control
of distributed operating system. With a distributed operating system, the operating systems
on all the computers work together to manage the collective network resources. A single
collective distributed operating system manages the network resources, provided by each
node of distributed system.

Q: – Describe different modes of Operating system.

Ans: Kernel:
A Kernel is a computer program that is the heart and core of an Operating System. Since the
Operating System has control over the system so, the Kernel also has control over everything in the
system. It is the most important part of an Operating System. Whenever a system starts, the Kernel is
the first program that is loaded after the boot loader because the Kernel has to handle the rest of the
thing of the system for the Operating System. The Kernel remains in the memory until the Operating
System is shut-down.
The Kernel is responsible for low-level tasks such as disk management, memory management,
task management, etc. It provides an interface between the user and the hardware components of the
system. When a process makes a request to the Kernel, then it is called System Call.
Functions of a Kernel:
o Access Computer resource
o Resource Management
o Memory Management
o Device Management
Unit # 1 Introduction to Operating System (12)

Interrupt in OS:
Interrupts are signals sent to the CPU by external devices, normally I/O devices. They tell the
CPU to stop its current activities and execute the appropriate part of the operating system.

Dual mode operations in OS:


An error in one program can adversely affect many processes, it might modify data of another
program, or also can affect the operating system. For example, if a process stuck in infinite loop then
this infinite loop could affect correct operation of other processes.
So to ensure the proper execution of the operating system, there are two modes of operation:

o User mode
o Kernel/System/Supervisor/Privileged Mode

i. User mode:
When the computer system runs user applications like creating a text document or
using any application program, then the system is in the user mode. When the user application
requests for a service from the operating system or an interrupt occurs or system call, then
there will be a transition from user to kernel mode to fulfill the requests.
To switch from kernel mode to user mode, mode bit should be 1.

ii. Kernel /System/Supervisor/Privileged Mode


Whenever the system boots, hardware starts in kernel mode and when operating system is
loaded, 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:


o Handling Interrupts
o To switch from user mode to kernel mode.
o Input-Output management.

Given below image describes what happen when an interrupt occurs:


Unit # 1 Introduction to Operating System (13)

Important Questions

1. Explains different services provided by Operating System. (2021, 2022)


2. Describe different tasks of operating system. (2019)
3. What is operating system? Explain the types of operating system.
4. Discuss briefly distributed OS.
5. Differentiate kernel and user mode of a system execution and also discuss 3 ways to enter in
kernel mode from user mode.

You might also like