0% found this document useful (0 votes)
105 views26 pages

Important Question Operating System 1

The document discusses several questions and answers about operating systems. It provides definitions for multi-programming, multi-tasking, and multi-processing systems. It lists seven common operating system services: program execution, file systems, I/O operations, communication, resource allocation, error detection, and accounting. It defines an operating system as a collection of software that manages computer hardware resources and provides common services. As a resource manager, an operating system schedules resources, monitors resources, protects resources, and allows resource sharing. The document also describes different types of operating systems like batch, multiprogramming, multitasking, multiprocessors, distributed, and real-time operating systems. It lists several tasks performed by operating systems like bo

Uploaded by

bihirof259
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)
105 views26 pages

Important Question Operating System 1

The document discusses several questions and answers about operating systems. It provides definitions for multi-programming, multi-tasking, and multi-processing systems. It lists seven common operating system services: program execution, file systems, I/O operations, communication, resource allocation, error detection, and accounting. It defines an operating system as a collection of software that manages computer hardware resources and provides common services. As a resource manager, an operating system schedules resources, monitors resources, protects resources, and allows resource sharing. The document also describes different types of operating systems like batch, multiprogramming, multitasking, multiprocessors, distributed, and real-time operating systems. It lists several tasks performed by operating systems like bo

Uploaded by

bihirof259
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/ 26

IMPORTANT QUESTION OPERATING SYSTEM

Chapter-1- INTRODUCTION
Q1. Give the Difference between Multi-Programming, Multi-tasking , Multiprocessing System.
Ans.

Q2. Write different operating system services.


Ans.
1. Program execution:-The operating system must be able to load a program into
memory and execute that program. Furthermore, the program must be able to
terminate its execution, either normally or abnormally/forcefully.
2. File systems:-Operating systems have a file-handling feature that allows users to read
and write programs as files and directories. This feature enables users to create or
delete files with specific names and extensions, search for a particular file, and list file
information.
3. I/O operation:-When a program runs, it may need I/O (Input/Output) operations to
interact with files or other devices. However, users cannot directly control I/O devices for
efficiency and security reasons. Therefore, the operating system provides a way to
perform I/O operations, such as reading from and writing to files.
4. Communication:-The process needs to communicate with another process to exchange
information. Whether processes are executing on the same computer or different ones,
operating systems provide communication support. Two main communication methods
exist between two processes: shared memory and message passing.
5. Resource Allocation:-When multiple jobs are running concurrently, allocating resources
to each is necessary. These resources may include CPU cycles, main memory storage,
file storage, and I/O devices. CPU scheduling routines are employed to determine the
best use of the CPU.
6. Error Detection:-Errors may occur in CPU, memory, I/O devices, or user programs. The
OS takes appropriate action for each error to ensure correct and consistent computing.
7. Accounting:-This operating system service keeps track of which users are using how
much and what kinds of computer resources have been used for accounting or to
accumulate usage statistics.
8. Protection and security:-System resources must be accessed in a controlled manner.
For security, users authenticate via login ID and password.

Q3. What is an Operating system? Give the view of Os as a resource manager.


Ans.
- An operating system(OS) is a collection of systems software that manages computer
hardware resources and provides common services for computer programs.

- The operating system is a resource manager, which means that it manages and allocates the
resources of the computer system, such as CPU, memory, disk, network, and devices. The
operating system performs the following functions as a resource manager:

1. Resource scheduling: It decides which process or user gets access to a resource and for how
long.
2. Resource monitoring: It keeps track of the status and usage of the resources, and collects
statistics and performance data.
3. Resource protection: It prevents unauthorized or improper access to the resources, and
enforces security and privacy policies.
4. Resource sharing: It allows multiple processes or users to share the same or different
resources, and coordinates the communication and synchronization among them.

Q4. Explain different types of Os and also explain different types of tasks done by Os .
Ans.
- Different Types of OS:-

1. Batch Operating System:-This type of operating system does not interact with the user
directly. It executes a batch of similar jobs together, without any user intervention. The jobs
are prepared offline and submitted to the computer operator, who sorts them and runs them
as a group.

2. Multiprogramming Operating System:-This type of operating system allows multiple


programs to reside in the main memory at the same time, and executes them one by one.
The operating system allocates the CPU time to each program, and switches between them
when one program is waiting for input or output.
This type of operating system improves the CPU utilization and reduces the response time, as
the CPU does not remain idle.

