OPERATING-SYSTEMS Important Questions
OPERATING-SYSTEMS Important Questions
OPERATING-SYSTEMS Important Questions
S.
Introduction to OS
No.
1 What are the objectives of operating system
Ans: An operating system is a program that manages the computer hardware. it act as an
intermediate between a user of a computer and the computer hardware. It controls and
coordinates the use of the hardware among the various application programs for the various
users.
3) The API usually provides more useful functionality than the system call directly. If
you make the system call directly, you'll typically have to replicate the pre-call and post-
call code that's already implemented by the API. (For example the 'fork' API includes tons
of code beyond just making the 'fork' system call. So does 'select'.)
4) The API can support multiple versions of the operating system and detect which
version it needs to use at run time. If you call the system directly, you either need to
replicate this code or you can only support limited versions.
14 Define: process
Ans: A process is a program in execution. It is an active entity and it includes the
process stack, containing temporary data and the data section contains global variables.
16 What is scheduler?
Ans: A process migrates between the various scheduling queues through out its life
time. The OS must select processes from these queues in some fashion. This selection
process is carried out by a scheduler.
17 What are the use of job queues, ready queues and device queues?
Ans: As a process enters a system they are put in to a job queue. This queues consist of
all jobs in the system. The processes that are residing in main memory and are ready and
waiting to execute are kept on a list called ready queue. The list of processes waiting for
particular I/O devices kept in the device queue.
Increased throughput.
Economy of scale.
Increased reliability.
23 Define inter process communication.
Ans: Inter process communication provides a mechanism to allow the co-operating
process to communicate with each other and synchronies their actions without sharing
the same address space. It is provided a message passing system.
Hardware interrupts
Software interrupts
27 Identify what virtual machine is and what are the advantages virtual machines.
Ans: Virtual Machine is a completely separate individual operating system installation
on your usual operating system. It is implemented by software emulation and hardware
virtualization.
Advantages:
28 Distinguish between hard real time systems and soft real time systems.
Ans:
A Hard Real-Time System guarantees that critical tasks complete on time.
A Soft Real Time System where a critical real-time task gets priority over other tasks
and retains that priority until it completes.
29
Summarize the functions of DMA.
Ans: Direct memory access (DMA) is a method that allows an input/output (I/O)
device to send or receive data directly to or from the main memory, bypassing the
CPU to speed up memory operations. The process is managed by a chip known as a
DMA controller (DMAC).
30 Illustrate the use of fork and exec system calls.
Ans: fork() is the name of the system call that the parent process uses to "divide" itself
("fork") into two identical processes. After calling fork(), the Creatingd child process
is an exact copy of the parent except for the return value.
When the child process calls exec(), all data in the original program is lost, and it is
replaced with a running copy of the new program. This is known as overlaying.
• To allocate the separate resources of the computer as needed to solve the problem
given. The allocation process should be as fair and efficient as possible.
36 What are the five major activities of an operatingsystem with regard to process
management?
37 What are the three major activities of an operating system with regard to
memory management?
a. Keep track of which parts of memory arecurrently being used and by whom.
38 What are the three major activities of an operating system with regard to
secondary-storage management?
• Storage allocation.
• Disk scheduling
Ans:An operating system is a program that manages the computer hardware. It also
provides a basis for application programs and act as an intermediary between a user
of a computer and the computer hardware. It controls and coordinates the use of the
hardware among the various application programs for the various users.
Ans:
Program execution
I/O Operation
File-System manipulation
Communications
Error detection
41 What is the Kernel?
Ans: A more common definition is that the OS is the one program running at all times
on the computer, usually called the kernel, with all else being application programs.
Ans: Mainframe systems are the first computers developed to tackle many
commercial and scientific applications. These systems are developed from the batch
systems and then multiprogramming system and finally time sharing systems.
Ans: Multiprocessor systems have systems more than one processor for
communication, sharing thecomputer bus, the memory, clock & peripheral
devices.
44 What are the advantages of multiprocessors?
Increased throughput
Economy of scale
Increased reliability
Ans: Fork is a System calls by which a new process is created. Exec is also a System
call, which is used after a fork by one of the two processes to replace the process
memory space with a new program.
Ans:
Communications
Ans:
User Mode
Monitor Mode
48 What is meant by Batch Systems?
Ans: Operators batched together jobs with similar needs and ran through the
computer as a group .The operators would sort programs into batches with similar
requirements and as system become available, it would run each batch.
49 List the privileged instruction.
Ans:
System
Computer Hardware
PART B
2. What are the advantages and disadvantages of using the same system call interface
for both files and devices?
8. Demonstrate the three methods for passing parametersto the OS with examples.
9. Explain how protection is provided for the hardware resources by the operating
system
12. Discuss about the evolution of virtual machines. Also explain how virtualization
could be implemented in operating systems
14. Give reasons why caches are useful. What problems do they solve and cause? If a
catch can be made as large as the device for which it is catching why not make it that
large and eliminate the device?
15 Discuss the functionality of system boot withrespect to an operating system.
Ans:
Ans: When a thread is Creating the threads does not require any new resources to
execute. The thread shares the resources of the process to which it belongs to and it
requires a small data structure to hold a register set, stack, and priority.
5 Under what circumstances user level threads are better than the kernel level
threads?
Ans: User-Level threads are managed entirely by the run-time system (user-level
library).The kernel knows nothing about user-level threads and manages them as if they
were single-threaded processes. User-Level threads are small and fast, each thread is
represented by a PC, register, stack, and small thread control block. Creating a new
thread, switching between threads, and synchronizing threads are done via procedure
call. i.e. no kernel involvement. User- Level threads are hundred times faster than
Kernel- Level threads.
User level threads are simple to represent, simple to manage and fast and efficient.
7 List out the data fields associated with process control blocks.
Ans: Process ID, pointers, process state, priority, program counter, CPU registers, I/O
information,Memory management information, Accounting information, etc.
Ans: The term dispatch latency describes the amount of time it takes for a system to
respond to a request for a process to begin operation.
• Responsiveness
• Resource sharing
• Economy
• Utilization of multiprocessor architectures
Ans:
User threads:-
User threads are supported above the kernel and are implemented by a thread library at
the user level. Thread creation & scheduling are done in the user space, without kernel
intervention. Therefore they are fast to Creating and manage blocking system call will
cause the entire process to block
Kernel threads:-
Kernel threads are supported directly by the operating system .Thread creation,
scheduling and management are done by the operating system. Therefore they are
slower to Creating & manage compared to user threads. If the thread performs a
blocking system call, the kernel can schedule another thread in the application for
execution
13 What is the use of fork and exec system calls?
Ans: Fork is a system call by which a new process is Creating. Exec is also a system
call, which is used after a fork by one of the two processes to place the process
memory space with a new program.
• Switching context
• Switching to user mode
• Jumping to the proper location in the userprogram to restart that program.
• CPU utilization
• Throughput
• Turnaround time
• Waiting time
• Response time
21 What are the requirements that a solution to thecritical section problem must
satisfy?
Ans: The three requirements are
• Mutual exclusion
• Progress
• Bounded waiting
22 Define: Critical section problem.
Ans: Consider a system consists of 'n' processes. Each process has segment of code
called a critical section, in which the process may be changing common variables,
updating a table, writing a file. When one process is executing in its critical section, no
other process can allowed executing in its critical section.
23 How will you calculate turn-around time?
Ans: Turnaround time is the interval from the timeof submission to the time of
completion of a process.
It is the sum of the periods spent waiting to get into memory, waiting in the ready
queue, executing on the CPU, and doing I/O.
24 Name two hardware instructions and their definitions which can be used for
implementing mutual exclusion.
Ans:
• TestAndSet
return rv;
• Swap
b = temp;
}
25 What is a semaphore?
Ans: A semaphore 'S' is a synchronization tool which is an integer value that, apart
from initialization, is accessed only through two standard atomic operations; wait and
signal .Semaphores can be used to deal with the n-process critical section problem. It
can be also used to solve various Synchronization problems.
26 Define Deadlock.
Ans: A process requests resources; if the resources are not available at that time, the
process enters a wait state. Waiting processes may never again change state, because
the resources they have requested are held by other waiting processes. This situation is
called a deadlock.
27 List two programming examples of multithreading giving improved performance
over a single-threaded solution.
Ans:
• A Web server that services each request in a separate thread.
• A parallelized application such as matrix multiplication where different parts of
thematrix may be worked on in parallel.
• An interactive GUI program such as a debugger where a thread is used to
monitor user input, another thread represents the running application, and a
third thread
monitors performance.
c. Ignore the problem all together, and pretend that deadlocks never occur in the
system.
34 Define process?
Ans: A process is more than a program code, which is sometime known as the text
section. It also includes the current activity, as represented by the value of the program
counter and the processor’s registers.
35 Describe the actions taken by a kernel to context- switch between kernel level
threads.
Ans: Context switching between kernel threads typically requires saving the value of
the CPU registers from the thread being switched out and restoring the CPU registers of
the new thread being scheduled
Ans: The state of the process is defined in part by the current activity of that process.
Each process may be in one of the following states.
executed
Ans: Each process is represented in the operating system by a process control block
(PCB) – also called as task control block. The PCB simply serves as the repository for
any information that may vary from process to process.
38 What are the 3 different types of scheduling queues?
Ans:
Job Queue: As process enters the system theyare put into job queue.
Ready Queue: The processes that are residing in themain memory and are ready and
waiting to execute are kept in the queue.
Device Queue: The list of processes waiting forparticular I/O device is called a device
queue.
39 Define schedulers?
Ans: A process migrates between the various scheduling throughout its lifetime. The
operating system must select, for scheduling purposes, processes from these queues in
some fashion. The selection process is carried out by the appropriate scheduler.
Ans:
Long term scheduler or job scheduler selects processes from the pool and load them
into the memory for execution. Short term scheduler or CPU scheduler, select among
the processes that are ready to execute and allocates the CPU to one of them.
Ans: Under the normal mode of operation, a process may utilize a resource in only the
followingsequence:
Request: If the request cannot be granted immediately, then the requesting process
must wait until it can acquire the response.
Use: The process can operate on the resource. Release: The process releases the
resource
Ans: A deadlock situation can arise if the following4 condition hold simultaneously in
a system.
Circular Wait
Ans: A state is safe if the system allocates resources to each process in some order and
still avoid deadlock.
Ans: When several process access and manipulate same data concurrently, then the
outcome of the execution depends on particular order in which the access takes place is
called race condition. To avoid race condition, only one process at a time can
manipulate the shared variable.
Ans: The critical section problem is to design aprotocol that the processes can use to
cooperate.
Each process must request permission to enter its critical section. The section of the
code implementing this request is the entry section. The critical section is followed by
an exit section. The remaining code is the remainder section.
Ans: When a process is in its critical section, any other process that tries to enter its
critical section must loop continuously in the entry code. This is called as busy waiting
and this type of semaphore is also called a spinlock, because the process while waiting
for the lock.
Non preemptive scheduling ensures that a process relinquishes control of the CPU only
when it finishes with its current CPU burst.
1 Suppose that the following processes arrive for execution at the times indicated. Each
process will run the listed amount of time. In answering the questions, use non-
preemptive scheduling and base all decisions on the information you have at the time
the decision must be made.
Process Arrival Time Burst Time
P1 0.0 8
P2 0.4 4
P3 1.0 1
a. Find the average turnaround time for these processes with the FCFS scheduling
algorithm?
b. Find the average turnaround time for these processes with the SJF scheduling
algorithm?
c. The SJF algorithm is supposed to improve performance, but notice that we chose to
run process P1 at time 0 because we did not know that two shorter processes would
arrive soon. Find what is the average turnaround time will be if the CPU is left idle for
the first 1 unit and then SJF scheduling is used.
Remembering that processes P1 and P2 arewaiting during this idle time, so their
waiting timemay increase. This algorithm could be known as future-
knowledgescheduling.
2 State critical section problem? Discuss three solutions to solve the critical section
problem.
Illustrate an example situation in which ordinary pipes are more suitable than named
3 pipes and an example situation in which named pipes are more suitable than ordinary
pipes.
4 Explain: why interrupts are not appropriate for implementing synchronization primitives
in multiprocessor systems.
5 Elaborate the actions taken by the kernel to context-switch between processes.
6 Consider the following resource-allocation policy. Requests and releases for resources
are allowed at any time. If a request for resources cannot be satisfied because the
resources are not available, then we check any processes that are blocked, waiting for
resources. If they have the desired resources, then these resources are taken away from
them and are given to the requesting process. The vector of resources for which the
waiting process is waiting is increased to include the resources that were taken away.
For example, consider a system with three resource types and the vector
Available initialized to (4,2,2). If process P0 asks for (2,2,1), it gets them. If P1 asks for
(1,0,1), it gets them. Then, if P0 asks for (0,0,1), it is blocked (resource not available). If
P2 now asks for (2,0,0), it gets the available one (1,0,0) and one that was allocated to
P0 (since P0 is blocked).
P0‘s Allocation vector goes down to (1,2,1), and its Need vector goes up to (1,0,1).
a. Predict whether deadlock occurs? If so, give an example. If not, which necessary
condition cannotoccur?
9 Explain the differences in the degree to which the following scheduling algorithms
discriminate in favor of short processes: RR, Multilevel Feedback Queues
MEMORY MANAGEMENT
PART A
S. No Question
1 What is the difference between user-level instructions and privileged instructions?
Ans: A non-privileged (i.e. user-level) instruction is an instruction that any application or
user can execute. A privileged instruction, on the other hand, is an instruction that can only be
executed in kernel mode. Instructions are divided in this manner because privileged
instructions could harm the kernel.
Ans: In certain situations the page tables could become large enough that by paging the page
tables, one could simplify the memory allocation problem (by ensuring that everything is
allocated as fixed-size pages as opposed to variable-sized chunks) and also enable the
swapping of portions of page table that are not currently used.
Logical Physical
1. An address generated 1. An address seen by
by CPU is referred to us a memory unit that is, the one
logical address. loaded into the memory
address register of the
memory is referred to as
physical address.
7 What are the steps required to handle a page fault indemand paging? (Nov/Dec
2015)
Ans: Steps in handling page fault:
In order to reference a segment, a program must use its index inside the GDT or the LDT.
Such an index is called a segment selector or selector in short.
12 Define Overlays.
Ans: To enable a process to be larger than the amount of memory allocated to it, overlays
are used. The idea of overlays is to keep in memory only those instructions and data that
are needed at a given time.
When other instructions are needed, they are loaded into space occupied previously by
instructions that are no longer needed.
13 Define swapping.
Ans: A process needs to be in memory to be executed. However a process can be swapped
temporarily out of memory to a backing store and then brought back into memory for
continued execution. This process is called swapping.
18 What are the common strategies to select a free hole from aset of available holes?
Ans: The most common strategies are,
• First fit
• Worst fit
• Best fit
Now the freed frame can be used to hold the page for which the process faulted.
23 Formulate how long a paged memory reference takes if memory reference takes 200
nanoseconds .Assume a paging system with page table stored in memory.
Ans: 400 nanoseconds. 200 ns to access the page table plus 200 ns to access the word in
memory.
33 Under what circumstances would a user be better off using a time-sharing system,
rather than a PC or single-user workstation.
Ans:
A user is better off under three situations: when it is cheaper, faster, or easier. For
example:
1. When the user is paying for management costs, and the costs are cheaper for a time-
sharing system than for a single-user computer.
2. When running a simulation or calculation that takes too long to run on a single PC or
workstation.
3. When a user is travelling and doesn't have laptop to carry around, they can connect
remotely to a time-shared system and do their work.
Ans:
Ans:
When the allocated memory may be slightly larger than the requested memory, the
difference between these two numbers isinternal fragmentation.
Ans:
Paging is a memory management scheme that permits the physical -address space of a
process to be non-contiguous. In the case of paging, physical memory is broken into fixed-
sized blocks called frames and logical memory is broken into blocks of the same size called
pages.
Segmentation is a memory management scheme that supports the user view of memory. A
logical address space is a collection of segments. The logical address consists of segment
number and offset. If the offset is legal, it is added to the segment base to produce the
address in physical memory of the desired byte.
Ans:
All addresses need to be adjusted upward by 250.So the adjusted addresses would be 300,
328, 400, 402, and 40
Ans:
FIFO page replacement Optimal page replacement
First fit allocates the first hole that is big enough. Searching can either start at the beginning
of the set of holes or where the previous first-fit search ended. Searching can be stopped as
soonas a free hole that is big enough is found.
Ans:
A logical address does not refer to an actual existing address;rather, it refers to an
abstract address in an abstract address space. Contrast this with a physical address that
refers to an actual physical address in memory. A logical address is generated by the CPU
and is translated into a physical address by the memory management unit (MMU).
Therefore, physical addresses are generated by the MMU.
50 Consider a logical address space of 64 pages of 1024 wordseach, mapped onto a
physical memory of 32 frames.
Ans:
a. Logical address: 16 bits
PART B
1 Explain about given memory management techniques. (i) Partitioned allocation (ii) Paging
and translation look-aside buffer.
2 Elaborate about the free space management on I/O buffering and blocking.
3 What is copy-on write feature and under what circumstances it is beneficial? What hardware
support is needed to implement this feature?
4 When page faults will occur? Describe the actions taken by operating system during page
fault.
5 Consider the following page reference string:
1, 2, 3, 4, 2, 1, 5,6, 2, 1, 2, 3, 7, 6, 3, 2, 1, 2, 3, 6.
Identify the no.of page faults would occur for the following replacement algorithms,
assuming one, two, three, four, five, six, or seven frames? Remember all frames are initially
empty, so your first unique pages will all cost one fault each.
a. LRU replacement
b. FIFO replacement
c. Optimal replacement
6 Explain about the difference between internal fragmentation and external fragmentation.
8 Explain why sharing a reentrant module is easier when segmentation is used than when pure
paging is used with example.
9 Discuss situation under which the most frequently used page replacement algorithm
generates fewer page faults than the least frequently used page replacement algorithm. Also
dicuss under which circumstances the opposite holds.
10 Compare paging with segmentation in terms of the amount of memory required by the
address translation structures in orderto convert virtual addresses to physical addresses.
11 Most systems allow programs to allocate more memory to its address space during execution.
Data allocated in the heap segments of programs is an example of such allocated memory.
What is required to support dynamic memory allocation in the following schemes? (Nov/Dec
2018)
i) Contiguous memory allocation
ii)Pure segmentation
iii) Purepaging
12 Differentiate local and global page replacement algorithm.
13 Explain the basic concepts of segmentation.