0% found this document useful (0 votes)
54 views

Operating System QB

The document discusses operating systems and their functions. An operating system acts as an interface between hardware and software, managing tasks like file management, memory management, process management, input/output control, and device management. It also discusses different components of an operating system like the dispatcher, which allocates the CPU to the next selected process after context switching. Various services provided by operating systems are also outlined, such as program execution, I/O operations, file manipulation, communication, error handling, resource management, and protection.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
54 views

Operating System QB

The document discusses operating systems and their functions. An operating system acts as an interface between hardware and software, managing tasks like file management, memory management, process management, input/output control, and device management. It also discusses different components of an operating system like the dispatcher, which allocates the CPU to the next selected process after context switching. Various services provided by operating systems are also outlined, such as program execution, I/O operations, file manipulation, communication, error handling, resource management, and protection.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 12

a)What is an Operating system?Write functions of Operating System?

Ans:-Operating System is an interface between the user and the hardware and enables the
interaction of a computer’s hardware and software.

Also, an operating system is a software which performs all the basic tasks like file
management, memory management, storage management, process management, handling
input and output, and controlling peripheral devices such as disk drives and printers.

Functions:-

1. DEVICE MANAGEMENT –
Operating System manages device communication via their respective drivers.

2. FILE MANAGEMENT –
The operating system allocates and de-allocates resources. It regulates which process gets
the file and for what duration. Also, it keeps track of information, location, uses, status etc.

3. MEMORY MANAGEMENT –
Memory management refers to the management of primary or main memory. Main memory
provides fast storage which can be accessed directly by CPU.

4. PROCESS MANAGEMENT –
Every program running on a computer is a process whether it is in the background or in
frontend. The operating system is responsible for making multiple tasks to run at the same
time (multitasking).

5. MASTERMIND –
Mastermind is one term we can rightfully use for Operating system. Reason – Operating
system performs a multitude of functions which only can be performed by super-intelligent
mind hence the term “Mastermind”.

● OS provides Booting without an Operating System


● Provides Facility to increase the Logical Memory of the Computer System by using
the Physical Memory of the Computer System.
● OS controls the Errors that have been Occurred into the Program
● Provides Recovery of the System when the System gets Damaged.

6. STORAGE MANAGEMENT –
Operating System controls all Storage Operations. Some of these include – how to store
data or files into the computers and how users will access the files. The operating system is
Responsible for Storing and Accessing the Files. Creation of Files, Creation of Directories
and Reading and Writing the data of Files and Directories and also Copy the contents of the
Files and the Directories from One Place to Another Place.

b)What is Dispatcher in OS
Ans:-A dispatcher is a special program that comes into play after the scheduler. When the
short term scheduler selects from the ready queue, the Dispatcher performs the task of
allocating the selected process to the CPU. A running process goes to the waiting state for
IO operation etc., and then the CPU is allocated to some other process. This switching of
CPU from one process to the other is called context switching.

c)Explain services provided by operating system?

Ans:-An Operating System provides services to both the users and to the programs.

● It provides programs an environment to execute.


● It provides users the services to execute the programs in a convenient manner.

Following are a few common services provided by an operating system −

● Program execution
● I/O operations
● File System manipulation
● Communication
● Error Detection
● Resource Allocation
● Protection

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.

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.

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.


● The operating system gives the permission to the program for operation on file.
● 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.

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.

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.

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.

dWhat do you mean by batch os?

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

e)What is buffering?

Ans:-The buffer is an area in the main memory used to store or hold the data temporarily. In
other words, buffer temporarily stores data transmitted from one place to another, either
between two devices or an application. The act of storing data temporarily in the buffer is
called buffering.

f)what is the role of process scheduler? explain different types of scheduling queue?

Ans:-Process Scheduling handles the selection of a process for the processor on the basis
of a scheduling algorithm and also the removal of a process from the processor. It is an
important part of multiprogramming operating system.

There are many scheduling queues that are used in process scheduling. When the
processes enter the system, they are put into the job queue. The processes that are ready to
execute in the main memory are kept in the ready queue. The processes that are waiting for
the I/O device are kept in the I/O device queue.
The different schedulers that are used for process scheduling are −

Long Term Scheduler


The job scheduler or long-term scheduler selects processes from the storage pool in the
secondary memory and loads them into the ready queue in the main memory for execution.

The long-term scheduler controls the degree of multiprogramming. It must select a careful
mixture of I/O bound and CPU bound processes to yield optimum system throughput. If it
selects too many CPU bound processes then the I/O devices are idle and if it selects too
many I/O bound processes then the processor has nothing to do.

The job of the long-term scheduler is very important and directly affects the system for a long
time.

Short Term Scheduler


The short-term scheduler selects one of the processes from the ready queue and schedules
them for execution. A scheduling algorithm is used to decide which process will be
scheduled for execution next.