3. MultiTasking Operating System:-This type of operating system allows a single user to run
multiple programs or tasks simultaneously on the same computer. The operating system
divides the CPU time into small slices, and assigns them to each task in a round-robin
fashion. The user can switch between the tasks, and the operating system maintains the state
of each task.

4. MultiProcessors Operating System:-This type of operating system uses more than one
processor to execute the programs. The processors can work independently or cooperatively,
depending on the system architecture. This type of operating system increases the
throughput and reliability of the system, as multiple processors can share the Workload and
handle failures.

5. Distributed Operating System:-This type of operating system connects multiple


independent computers or nodes through a network, and makes them appear as a single
computer to the user. The operating system distributes the tasks and resources among the
nodes, and coordinates the communication and synchronization among them.
- This type of operating system provides high performance, scalability, fault tolerance, and
transparency to the user.

6. Real time Operating System:-A real time operating system(RTOS) promises a certain
capability within a specified time constraint.
- It is defined as an operating system known to give maximum time for each of the critical
operations that it performs, like OS calls and interrupt handling.

Its is of two type:-


1. Hard real time system:-
The Real-Time Operating system which guarantees the maximum time for critical operations
and complete them on time are referred to as Hard Real-Time Operating Systems.

If the system fails to meet the deadline even once the system is considered to have Failed.

E.g. Defence applications, nuclear system etc. Missing deadlines creates hazards.

2. Soft real time system:-


The critical task will get priority over other tasks, but no assurity of completing it in a
defined time.These systems are referred to as Soft Real-Time Operating Systems.

E.g. Audio-Video streaming etc.

- Different tasks done by Os:-


1. Booting :- The operating system is responsible for starting up the computer and loading the
necessary software and drivers into the memory. It also done some selftest diagnostics.
2. Memory management:- The operating system is responsible for managing the main
memory and the secondary memory of the system. The operating system allocates and
deallocates the memory space to the programs and data, and ensures that they do not
overlap or interfere with each other.
- The operating system also implements techniques such as paging, segmentation, and virtual
memory to improve the memory efficiency and performance.
3. Process Management:- The operating system is responsible for creating, executing, and
terminating the processes or programs that run on the system. The operating system also
schedules the processes and assigns them the CPU time and other resources.
- The operating system also handles the communication and synchronization among the
process, and resolves the conflict and deadlocks that may occurs.
4. File Management:- The operating system is responsible for managing the files and
directories that are stored on the disk or other storage devices. The operating system
provides the user with a logical and hierarchical view of the files, and allows the user to
create, delete, rename, copy, move, and access the files.
5. User interface:- The operating system is responsible for providing the user with a
convenient and friendly way to interact with the system and the applications. The operating
system can provide a graphical user interface (GUI) or a command-line interface (CLI),
depending on the user preference and system capability.
6. Security:- The operating system is responsible for protecting the system and the data from
unauthorized or malicious access, modification, or deletion. The operating system
implements mechanisms such as encryption, authentication, authorization, and auditing to
ensure the confidentiality, integrity, and availability of the system and the data. The Os also
detects and prevents the attacks and threats from the different virus.

Q.5. Explain the different view of Operating System.

Ans. The operating system can be viewed from different perspectives, such as:

• The user view: The user sees the operating system as a virtual machine that provides
services and interfaces for various applications and users to access the network.
• The hardware view: The hardware sees the operating system as a resource manager
that controls the access and operation of the hardware resources, such as CPU,
memory, disk, network, and devices.
• The system view: The operating system sees itself as a program that executes a set of
instructions and performs various functions and tasks, such as booting, memory
management, process management, file management, device management, user
interface, and security.

Q.6. Explain evolution of operating system in details.


Ans.

