Set:-1 Tribhuvan University: Group A Attempt All The Questions. (10 1 10) Circle The Correct Answer
Set:-1 Tribhuvan University: Group A Attempt All The Questions. (10 1 10) Circle The Correct Answer
Set:- 1
Tribhuvan University
Bachelor in Computer Applications (BCA) Full Marks: 60
Course Title: Operating System Pass Marks: 24
Code No: CACS251 Time: 3 hours
Semester: 4th
Group A
Attempt all the questions. [101 = 10]
2. What is critical section? How strict alternations solve the Critical section problem?
Ans:- The critical section is a code segment where the shared variables can be accessed. An atomic action
is required in a critical section i.e. only one process can execute in its critical section at a time. All the other
processes have to wait to execute in their critical sections.
The solution to the critical section problem must satisfy the following conditions-
Mutual Exclusion:- Mutual exclusion implies that only one process can be inside the critical section at any
time. If any other processes require the critical section, they must wait until it is free.
Progress:- Progress means that if a process is not using the critical section, then it should not stop any other
process from accessing it. In other words, any process can enter a critical section if it is free.
Bounded Waiting There must be some limit to the number of times a process can go into the critical
section i.e. there must be some upper bound. If no upper bound is there then the same process will be
allowed to go into the critical section again and again and other processes will never get a chance to get
into the critical section.
So, in order to remove the problem of race condition, there must be synchronization between
various processes present in the system for its execution otherwise, it may lead to data inconsistency i.e.
a proper order should be defined in which the processes can execute.
Basic In microkernel user services and kernel, In monolithic kernel, both user services and kernel services
services are kept in separate address space. are kept in the same address space.
Size Microkernel are smaller in size. Monolithic kernel is larger than microkernel.
Extendible The microkernel is easily extendible. The monolithic kernel is hard to extend.
Security If a service crashes, it does effect on working If a service crashes, the whole system crashes in monolithic
of microkernel. kernel.
Code To write a microkernel, more code is required. To write a monolithic kernel, less code is required.
Example QNX, Symbian, L4Linux, Singularity, K42, Linux, BSDs (FreeBSD, OpenBSD, NetBSD), Microsoft
Mac OS X, Integrity, PikeOS, HURD, Minix, Windows (95,98,Me), Solaris, OS-9, AIX, HP-UX, DOS,
and Coyotos. OpenVMS, XTS-400 etc.
The diagram above shows the single-threaded process and the multi-threaded process. A single-threaded
process is a process with a single thread. A multi-threaded process is a process with multiple threads. As the
diagram clearly shows that the multiple threads in it have its own registers, stack, and counter but they share the
code and data segment.
6. Suppose a new process in a system arrives at an average of six processes per minute and each such process
requires an average of 8 seconds of service time. Estimate the fraction of time the CPU is busy in a system
with a single processor.
Ans:- Solve your self.
7. Assume you have the following jobs to execute with one processor, with the jobs arriving in the order listed
here:
Process Arrival time Burst time
A 0 3
B 2 5
C 4 4
D 6 1
E 8 2
a. Suppose a system uses HRNN scheduling .Create a Gantt chart illustrating the execution of these
processes?
b. What is the average wait time for the processes?
c. What is the average turnaround time for the processes?
Ans:- Test your self.
Group C
Long Questions
Attempt any two questions. (10*2=20)
1. “Operating system is resource manager” Justify this statement with suitable functionality of OS.
Ans:- An Operating System is a collection of programs and utilities. It acts as an interface
between user and computer. It creates the user-friendly environment.
The operating system acts as the manager of these resources and allocates them to specific programs and users as
necessary for their tasks. Therefore we can say an operating system is a resource manager/allocator. This is the
main features of an operating system.
When a number of computers connected through a network more than one computers trying for a computer
print or a common resource, then the operating system follow same order and manage the resources in an efficient
manner.
Generally, resources sharing in two ways "in time" and "in space". When a resource is a time-sharing resource, first
one of the tasks get the resource for some time, then another and so on.
For example, a CPU in the time-sharing system. In the time-sharing system, OS fixes the time slot for the
CPU. First one of the processes gets the CPU, when the time slot expires, the CPU switch to the next process in the
ready queue. In this example, the CPU is a time resource. CPU Scheduling in Operating System
The other kind of sharing is the "space sharing". In this method, the users share the space of resource. For example,
the main memory consisting of several processes at a time, so the process of sharing the resources.
The main difference between "in time" sharing resources and "in space" sharing resources is "in time" resources
are not divided into units, whereas "in space" sharing resources are divided into units.
Set:- 2
Tribhuvan University
Bachelor in Computer Applications (BCA) Full Marks: 60
Course Title: Operating System Pass Marks: 24
Code No: CACS251 Time: 3 hours
Semester: 4th
Group A
Attempt all the questions. [101 = 10]
Time Sharing is the logical extension of multiprogramming, in this time sharing Operating system many
users/processes are allocated with computer resources in respective time slots. In this the processors
time is shared with multiple users that’s why it is called as time sharing operating system. It has a fixed
time slice for the different processes. Its main purpose is interactive response time.
Advantage of Time Sharing OS : Disadvantages of Time Sharing OS :
Quick response. It consumes much resources.
Reduces CPU idle time. Requires high specification of hardware.
All the tasks are given specific time. It has a problem of reliability.
Less probability of duplication of software. Security and Integrity concerns.
Improves response time. Probability of data communication problem.
P0 (0 - 0) + (12 - 3) = 9
P1 (3 - 1) = 2
P3 (9 - 3) + (17 - 12) = 11
8. How deadlock is differing from starvation. Explain necessary condition for deadlock?
Ans:- The main differing from deadlock and starvation is that deadlock occurs when each process holds a resource and waits to
obtain a resource held by another process while starvation occurs when a process waits for an indefinite period of time to obtain
a required resource.
There are four different conditions that result in Deadlock. These four conditions are also known as Coffman conditions and
these conditions are not mutually exclusive. Let's look at them one by one.
Mutual Exclusion: A resource can be held by only one process at a time. In other words, if a process P1 is using some
resource R at a particular instant of time, then some other process P2
can't hold or use the same resource R at that particular instant of time.
The process P2 can make a request for that resource R but it can't use
that resource simultaneously with process P1.
Hold and Wait: A process can hold a number of resources at a time
and at the same time, it can request for other resources that are being held by some other process. For example, a process
P1 can hold two resources R1 and R2 and at the
same time, it can request some resource R3 that is
currently held by process P2.
No preemption: A resource can't be preempted
from the process by another process, forcefully. For
example, if a process P1 is using some resource R,
then some other process P2 can't forcefully take that resource. If it is so, then what's the need for various scheduling
algorithm. The process P2 can request for the resource R and can wait for that resource to be freed by the process P1.
Circular Wait: Circular wait is a condition when the first process is waiting for the resource held by the second
process, the second process is waiting for the resource held by the
third process, and so on. At last, the last process is waiting for the
resource held by the first process. So, every process is waiting for
each other to release the resource and no one is releasing their own
resource. Everyone is waiting here for getting the resource. This is
called a circular wait.
Deadlock will happen if all the above four conditions happen
simultaneously.
10. What does file mean? Explain how access control matrix provides resources protection that may access
process?
Ans:- A file is a container in a computer system for storing information. Files used in computers are similar
in features to that of paper documents used in library and office files. There are different types of files such
as text files, data files, directory files, binary and graphic files, and these different types of files store
different types of information. In a computer operating system, files can be stored on optical drives, hard
drives or other types of storage devices.
Access Matrix is a security model of protection state in computer system. It is represented as a matrix.
Access matrix is used to define the rights of each process executing in the domain with respect to each
object. The rows of matrix represent domains and columns represent objects.
11. What do you mean by one time password in authentication? How worms are differing from virus?
Ans:- A one-time password (OTP) is an automatically generated numeric or alphanumeric string of
characters that authenticates the user for a single transaction or login session. An OTP is more secure than
a static password, especially a user-created password, which can be weak and/or reused across multiple
accounts. OTPs may replace authentication login information or may be used in addition to it in order to
add another layer of security.
Worms : is similar to virus but it does not modify the program. It replicate itself more and more to
cause slow down the computer system. Worms can be controlled by remote. The main objective of
worms to eat the system resources.
Virus : is a malicious executable code attached to another executable file which can be harmless or can
modify or delete data. When the computer program runs attached with virus it perform some action such
as deleting a file from the computer system. Virus can’t be controlled by remote.
12. Suppose a new process in a system arrives at an average of six processes per minute and each such
process requires an average of 8 seconds of service time. Estimate the fraction of time the CPU is busy
in a system with a single processor
Ans:- Solve yourself.
10 | P a g e Ghanashyam Dhungana
OS Solution For BCA 4th Semester
13. Assume you have the following jobs to execute with one processor, with the jobs arriving in the order
listed here:
Process Arrival time Burst time
A 0 3
B 2 5
C 4 4
D 6 1
E 8 2
d. Suppose a system uses HRNN scheduling .Create a Gantt chart illustrating the execution of these
processes?
e. What is the average wait time for the processes?
f. What is the average turnaround time for the processes?
Ans:- Solve yourself.
Group-C
Attempt any two questions [10X2=20]
1. What is process? Explain different States of process with diagram. Also explain in details the
contents of PCB of a process.
2. What is process synchronization? Write and explain the solution for classical Reader-writer
synchronization problem.
3. Consider the following System:
11 | P a g e Ghanashyam Dhungana