Sunteți pe pagina 1din 10

CS604 - Operating Systems

Kindly give the answer of the following question (MCQs).


Which of the following is NOT a valid deadlock prevention scheme?
v Release all resources before requesting a new resource.
v Number the resources uniquely and never request a lower numbered resource than the last one
requested.
v Never request a resource after releasing any resource.
v Request and all required resources be allocated before execution.
Where does the swap space reside?
v RAM
v Disk
v ROM
v On chip cache
Wrong use of wait and signal operations (in context with semaphores) can cause____
problem(s).
v Mutual Exclusion
v Deadlock
v Bounded Waiting
v All of the given options

A set of processes are said to be in . Condition if each process in the set is waiting
for an event that only another process in the set can cause (including itself).
v Mutual Exclusion
v Deadlock
v Release
v Lock

1 KB or 1 kilobyte is equivalent to .
v 1024 bytes
v 10 bytes
v 1000 bytes
v 10000 bytes
automatically holds for printers and other non-sharables
v Hold and wait
v Circular wait
v Mutual exclusion
v No preemption
The integer value of _________ semaphores cannot be greater than 1.
v Counting
v Binary
v Mutex
v Bounded buffer
What is different in parent and child processes?
v Process ID
v Open file descriptor table
v Root directory
v Environment
Shell is the exclusive feature of
v Application Software
v System Software
v DOS
v UNIX

Round robin is very good for ..where response is an important issue.


v Scope
v Batch system
v Time sharing system
v None of the given
.happens when a dynamic memory allocation algorithm allocates some memory and
a small piece is left over that cannot be effectively used
v Fragmentation
v External Fragmentation
v Segmentation
v Internal Fragmentation
..is the name of the technique that is designed to get rid of deadlocks by
changing the specifications of the system.
v Deadlock avoidance
v Deadlock prevention
v Deadlock
v Deadlock free
Memory can be protected by using
v Base register and program counter
v Base register and memory address register
v Base register and Limit register
v Limit register and program counter
Semaphore can be used for solving __________.
v Wait & signal
v Deadlock
v Synchronization

v Priority
Which of the following statements is true for the Bankers algorithm?
v It cannot be used for a system with many resources; each of which is unique with no multiple
copies.
v It is used to detect deadlock.
v An unsafe situation will always lead to a deadlock.
v It is not applicable when many users share a resource simultaneously.
The next layer above the hardware layer in the layered approach of Operating System is
layer.
v User interface
v Kernel
v Hardware
v None of the given options
Priority of a process is..to the priority number of the process.
v Directly proportional
v Equal
v Inversely proportional
v Greater
only one process may use a resource at a time best describes which one of the following?
v Hold and wait
v Circular wait
v Mutual Exclusion
v No preemption
.occurs in a dynamic memory allocation system when many of the free blocks
are too small to satisfy any request.
v Segmentation
v Virtual memory

v Page fault
v Fragmentation
Address Binding will be _______ in Multiprogramming with Variable Tasks (MVT)
v Dynamic
v Static
v Variable
v Fixed
..and registers in the memory protection by limiting access to a process only
to its address space.
v Counter, Add
v Base, Limit
v Program Counter and Accumulator
______is used to point to the size of a process.
v Base register
v Limit register
v Stack pointer
v None of the given
______________ is the process of mapping a name to an address.
v Addressing
v Binding
v Routing
v Memory
To eliminate external fragmentation in segmentation the scheme used is ___________.
Select correct option:
v Fixed size partition scheme
v Variable size partition scheme

v Fixed size paging scheme


v Variable size paging scheme
External Fragmentation takes place in ______________
v Multiprogramming with Variable Tasks (MVT)
v Multiprogramming with Fixed Tasks (MFT)
v Multi-tasking
v Paging

define bounded waiting and progress for critical section.


2 questions about thrashing

QNo.31how page fault frequency model used to control the thrashing


Answer:Page fault frequency is another method to control thrashing. Since thrashing has a
high
page fault rate, we want to control the page fault frequency. When it is too high we
know that
the process needs more frames. Similarly if the page-fault rate is too low, then the
process may
have too many frames.
Establish acceptable page-fault rate
If rate too low, process loses frame
If rate too high, process gains frame
algorithm for critical section sharing two variables