• The first generation (1940s to 1950s) Vaccum Tubes:- In this generation, there was no
operating system as we know it today. The users had to interact with the hardware
directly, and write programs in machine language or assembly language for each task.
The programs were executed one by one, and the users had to manually load and
unload the programs using punch cards or tapes. The computers were very slow and
expensive, and the utilization and efficiency were very low.
• The second generation (1950s to 1960s) Transistors & Batchs System:- In this
generation, the operating system was based on the batch processing system, which
means that the similar jobs were grouped together and executed as a batch, without
any user intervention. The jobs were submitted to the computer operator, who sorted
them and ran them using a monitor program. The monitor program was a simple
operating system that controlled the input and output devices, and transferred the
control to the user program. The batch processing system improved the utilization and
throughput of the system, but the response time and interaction were still poor.
• The third generation (1960s to 1970s) Integrated Circuit & Multiprogramming: In this
generation, the operating system was based on the multiprogramming system, which
means that the multiple programs were loaded into the main memory at the same time,
and executed one by one. The operating system allocated the CPU time to each
program, and switched between them when one program was waiting for input or
output. The multiprogramming system improved the CPU utilization and response time,
as the CPU did not remain idle. The operating system also introduced the concepts of
time-sharing, multiprocessing, and spooling in this generation.
• The fourth generation (1980s to present) PersonalComputers: In this generation, the
operating system was based on the personal computer system, which means that the
single user could run multiple programs or tasks simultaneously on the same computer.
The operating system divided the CPU time into small slices, and assigned them to each
task in a round-robin fashion. The user could interact with the system in real time, and
the operating system provided a graphical user interface (GUI) and various features such
as wireless communication, multimedia, sensors, and applications. The operating
system also evolved to support the concepts of distributed system, network system,
real-time system, and mobile system in this generation.

Q.7. What Is System Call? Explain the steps for system Call Execution.

Ans. A system call is a mechanism that provides the interface between a process and the
operating system. It is a programmatic method in which a computer program requests a service
from the kernel of the operating system. System call offers the services of the operating system
to the user programs via API (Application Programming Interface). Some examples of system
calls are read, write, open, close, fork, exec, exit, etc.
The steps for system call execution are as follows:

• The user program invokes a system call by executing a specific instruction, such as
syscall, int, or trap, which causes a software interrupt and transfers the control to the
operating system.
• The operating system identifies the system call number and its parameters, which are
usually passed through registers, stack, or memory. The operating system then verifies
the validity and legality of the system call and its parameters, and checks the
permissions and privileges of the user program.
• The operating system executes the system call by performing the requested service or
operation, such as accessing a file, creating a process, or sending a message. The
operating system may also update the system state and data structures, such as process
table, file table, or message queue.
• The operating system returns the result of the system call to the user program, which
may be a success or failure code, or some data. The operating system also restores the
control to the user program, and resumes its execution from the point where the
system call was invoked.

Q.8. What is kernal? Differentiate between monolithic Kernal and micro Kernal.

Ans. A kernel is a computer program that is the core or essential part of a computer’s operating
system. It is the main layer between the software running on your computer and its hardware.
The kernel has complete control over everything in the system, and it performs various
functions such as memory management, processor management, device management, file
management, and user interface. The kernel also provides services and interfaces for other
application programs to run and access the network services.
MCQ QUESTION AND PREVIOUS MID SEM QUESTION

CHAPTER-1

Q.1. OS is type of ……………… software.

A. System

B. Application

C. Utility

D. None of the above

Ans. A. System

Q.2. Main purpose of OS is …………….. .

A. UI

B. I/O
C. Execution

D. All of the above

Ans. D. All of the above

Q.3. Blue screen is displayed when ………….. error is there.

A. Kernel

B. I/O

C. Fatal

D. Initialization

Ans. C.Fatal

Q.4. Explain types of Software.

Ans. Program is a collection of code/instruction and software is a collection of a program.

There are three main types of software:-

1. System software:- System software is the software that directly operates the computer
hardware and provides the basic functionality to the users as well as to the other
software to operate smoothly. It is like an interface between hardware and user
applications, and it helps them to communicate with each other.
Examples of system software are operating systems, language processors, Operating
System and device drivers.

2. Application Software:- Application software is the software that is designed to perform


specific tasks for users or other applications. It is also known as end-user software, as it
is used by the end users to accomplish their goals.
Examples of application software are web browsers, spreadsheets, word processors,
games, and media players.

3. Utility Software:- Utility software is a type of system software that provides additional
features and services to the users and the system software. It is also known as service
software, as it helps to maintain, optimize, and protect the computer system. Examples
of utility software are antivirus, disk defragmenter, backup, and file compression.
IMPORTANT QUESTION

CHAPTER-2

Q.1. What is Process? Draw Five State Process Model and Explain it.

Ans. A process is a program in execution that consists of a number of elements, such


as program code, data, stack, heap, registers, and program counter. A process is the
basic unit of work that can be scheduled and executed by the operating system.

The five state process model is a way of describing the possible states and transitions
of a process during its lifetime. The five states are:

