Important Question Operating System 1
Important Question Operating System 1
Chapter-1- INTRODUCTION
Q1. Give the Difference between Multi-Programming, Multi-tasking , Multiprocessing System.
Ans.
- 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.
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.
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.
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.
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.
• 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
A. System
B. Application
C. Utility
Ans. A. System
A. UI
B. I/O
C. Execution
A. Kernel
B. I/O
C. Fatal
D. Initialization
Ans. C.Fatal
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.
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.
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.
• 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:-
Ans.
Q.8. Difference between user level thread and kernal level thread.
Ans.
Q.9. Explain RR with example.
Suppose there are four processes P1, P2, P3, and P4 with the following arrival time
and 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
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:
P1 0 5
Process Arrival Time Burst Time
P2 1 4
P3 2 2
P4 4 1
Time Process
0 P1
5 P3
7 P4
8 P2
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
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.
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.
Suppose there are four processes P1, P2, P3, and P4 with the following arrival time
and burst time:
P1 0 5
P2 1 4
P3 2 2
P4 4 1
0 P1
5 P2
9 P3
11 P4
The completion time, turnaround time, and waiting time for each process are:
P1 5 5 0
P2 9 8 4
P3 11 9 7
P4 12 8 7
CHAPTER -3
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.
• 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.
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.
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:-