The short-term scheduler executes much more frequently than the long-term scheduler as a
process may execute only for a few milliseconds.

The choices of the short term scheduler are very important. If it selects a process with a long
burst time, then all the processes after that will have to wait for a long time in the ready
queue. This is known as starvation and it may happen if a wrong decision is made by the
short-term scheduler.

A diagram that demonstrates long-term and short-term schedulers is given as follows −

Medium Term Scheduler


The medium-term scheduler swaps out a process from main memory. It can again swap in
the process later from the point it stopped executing. This can also be called as suspending
and resuming the process.

This is helpful in reducing the degree of multiprogramming. Swapping is also useful to


improve the mix of I/O bound and CPU bound processes in the memory.

g)Differentiate between Process and thread?

Ans:-Difference between Process and Thread:

S.N Process Thread


O

Thread means a segment of a process.


1. Process means any program is
in execution.

The thread takes less time to terminate.


2. The process takes more time
to terminate.

It takes less time for creation.


3. It takes more time for creation.

It takes less time for context switching.


4. It also takes more time for
context switching.

Thread is more efficient in terms of


5. The process is less efficient in communication.
terms of communication.

We don’t need multi programs in action for


6. Multiprogramming holds the multiple threads because a single process
concepts of multi-process. consists of multiple threads.

Threads share memory.


7. The process is isolated.

A Thread is lightweight as each thread in a


8. The process is called the process shares code, data, and resources.
heavyweight process.

Thread switching does not require calling an


9. Process switching uses an operating system and causes an interrupt to the
interface in an operating kernel.
system.

If a user-level thread is blocked, then all other


10. If one process is blocked then user-level threads are blocked.
it will not affect the execution
of other processes

Thread has Parents’ PCB, its own Thread Control


11. The process has its own Block, and Stack and common Address space.
Process Control Block, Stack,
and Address Space.

Since all threads of the same process share


12. Changes to the parent process address space and other resources so any
changes to the main thread may affect the
do not affect child processes. behavior of the other threads of the process.

No system call is involved, it is created using


13. A system call is involved in it. APIs.

Threads share data with each other.


14. The process does not share
data with each other.

h)Explain process state transition diagram?

Ans:-shows the state transition diagram for the process states defined above:

Logically, the first two state are similar. In both case the process is willing to run, but in the
ready state there is no CPU temporarily available for it.

(I) Running to ready state:

● A process in the running state has all of the resources that it needs for further
execution, including a processor.
● The long term scheduler picks up a new process from second memory and loads it
into the main memory when there are sufficient resources available.
● The process is now in ready state, waiting for its execution.

(II) waiting to ready:

● Process waiting for some event such as completion of I/O operation, synchronization
signal, etc.
● A process moves from waiting state to ready state if the event the
process has been waiting for, occurs.
● The process is now ready for execution.

(III) Running to waiting:


● The process in the main memory that is waiting for some event.
● A process is put in the waiting state if it must wait for some event. For example, the
process may request some resources or memory which might not be available.
● The process may be waiting for an I/O operation or it may be waiting for some other
process to finish before it can continue execution.

(IV) blocked to ready:

● The process is in secondary memory but not yet ready for execution.
● The process moves from Blocked to Ready state if the event, the process has been
waiting for occurs.

(v) Running to terminated:

● The process has finished execution.


● The OS moves a process from running state to terminated state if the process
finishes execution or if it aborts.
● Whenever the execution of a process is completed in running state, it will exit to
terminate state, which is the completion of process.

i)Describe Spooling with diagram?

Ans:-

j)Stat and explain Cpu scheduling Criteria?


Ans:-Different CPU scheduling algorithms have different properties and the choice of a
particular algorithm depends on the various factors. Many criteria have been suggested for
comparing CPU scheduling algorithms.

The criteria include the following:

1. CPU utilisation: The main objective of any CPU scheduling algorithm is to keep the
CPU as busy as possible. Theoretically, CPU utilisation can range from 0 to 100 but
in a real-time system, it varies from 40 to 90 percent depending on the load upon the
system.
2. Throughput:A measure of the work done by the CPU is the number of processes
being executed and completed per unit of time. This is called throughput. The
throughput may vary depending upon the length or duration of the processes.
3. Turnaround time: For a particular process, an important criterion is how long it takes
to execute that process. The time elapsed from the time of submission of a process
to the time of completion is known as the turnaround time. Turn-around time is the
sum of times spent waiting to get into memory, waiting in the ready queue, executing
in CPU, and waiting for I/O. The formula to calculate Turn Around Time =
Compilation Time – Arrival Time.
4. Waiting time: A scheduling algorithm does not affect the time required to complete
the process once it starts execution. It only affects the waiting time of a process i.e.
time spent by a process waiting in the ready queue. The formula for calculating
Waiting Time = Turnaround Time – Burst Time.
5. Response time: In an interactive system, turn-around time is not the best criteria. A
process may produce some output fairly early and continue computing new results
while previous results are being output to the user. Thus another criteria is the time
taken from submission of the process of request until the first response is produced.
This measure is called response time. The formula to calculate Response Time =
CPU Allocation Time(when the CPU was allocated for the first) – Arrival Time
6. Completion time: This is the time when the process completes its execution.
k)Explain Layered Operating System in brief with diagram?
Ans:- Architecture of Layered Structure