• New: The process has been created but has not yet been admitted to the
ready queue by the operating system. The process is waiting for the allocation
of memory and other resources.
• Ready: The process is in the ready queue, waiting for the CPU to be assigned
to it by the scheduler. The process has all the resources it needs to run, except
for the CPU.
• Running: The process is currently executing on the CPU. The process may
perform input/output operations, computations, or system calls.
• Blocked: The process is unable to continue running until some external event
occurs, such as the completion of an input/output operation, the availability
of a resource, or a signal from another process. The process is moved to the
blocked queue until the event occurs.
• Exit: The process has finished its execution or has been terminated by the
operating system. The process releases all the resources it has acquired and is
removed from the system.

The following diagram shows the five state process model and the possible transitions
between them:
Q.2. Explain process control Block with diagram.
Ans.
Q.3. Difference between process and thread.
Ans.

Q.4. Define the following terms.


Ans.

1. Throughput:- Throughput is a measure of how much data can pass


through a system in a given amount of time. It's also known as data
transfer rate.

2. Waiting time:- Waitingtime (WT) is defined as the total time that is


spent by the process while staying in a ready queue before it
reaches the CPU. The difference between turnaround time and
burst time is called the waiting time of a process.

3. Turnaround time:- Turnaround time refers to the time interval from


the time of submission of a process towards the time of the
finishing of the process. Turnaround time can also be considered
the addition of the time periods spent waiting to get into memory
or ready queue and execution on CPU .
4. Response time:- Response
time is the amount of time it takes for the
CPU to respond to a request made by a process. It is the
duration between the arrival of a process and the first time it
runs.

5. Short term scheduler:- A short-term scheduler is an operating system


scheduler that chooses processes from the job queue and loads them
to execution in the main memory
It is also known as the CPU scheduler or the Job Scheduler.
6. CPU utilization:- CPU
utilization indicates the amount of load handled
by individual processor cores to run various programs on a
computer.
Q.5. (i) Define process. Differentiate between a process and a program.

Ans. A process in an operating system (OS) is a program that is currently


being executed. A process is a basic unit of work that can be scheduled
and executed by the OS.

(ii). Explain different states of a process with a suitable diagram.


Ans.
Q.6. Explain threads in brief with its types. What is multithreading? Explain.
Ans. A thread is a lightweight sub-process, the smallest unit of processing. It is a separate path of
execution that can run concurrently with other threads within the same process. Threads share the
same memory and resources as the process that created them, which enables them to collaborate
and work efficiently.
There are different types of threads based on their origin, functionality, and implementation. Some of
the common types of threads are:

• User-level threads: These are threads that are created and managed by the user-level
libraries, without the direct involvement of the operating system. User-level threads are faster
to create and switch, but they cannot take advantage of the multiprocessing features of the
system.
• Kernel-level threads: These are threads that are created and managed by the operating
system kernel. Kernel-level threads can utilize the multiple processors of the system, but they
are slower to create and switch, and they consume more system resources.

MULTITHREADING:-

Multithreading is a technique of executing multiple threads simultaneously within a single


process. The main purpose of multithreading is to improve the performance and responsiveness
of the system by utilizing the CPU time efficiently.

Q.7. Give difference between process vs threads.

Ans.

Q.8. Difference between user level thread and kernal level thread.

Ans.
Q.9. Explain RR with example.

Ans. RR in OS stands for Round Robin scheduling, which is a CPU scheduling


algorithm that assigns each process a fixed time slot or quantum for execution. It is a
preemptive algorithm, which means that the scheduler can interrupt the running
process and switch to another one when the time quantum expires. This way, all
processes get a fair share of the CPU and no process starves. RR scheduling is suitable
for time-sharing systems, where multiple users can interact with the system
simultaneously.

An example of RR scheduling is as follows:

Suppose there are four processes P1, P2, P3, and P4 with the following arrival time
and burst time:

Process Arrival Time Burst Time

P1 0 5

P2 1 4
Process Arrival Time Burst Time

P3 2 2

P4 4 1

Assume the time quantum is 2 units. The Gantt chart for RR scheduling is:

Time Process

0 P1

2 P2

4 P3

6 P4

7 P1

9 P2

The completion time, turnaround time, and waiting time for each process are:
Process Completion Time Turnaround Time Waiting Time

P1 9 9 4

P2 11 10 6

P3 6 4 2

P4 7 3 2

The average turnaround time is (9 + 10 + 4 + 3) / 4 = 6.5 units.

