You are on page 1of 8

0UNIT – 1 (OS)

Q1. What is Operating system? And its Services


It is a software that works as an interface between a user and the computer
hardware. The primary objective of an operating system is to make computer
system convenient to use and to utilize computer hardware in an efficient manner.
The operating system performs the basic tasks such as receiving input from the
keyboard, processing instructions and sending output to the screen.
Operating system is software that is required in order to run application programs
and utilities. It works as a bridge to perform better interaction between
application programs and hardware of the computer. Examples of operating
system are UNIX, MS-DOS, MS-Windows - 98/XP/Vista, Windows-NT/2000, OS/2
and Mac OS.

SERVICES
Program execution
OS 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. A process includes the complete execution context
(code to execute, data to manipulate, registers, OS resources in use).

• Loads a program into memory.


• Executes the program.
• Handles program's execution.
• Provides a mechanism for process synchronization & communication.

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.

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.


• To give the permission (read-only, read-write, denied) to the program for operation on file.
• Provides an interface to the user to create/delete files or directories & to create the backup of file system.
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.

• 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.
Error handling
Errors can occur anytime and anywhere. An error may occur in CPU, in I/O devices or in the memory hardware.

• The OS constantly checks for possible errors.


• The OS takes an appropriate action to ensure correct and consistent computing.
Resource Management
In case of multi-user or multi-tasking environment, resources such as main memory, CPU cycles and files storage are
to be allocated to each user or job. Following are the major activities of an operating system with respect to resource
management −

• The OS manages all kinds of resources using schedulers.


• CPU scheduling algorithms are used for better utilization of CPU.
Protection
Considering a computer system having multiple users and concurrent execution of multiple processes, the various
processes must be protected from each other's activities.

Protection refers to a mechanism or a way to control the access of programs, processes, or users to the resources
defined by a computer system. Following are the major activities of an operating system with respect to protection.

• The OS ensures that all access to system resources is controlled.


• The OS ensures that external I/O devices are protected from invalid access attempts.
• The OS provides authentication features for each user by means of passwords.

Q2. Functions of Operating System?


Operating System Means that Resource Manager, that manage all the Resources those are Attached to the System,
like Memory, Processor, Input/output Devices.
Operating system manages overall activities of a computer and the input/output devices attached to the computer.
It is the first software you see when you turn on the computer, and the last software you see when the computer is
turned off. It is the software that enables all the programs you use. At the simplest level, an operating system does
two things:
The first, it manages the hardware and software resources of the computer system. These resources include the
processor, memory, disk space, etc. The second, it provides a stable, consistent way for applications to deal with the
hardware without having-to know all the details of the hardware.
The first task is very important i.e. managing the hardware and software resources, as various processes compete to
each other for getting the CPU time and memory space to complete the task. In this regard; the operating system acts
as a manager to allocate the available resources to 'satisfy the requirements of each process.
The second task i.e. providing a consistent application interface is especially important. A consistent application
program interface (API) allows a user (or S/W developer) to write an application program on any computer and to run
this program on another computer, even if the hardware configuration is different like as amount of memory, type of
CPU or storage disk. It shields the user of the machine from the low-level details of the machine's operation and
provides frequently needed facilities.
Process Management: It manage all the User and system Process.
Memory Management: Operating System also Manages the Computer Memory that is provided to the process.
Storage Management: It manage all the Storing and Accessing Files and Directories Reading/Writing Operations.
Device management: is the process of managing the implementation, operation and maintenance of a physical
and/or virtual device. It is a broad term that includes various administrative tools and processes for the maintenance
and upkeep of a computing, network, mobile and/or virtual device.
Device management generally performs the following:

• Installing device and component-level drivers and related software


• Configuring a device so it performs as expected using the bundled operating system, business/workflow
software and/or with other hardware devices.
• Implementing security measures and processes.
Devices usually refer to physical/hardware devices such as computers, laptops, servers, mobile phones and more.
They could also be virtual, however, such as virtual machines or virtual switches. In Windows, device management is
also an administrative module that is used for managing or configuring the physical devices, ports and interfaces of a
computer or server.
Information Management:
It means the OS manages the info or data, in other words Managing the information from which or to which it should
be sent/ received. File system in OS keeps the track of information, its location and everything. It also decides on
which user should get resources first and enforce the protection requirements and also provide accessing routines.
Necessary information like opening a file, reading a file is taken care by the file system and finally it reclaims the
resources like closing a file.
Q3. Different types of operating system
There are different types of operating system those are organized by their Working.
1. Serial Processing: In Serial Processing operating system that use FIFO (First in First Out) technique for
processing the process.
2. Batch Processing: In batch processing a similar type of jobs prepared and processed.
3. Multi-Programming: In Multi programming Operating System Multiple Programs are Executed on the System
at a Time.
4. Real Time System: Real Time System are used there Requires higher and Timely Response.
5. Distributed Operating System: In this Operating system Data is Stored and Processed on Multiple Locations.
6. Multiprocessing: In This type of operating system there are two or More CPU in a Single OS.
7. Parallel operating systems: It manage parallelly all running resources of the computer system.
8. Time Sharing Operating System: Time-sharing is a technique which enables many people, located at various
terminals, to use a particular computer system at the same time. Time-sharing or multitasking is a logical
extension of multiprogramming. Processor's time which is shared among multiple users simultaneously is
termed as time-sharing.

Q4. What is System call explain it?


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

• Process creation and management