We can use semaphores to deal with the n-process critical section problem. The n
processes share a semaphore, mutex (standing for mutual exclusion) initialized to
1. Each process Pi is organized as follows:
do
{
wait(mutex);
Critical section
signal(mutex);
Remainder section
} while(1); As was the case with the hardware-based solutions, this is not a good
solution because even though it satisfies mutual exclusion and progress, it does not
satisfy bounded wait. In a uni-processor environment, to ensure atomic execution,
while executing wait and signal, interrupts can be disabled
calculate effective time access .

equation Teffective = HR (TTLB + Tmem) + MR (TTLB + 2Tmem)


types of file structure

A file has certain defined structure characteristics according to its type. A few common types of file
structures are:
None file is a sequence of words, bytes
Simple record structure Lines Fixed length Variable length
Complex Structures Formatted document Relocatable load file
methods to recover deadlocks

nually. The other possibility is to let the system recover from the deadlock automatically. There are two
options for breaking a deadlock. One solution is simply to abort one or more processes to break the
circular wait. The second option is to preempt some resources from one or more of the deadlocked
processes.
Process Termination
To eliminate deadlocks by aborting a process, we use one of two methods. In both methods the
system reclaims all resources allocated to the terminated process.
Abort all deadlocked processes: This method clearly will break the deadlock cycle, but at a great
expense; these processes may have computed for a long time, and the results of these partial
computations must be discarded and probably recomputed later.
Abort one process at a time until the deadlock cycle is eliminated: This method incurs considerable
overhead since after each process is aborted, a deadlock detection algorithm must be invoked to
determine whether any processes are still deadlocked. Aborting a process may not be so easy. If a
process was in the midst of updating a file, terminating it will leave the system in an inconsistent
state. If the partial termination method is used, then given a set of deadlocked processes, we must
determine which process should be terminated in an attempt to break the deadlock.

Resource Preemption
To eliminate deadlocks using resource preemption, we successively preempt some resources from
processes and give these to other processes until the deadlock cycle is broken.
whether the safe sequence is necessary for safe state or not justify?

A state is safe if the system can allocate resources to each process in some order and still avoid a
deadlock. More formally a system is in a safe state only if there exists a safe sequence.
high page fault result in low cpu utilization justify

Thrashing If a process does not have enough pages, the page-fault rate is very high. This leads to low
CPU utilization. The operating system thinks that it needs to increase the degree of multiprogramming,
because it monitors CPU utilization and find it to be decreasing due to page faults. Thus another process
is added to the system and hence thrashing occurs and causes throughput to plunge.
what is munted and its types

Mounting makes file systems, files, directories, devices, and special files available for use at a particular
location. Mount point is the actual location from which the file system is mounted and accessed. You can
mount a file or directory if you have access to the file or directory being mounted and write permission
for the mount point There are types of mounts:
Remote mount
Local mount

Remote mounts are done on a remote system on which data is transmitted over a telecommunication line.
Local mounts are mounts done on your local system.
Subjective 12 questions

Name the algorithm which is used as bench mark for page replacement. (2 Marks)
A-

The simplest page-replacement algorithm is a FIFO algorithm. A FIFO


replacement algorithm associates with each page the time when that
page was brought into memory. When a page must be replaced, the
oldest page is chosen.

Assume a logical address space of 16 pages of 1024 words, each page is mapped
into a physical memory of 64 frames and each word consists of 2 bytes. You are
required to calculate total number of bits required for f (frame number). (2 Marks)
A- No. of bits neede for f = ceiling [log2 64] bits
What do we name to an address that is generated by the CPU? (2 Marks)
A-

An address generated by the CPU is commonly referred to as a logical address,


where as an address seen by the memory unitthat is, the one loaded into the memoryaddress
register of the memoryis commonly referred to as the physical address.

Critical section has hardware based or software based solutions. You have to write
the structure of the software based solution for the critical section problem.(2 Marks)
A-

Regardless of the type of solution, the structure of the solution should be as follows. The
Entry and Exist sections comprise solution for the problem.
do
{
Entry section
critical section
Exit section
remainder section
} while(1)

Look at the instructions given below, when two processes are allowed to update a
variable named counter concurrently. Counter value at start is 3. After executing
these instructions what will be the value of PI and P2? Also tell when instructions are
executed in such interleaving way what this condition is called? //some instructions
were given// (3 Marks)

If HR is hit ratio and MR is miss ratio, then how can you calculate the effective
access time? Write formula and calculate T effective on following values
Tmem=120nsec

TTLB=20nsec
HR=80% (3 Marks)
A-