The average waiting time is (4 + 6 + 2 + 2) / 4 = 3.5 units.

Q.10. Explain SJF with example.

Ans. SJF stands for Shortest Job First, which is a CPU scheduling algorithm that
selects the process with the smallest execution time to run next. SJF can be either
preemptive or non-preemptive, depending on whether the scheduler can interrupt the
running process or not. SJF aims to minimize the average waiting time and turnaround
time for the processes. An example of non-preemptive SJF is as follows:

Suppose there are four processes P1, P2, P3, and P4 with the following arrival time
and burst time:

Process Arrival Time Burst Time

P1 0 5
Process Arrival Time Burst Time

P2 1 4

P3 2 2

P4 4 1

The Gantt chart for non-preemptive SJF is:

Time Process

0 P1

5 P3

7 P4

8 P2

The average waiting time is (0 + 3 + 5 + 4) / 4 = 3 units.

The average turnaround time is (5 + 5 + 6 + 7) / 4 = 5.75 units.

An example of preemptive SJF is as follows:

Suppose there are four processes P1, P2, P3, and P4 with the following arrival time
and burst time:
Process Arrival Time Burst Time

P1 0 8

P2 1 4

P3 2 2

P4 3 1

The Gantt chart for preemptive SJF is:

Time Process

0 P1

1 P2

2 P3

4 P4

5 P2

9 P1
The average waiting time is (7 + 3 + 0 + 1) / 4 = 2.75 units.

The average turnaround time is (9 + 7 + 2 + 2) / 4 = 5 units.

Q.11. Explain FCFS with example.

Ans. FCFS stands for First Come First Serve, which is a CPU scheduling algorithm
that executes the processes in the order of their arrival. It is a simple and fair
algorithm that does not consider the priority or the burst time of the processes. It is
implemented using a FIFO queue, where the process at the head of the queue gets the
CPU first.

An example of FCFS scheduling is as follows:

Suppose there are four processes P1, P2, P3, and P4 with the following arrival time
and burst time:

Process Arrival Time Burst Time

P1 0 5

P2 1 4

P3 2 2

P4 4 1

The Gantt chart for FCFS scheduling is:


Time Process

0 P1

5 P2

9 P3

11 P4

The completion time, turnaround time, and waiting time for each process are:

Process Completion Time Turnaround Time Waiting Time

P1 5 5 0

P2 9 8 4

P3 11 9 7

P4 12 8 7

The average turnaround time is (5 + 8 + 9 + 8) / 4 = 7.5 units.

The average waiting time is (0 + 4 + 7 + 7) / 4 = 4.5 units.


IMPORTANT QUESTION

CHAPTER -3

Q.1. What is IPC. And why we need it .

Ans. IPC stands for Inter Process Communication, which is a mechanism that allows
processes to communicate with each other and synchronize their actions. Processes
are programs that are running on an operating system, and they may need to share data
or resources with other processes. IPC enables processes to exchange information and
cooperate with each other.

We need IPC for various reasons, such as:

• To increase the performance and efficiency of the system by utilizing the CPU
time and memory space effectively.
• To enable modularity and convenience in the design and development of
complex applications that consist of multiple processes.
• To provide privilege separation and security for the processes that have
different access levels and permissions.
• To handle concurrent events and requests in a better way, such as in web
servers, games, and animation.

Q.2. What is critical section?

Ans. A critical section is a segment of code that accesses shared resources and must be
executed atomically by only one thread or process at a time to avoid data
inconsistency or race conditions. A critical section may contain shared variables, files,
or other system resources that can only be accessed by one thread or process at a time.
The operating system provides synchronization mechanisms, such as semaphores,
mutexes, monitors, and condition variables, to ensure that only one thread or process
can enter the critical section at a time. The purpose of a critical section is to ensure the
correctness and consistency of the data and the system.

Q.3. Explain race condition with example.

Ans. A race condition is a problem that occurs when two or more processes or threads
access a shared resource at the same time and the outcome depends on who runs
precisely when. It can cause unexpected behavior, data corruption, security
vulnerabilities, and performance degradation. For example, if two processes try to
modify the same file at the same time, the final state of the file may be unpredictable
and inconsistent. To prevent race conditions, synchronization mechanisms such as
locks, semaphores, monitors, and condition variables can be used to ensure that only
one process or thread can access the shared resource at a time.

Short question:-

• IPC Leads to deadlock.


• Race condition occur at critical section.

You might also like