• Main memory management
• File Access, Directory and File system management
• Device handling(I/O)
• Protection
• Networking, etc.
Types of System Calls: There are 5 different categories of system calls –

• Process control: end, abort, create, terminate, allocate and free memory.
• File management: create, open, close, delete, read file etc.
• Device management
• Information maintenance
• Communication
Q5. What is Process Control Blocks?
While creating a process the operating system performs several operations. To identify these process, it must identify
each process, hence it assigns a process identification number (PID) to each process. As the operating system supports
multi-programming, it needs to keep track of the all the processes. For this task,
the process control block (PCB) is used to track the process’s execution status.
Each block of memory contains information about the process state, program
counter, stack pointer, status of opened files, scheduling algorithms, etc. All
these information is required and must be saved when the process is switched
from one state to another. When the process made transitions from one state to
another, the operating system must update information in the process’s PCB.
A process control block (PCB) contains information about the process, i.e.
registers, quantum, priority, etc. The process table is an array of PCB’s, that
means logically contains a PCB for all of the current processes in the system.

• Pointer: It is a stack pointer which is required to be saved when the process is switched from one state to another to
retain the current position of the process.
• Process state: It stores the respective state of the process.
• Process number: Every process is assigned with a unique id is known as processed which stores the process identifier.
• Program counter: It stores the counter which contains the address of the next instruction that is to be executed for the
process.
• Register: These are the CPU registers which includes: accumulator, base, registers and general-purpose registers.
• Memory limits: This field contains the information about memory management system used by operating system. This
may include the page tables, segment tables etc.
• Open files list: This information includes the list of files opened for a process.

Q6. What are the Scheduling Criteria in Process Management?


There are several different criteria to consider when trying to select the "best" scheduling algorithm for a particular situation
and environment, including:

• CPU utilization - Ideally the CPU would be busy 100% of the time, so as to waste 0 CPU cycles. On a real system CPU
usage should range from 40% (lightly loaded) to 90% (heavily loaded.)
• Throughput - Number of processes completed per unit time. May range from 10 / second to 1 / hour depending on
the specific processes.
• Turnaround time - Time required for a particular process to complete, from submission time to completion. (Wall
clock time.)
• Waiting time - How much time processes spend in the ready queue waiting their turn to get on the CPU.
• (Load average - The average number of processes sitting in the ready queue waiting their turn to get into the CPU.
Reported in 1-minute, 5-minute, and 15-minute averages by "uptime" and "who".)
• Response time - The time taken in an interactive program from the issuance of a command to the commence of a
response to that command.

In general, one wants to optimize the average value of a criteria (Maximize CPU utilization and throughput and minimize all
the others.) However sometimes one wants to do something different, such as to minimize the maximum response time.

Sometimes it is most desirable to minimize the variance of a criteria than the actual value. I.e. users are more accepting of
a consistent predictable system than an inconsistent one, even if it is a little bit slower.
Q7. Explain the scheduling algorithms? Preemptive or Non- Preemptive?
CPU scheduling is a process which allows one process to use the CPU while the execution of another process is on
hold (in waiting state) due to unavailability of any resource like I/O etc, thereby making full use of CPU. The aim of
CPU scheduling is to make the system efficient, fast and fair.
Whenever the CPU becomes idle, the operating system must select one of the processes in the ready queue to be
executed. The selection process is carried out by the short-term scheduler (or CPU scheduler). The scheduler selects
from among the processes in memory that are ready to execute, and allocates the CPU to one of them.

1. Non-Preemptive Scheduling
Under non-preemptive scheduling, once the CPU has been allocated to a process, the process keeps the CPU until it
releases the CPU either by terminating or by switching to the waiting state. This scheduling method is used by the
Microsoft Windows 3.1 and by the Apple Macintosh operating systems. It is the only method that can be used on
certain hardware platforms, because It does not require the special hardware(for example: a timer) needed for
preemptive scheduling.
2. Preemptive Scheduling
In this type of Scheduling, the tasks are usually assigned with priorities. At times it is necessary to run a certain task
that has a higher priority before another task although it is running. Therefore, the running task is interrupted for
some time and resumed later when the priority task has finished its execution.

Scheduling Algorithms
• First Come First Serve(FCFS) Scheduling (Non- Preemptive)
• Shortest-Job-First(SJF) Scheduling
• Priority Scheduling (Preemptive)
• Round Robin(RR) Scheduling (Preemptive)
• Multilevel Queue Scheduling
• Multilevel Feedback Queue Scheduling

1. First Come First Serve(FCFS) Scheduling


• Jobs are executed on first come, first serve basis.
• Easy to understand and implement.
• Poor in performance as average wait time is high.
2. Shortest-Job-First(SJF) Scheduling (Non- Preemptive)
• Best approach to minimize waiting time.
• Actual time taken by the process is already known to processor.
• Impossible to implement.

In Preemptive Shortest Job First Scheduling, jobs are put into ready queue as they arrive, but as a process with short burst
time arrives, the existing process is preempted.
3. Priority Scheduling
• Priority is assigned for each process.
• Process with highest priority is executed first and so on.
• Processes with same priority are executed in FCFS manner.
• Priority can be decided based on memory requirements, time requirements or any other resource requirement.

4. Round Robin(RR) Scheduling


• A fixed time is allotted to each process, called quantum, for execution.
• Once a process is executed for given time period that process is preempted and other process executes for given
time period.
• Context switching is used to save states of preempted processes.

You might also like