If HR is hit ratio and MR is miss ratio, the effective access time is given by the following
equation Teffective = HR (TTLB + Tmem) + MR (TTLB + 2Tmem)
Tmem = 120 nsec
TTLB = 20 nsec
HR = 80 %
Teffective = 0.8 (20 + 120) + 0.2 (20 + 2*120)nanosecond
= 164 nanosecond
This means that with 80% chances of finding a page table entry in the TLB, the effective
access time becomes 64% worse than memory access time without paging.

Consider a process is in its normal execution but at some point one of its needed
resources is preempted. You are required to suggest a method to handle this situation
with all possible ways. (3 Marks)
A-

While managing computer system hardware efficiently, sometimes it seems


reasonable to service all requests that are close to current head position. You are
required to identify and analyze the technique that work on this policy.(3 Marks)
A-

A semaphore S is an integer variable that, apart from initialization is accessible only


through two standard atomic operations: wait and signal. These operations were
originally termed P (for wait) and V (for signal). The classical definitions of wait and
signal are:
wait(S) {
while(S<=0)
;// no op
S--;
}
signal(S) {
S++;
}
when one process is updating the value of a semaphore, other processes cannot
simultaneously modify that same semaphore value
We can use semaphores to deal with the n-process critical section problem. The n
processes share a semaphore, mutex (standing for mutual exclusion) initialized to 1

Is disk I/O to swap space generally faster than file system? Justify the statement
with reason in either case. (5 Marks)
A-

It seems reasonable to service all the requests close to the current head position, before
moving the head far away to service other requests. This assumption is the basis for the
shortest seek time first (SSTF) algorithm. The SSTF algorithm selects the request with
the minimum seek time from the current head position. Since seek time increases with the
number of cylinders traversed by the head, SSTF chooses the pending request closest to
the current head position.

Sometimes semaphore is not as much effective as they can be. What do you think in
which situation, it happens and what problem they create and then what they termed
are? Also tell in which situation such type of semaphores are useful and how? (5
Marks)
A-

No preemption To ensure that this condition does not hold we may use the protocol: if a
process is holding some resources and requests another that cannot be allocated
immediately to it, then all resources currently being held by the process are preempted.
These resources are implicitly released, and added to the list of resources for which the
process is waiting. The process will be restarted when it gets all its old, as well as the
newly requested resources.

Disk I/O to swap space is generally faster than that to the file system. It is faster because
swap space is allocated in much larger blocks, and file lookups and indirect allocation
methods are not used. It is therefore possible for the system to gain better paging
throughput by copying an entire file image into the swap space at process startup and
then performing demand paging from the swap space.

A system has two processes and three identical resources. Each process needs a
maximum of two resources. Is deadlock possible? Explain your answer. (5 Marks)
A- No, deadlock is not possible. If each process is allocated one resource, there is still
third resource available, and whichever process takes it, that process will be able to
run to completion.

In case of file protection, what should the file owner/creator be able to control? And
what operations need to be controlled? (5 Marks)

AFile owner/creator should be able to control


What can be done
By whom Several types of operations may be controlled:
Read: read from the file
Write: write or rewrite to the file
Execute: Load the file into memory and execute it
Append: Write new information at the end of the file
Delete: Delete the file and free its space for possible reuse
List: List the name and attributes of the file

1. what is dead lock prevention and explain how necessary condition be violated?

Deadlock prevention: is a set of methods for ensuring that at least one of the necessary conditions
cannot hold. These methods prevent deadlocks by constraining how processes can request for
resources.
2. in unix system you are required to identify access modes and classes of user in order to
implement file protection permissions

UNIX recognizes three modes of access: read, write, and execute (r, w, x).
The execute permission on a directory specifies permission to search the
directory. The three classes of users are: Owner: user is the owner of the
file Group: someone who belongs to the same group as the owner Others:
everyone else who has an account on the system
3. differentiate between page number ( p ) and page offset ( d )?

Address generated by CPU is divided into:


1. Page number (p) used as an index into a page table which contains base address of
each page in physical memory.
2. Page offset
(d) combined with base address to define the physical memory address
that is sent to the memory unit.
4. how operating sytem attack the "hold and wait " condition necessary for dead lock in
order to solve the problem of dead lock.

A process must be holding at least one resource and waiting to acquire additional
resources that
are currently being held by other processes.
5. can hard links be established between files that are on different system?

hard links cannot be established between files that are on different file systems.
6. in semaphore P and V are termed for what?
In semaphore

these operations were originally termed P (for wait) and V (for signal).

S-ar putea să vă placă și