This type of operating system was created as an improvement over the early monolithic
systems. The operating system is split into various layers in the layered operating system,
and each of the layers has different functionalities. There are some rules in the
implementation of the layers as follows.

● A particular layer can access all the layers present below it, but it cannot access
them. That is, layer n-1 can access all the layers from n-2 to 0, but it cannot access
the nth
● Layer 0 deals with allocating the processes, switching between processes when
interruptions occur or the timer expires. It also deals with the basic multiprogramming
of the CPU.

Thus if the user layer wants to interact with the hardware layer, the response will be traveled
through all the layers from n-1 to 1. Each layer must be designed and implemented such that
it will need only the services provided by the layers below it.

There are six layers in the layered operating system. A diagram demonstrating these layers
is as follows:

1. Hardware: This layer interacts with the system hardware and coordinates with all the
peripheral devices used, such as a printer, mouse, keyboard, scanner, etc. These
types of hardware devices are managed in the hardware layer.
The hardware layer is the lowest and most authoritative layer in the layered
operating system architecture. It is attached directly to the core of the system.
2. CPU Scheduling: This layer deals with scheduling the processes for the CPU. Many
scheduling queues are used to handle processes. When the processes enter the
system, they are put into the job queue.
The processes that are ready to execute in the main memory are kept in the ready
queue. This layer is responsible for managing how many processes will be allocated
to the CPU and how many will stay out of the CPU.
3. Memory Management: Memory management deals with memory and moving
processes from disk to primary memory for execution and back again. This is
handled by the third layer of the operating system. All memory management is
associated with this layer. There are various types of memories in the computer like
RAM, ROM.
If you consider RAM, then it is concerned with swapping in and swapping out of
memory. When our computer runs, some processes move to the main memory
(RAM) for execution, and when programs, such as calculator, exit, it is removed from
the main memory.
4. Process Management: This layer is responsible for managing the processes, i.e.,
assigning the processor to a process and deciding how many processes will stay in
the waiting schedule. The priority of the processes is also managed in this layer. The
different algorithms used for process scheduling are FCFS (first come, first served),
SJF (shortest job first), priority scheduling, round-robin scheduling, etc.
5. I/O Buffer: I/O devices are very important in computer systems. They provide users
with the means of interacting with the system. This layer handles the buffers for the
I/O devices and makes sure that they work correctly.
Suppose you are typing from the keyboard. There is a keyboard buffer attached with
the keyboard, which stores data for a temporary time. Similarly, all input/output
devices have some buffer attached to them. This is because the input/output devices
have slow processing or storing speed. The computer uses buffers to maintain the
good timing speed of the processor and input/output devices.
6. User Programs: This is the highest layer in the layered operating system. This layer
deals with the many user programs and applications that run in an operating system,
such as word processors, games, browsers, etc. You can also call this an application
layer because it is concerned with application programs.

l)Explain ProcessControl Block in detail?


Ans:-Process Control Block is a data structure that contains information of the process
related to it. The process control block is also known as a task control block, entry of the
process table, etc.

It is very important for process management as the data structuring for processes is done in
terms of the PCB. It also defines the current state of the operating system.

Structure of the Process Control Block


The process control stores many data items that are needed for efficient process management. Some
of these data items are explained with the help of the given diagram −
The following are the data items −

Process State
This specifies the process state i.e. new, ready, running, waiting or terminated.

Process Number
This shows the number of the particular process.

Program Counter
This contains the address of the next instruction that needs to be executed in the process.

Registers
This specifies the registers that are used by the process. They may include accumulators,
index registers, stack pointers, general purpose registers etc.

List of Open Files


These are the different files that are associated with the process

CPU Scheduling Information


The process priority, pointers to scheduling queues etc. is the CPU scheduling information
that is contained in the PCB. This may also include any other scheduling parameters.

Memory Management Information


The memory management information includes the page tables or the segment tables
depending on the memory system used. It also contains the value of the base registers, limit
registers etc.

I/O Status Information


This information includes the list of I/O devices used by the process, the list of files etc.

Accounting information
The time limits, account numbers, amount of CPU used, process numbers etc. are all a part
of the PCB accounting information.

Location of the Process Control Block


The process control block is kept in a memory area that is protected from the normal user
access. This is done because it contains important process information. Some of the
operating systems place the PCB at the beginning of the kernel stack for the process as it is
a safe location.

You might also like