0% found this document useful (0 votes)
55 views22 pages

cs604 Final Term - Current Papers Solved

cs604 Final term_Current Papers solved

Uploaded by

asifa Adil
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)
55 views22 pages

cs604 Final Term - Current Papers Solved

cs604 Final term_Current Papers solved

Uploaded by

asifa Adil
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/ 22

CS604-Operating System

Final term Current Papers updated (Fall 2022)


Made by RAjpoOt

Contact us: Click here

1. _________ contains the names of other files and or directories.

A. Block Special File


B. Link File
C. Ordinary File
D. Directory Correct (Page no 217)

2. In the _________ algorithm the disk arm starts at one end of the disk, and moves toward the
other end, servicing requests as it reaches each cylinder, until it gets to the other end of the
disk.
A. Scan Correct (Page no 244)
B. SSTF
C. Look
D. C-Look

3. The _______ algorithm selects the request with the minimum seek time from the current head
position.

A. Scan
B. SSTF Correct (Page no 243)
C. Look
D. C-Look

4. Assume a logical address space of 16 pages of 1024 words, each mapped into a physical
memory of 32 frames. Each word consists of 2 bytes. What will be the total number of bits
required for f (frames)?

A. 5 Correct (Page no 168)


B. 6
C. 7
D. 8
5. ___________ is the name of the technique that is designed to get rid of deadlocks by changing
the specifications of the system.

A. Deadlock avoidance Correct (Google)


B. Deadlock prevention
C. Deadlock
D. Deadlock Free

6. "Only one process may use a resource at a time" best describe which one of the following?

A. Circular wait
B. Hold and wait
C. No preemption
D. Mutual Exclusion Correct (Page no 102, 131)

7. Which of the following memory allocation scheme suffers from External fragmentation?

A. Segmentation Correct (Google)


B. Pure demand paging
C. Swapping
D. Paging

8. The principle of locality of reference justifies the use of ________


A. Virtual Memory
B. Interrupts
C. Main memory
D. Cache memory Correct (Google)

9. _________________ occurs in a dynamic memory allocation system when many of the free
blocks are too small to satisfy any request.

A. Segmentation Correct (Google)


B. Virtual memory
C. Page fault
D. Fragmentation
10. Binary semaphores only have two values, which are ____________

A. and n
B. and 0
C. 0 and 1 Correct
D. 1 and n

11. ______________ is a memory management scheme that supports programmer's view of


memory.

A. Paging
B. Segmentation Correct (Page no 175)
C. Locality of reference
D. Demand Paging

12. Segmentation is a memory management scheme that supports ___________

A. Programmer's view of memory Correct (Page no 175)


B. System's view of memory
C. Hardware view of memory
D. Virtual view of memory

13. __________ is the separation of user logical memory from physical memory

A. Virtual Memory Correct (Page no 185)


B. RAM
C. Physical memory
D. ROM
14. In _______ scheme, number of frames allocated to a process is proportional to its size.

A. Proportional Allocation Correct (Page no 204)


B. Priority Allocation
C. Variance Allocation
D. Fixed Allocation

15. For page replacement algorithms, the page fault rate may increase as the number of allocated
frames __________

A. Keep Constant
B. Increases Correct (Page no 198)
C. Decreases
D. Available

16. In case of thrashing, if CPU utilization is too low, the operating system _____________ the
degree of multiprogramming

A. Increases Correct (Page no 207)


B. Decreases
C. Increases or Decreases
D. Keep Constant

17. In --s command is used to create a _______ link.

A. Soft Correct (Page no 207)


B. Hard
C. Direct
D. Indirect
18. When a process needs to execute, memory is required by the process. The size of the process
is compared with the amount of adjacent memory available to execute the process. This
method is called ___________.

A. Contiguous Allocation Correct (Google)


B. Linked Allocation
C. Indexed Allocation
D. Variable Allocation

19. When there is no external fragmentation, free memory blocks are scattered on hard disk then
___________ is used in order to utilize these blocks for space management.

A. Indexed Allocation
B. Contiguous Allocation
C. Linked Allocation Correct (Page no 235)
D. Variable Allocation

20. The condition in which a set {P0,P1....Pn} of waiting processes must exist such that p0 is
waiting for a resource that is held by p1,p1 is waiting for a resource that is held by P2, and so
on,Pn-1 is waiting for a resource held by Pn, and Pn is waiting for a resource held by P0.

This condition is known as ________

A. Mutual exclusion
B. Hold and wait
C. No preemption
D. Circular wait Correct (Page no 128)

21. Intel 80386 used paged segmentation with ________ level paging.

A. One
B. Two Correct (Page no 185)
C. Three
D. Four
22. __________ is a variation of fork system call in several Unix operating system used for Virtual
Memory.

A. vfork() Correct (Page no 193)


B. wfork()
C. avfork()
D. bfork()

23. In a UNIX system, ___________ system call can be used to request the operating system to
memory map an opened file.

A. mmap() Correct (Page no 195)


B. fork()
C. exec()
D. read()

24. In deadlock detection and recovery algorithm, a deadlock exists in the system if and only if the
wait for graph contains a ____________.

A. Cycle Correct (Page no 144)


B. Graph
C. Edge
D. Node

25. Overlays are implemented by the

A. Operating system
B. Programmer Correct (Page no 159)
C. Kernel
D. Shell
26. In __________ page replacement algorithm oldest frame is replaced with another.

A. LIFO
B. FIFO Correct (Page no 198)
C. LRU
D. Optimal

27. A page table needed for keeping track of pages of the page table is called ____________

A. 2-level paging
B. Page directory Correct (Page no 170)
C. Page size
D. Page table size

28. Each page is a power of _________ bytes long in paging scheme.

A. 2
B. 3
C. 4 Correct (Page no 167)
D. 5

29. The most important property of the working set is its ________.

A. Delay
B. Thrashing
C. Time
D. Size Correct (Page no 210)
30. The critical section problem can be solved by the following except

A. Software based solution


B. Firmware based solution Correct (Page no 98)
C. Operating system based solution
D. Hardware based solution

31. ___________ is a software based solution to the synchronization problem

A. Bakery Algorithm
B. TSL instruction
C. Semaphore Correct (Google)
D. Monitors

32. Which of the following in infinite blocking caused due to unavailability of resources?

A. Starvation Correct (Page no 112)


B. Aging
C. Deadlock
D. Synchronization

33. The operation(s) that can be invoked on condition variables of Monitor are __________.

A. Wait()
B. Signal()
C. Block
D. Both wait () and signal Correct (Page no 123)
34. Which of the following is effective memory access time T effective with part of page table in
TLB and rest in main memory according to the following information?

T effective = 50 ns

Hit ratio = 80%

T TLB = 10 ns

A. 100 ns
B. 70 ns
C. 48 ns Correct
D. 140 ns

35. In Banker's algorithm, Need matrix is calculated by subtracting __________.

A. Allocation matrix from Max matrix Correct


B. Max matrix from Allocation matrix
C. Allocation matrix from Available matrix
D. Max matrix from Available matrix

36. Physical memory is broken down into fixed-sized blocks, called ________.

A. Frames Correct (Page no 162)


B. Packets
C. Pages
D. Files

37. If members of a team have to work sequentially on the shared files then _________ is the
most suitable scheme.

A. Common Login
B. Common Group
C. Link
D. Duplication File Correct (Page no 227)
38. ___________ wastes CPU cycles that some other process may be able to use productively.

A. Mutual Exclusion
B. Bounded Waiting
C. Busy Waiting Correct (Page no 109)
D. None of the given options

39. What do we name to an address that is loaded into the memory-address register of the
memory?

A. Logical address
B. Physical address Correct (Page no 155)
C. Binary address
D. None of the given options

40. ______________ Corresponds to block- oriented devices such as disk.

A. Directory
B. Link File
C. Ordinary File
D. Block Special File Correct (Page no 217)

41. "No resource can be forcibly removed from a process holding it" best describe which one of
the following conditions?

A. Mutual Exclusion
B. Hold and wait
C. Starvation
D. No preemption Correct (Google)
42. The mechanism that brings a page into memory only when it is needed is called
____________.

A. Segmentation
B. Fragmentation
C. Demand Paging Correct (Page no 186)
D. Pager Replacement

43. Which of the following statement is false?

A. Virtual memory implements the translation of a program's address space into physical
memory address space.
B. Virtual memory allows each program to exceed the size of the primary memory
C. Virtual memory increases the degree of multiprogramming
D. Virtual memory reduces the context switching overhead Correct

44. Consider the case when multiple instances of a text editor are invoked. Only one copy of the
editor needs to be kept in the physical memory. Each user's page table maps in to the same
physical copy of the editor, but data pages are mapped onto different frames. This is the
advantage of ___________.

A. Sharing in paging Correct (Page no 174)


B. Inverse page table
C. Sharing of segments
D. Hashed page table

45. ___________ is the situation in which number of processes involved in the circular wait and
none of them in making progress.

A. Starvation
B. Dormant
C. Deadlock Correct
D. Safe sequence
46. In ______ scheme, free frames are equally divided among processes.

A. Fixed Allocation Correct (Page no 204)


B. Proportional Allocation
C. Priority Allocation
D. Variance Allocation

47. _____________ is the time for the disk arm to move the head to the cylinder containing the
desired sector.

A. Rotational Latency
B. Access Time
C. I/O time
D. Seek time Correct (Page no 242)

48. When a process needs to execute, memory is requested by the process. The size of the
process is compared with the amount of adjacent memory available to execute the process.
This method is called ____________.

A. Contiguous Allocation Correct (Page no 242)


B. Linked Allocation
C. Indexed Allocation
D. Variable Allocation

49. Wait and signal operations of semaphores were originally termed __________.

A. P and V respectively Correct


B. V and P respectively
C. P and P respectively
D. V and V respectively
50. The integer value of ___________ semaphores cannot be greater than 1.

A. Bounded buffer
B. Counting
C. Binary Correct
D. Mutex

51. Preventing the condition of ____________ to happen, deadlocks can be prevented to happen.

A. Critical region
B. Monitors
C. Circular wait Correct (Page no 135)
D. Critical section

52. The major criterion in the selection of a particular algorithm is that we want to __________

A. Minimize the number of page faults Correct (Page no 192)


B. increase efficiency
C. Reduce running time of age replacement algorithm
D. maximize the number of page faults

53. ___________ is used in the detection and recovery mechanism to handle deadlocks.

A. Wait-for Graph Correct (Page no 144)


B. Resource allocation Graph
C. Circular Graph
D. Claim Edge Graph

54. ___________ is the process of mapping a name to an address

A. Addressing
B. Binding Correct (Page no 144)
C. Routing
D. Memory
55. ____________ keeps in memory only those instructions and data that are needed at any given
time.

A. Paging
B. Swapping
C. Overlays Correct (Page no 144)
D. Fragmentation

56. __________ is caused due to un-used space in fixed size blocks/pages.

A. Internal fragmentation Correct


B. External fragmentation
C. Paging
D. MVT

57. Which command, displays permissions and some other attributes for prog1.c in your current
directory?

A. Is --l prog1.c Correct (Page no 231)


B. Is --d prog1.c
C. Is file prog1.c
D. Is --l prog1.c /Directory

58. The page size is defined by the __________

A. CPU hardware Correct (Page no 165)


B. System software
C. Peripherals
D. Motherboard

59. Critical region construct can be applied to solve _________ problem

A. Memory out of bound


B. Bounded buffer Correct (Page no 121)
C. Exceptions during fork () call
D. Error detection
60. The following requirement for solving critical section problem is known as ________________.

"There exists a bound on the number of times that other processes are allowed to enter
their critical sections after a process made a request to enter its critical section and before
that request is granted"

A. Progress
B. Mutual Exclusion
C. Critical Region
D. Bounded Waiting Correct (Page no 101)

61. In Bakery’s algorithm, the ticket numbering scheme always generate numbers ________

A. In the increasing order of enumeration Correct


B. In the decreasing order of enumeration
C. In random fashion
D. In terms of alphabets

62. Following is NOT true about Virtual memory.

A. Virtual memory help in executing bigger programs even greater in size that of main
memory
B. Virtual memory makes the processes to stuck when the collective size of all the
processes becomes greater size of main memory. Correct
C. Virtual memory also allows files and memory to be shared by several different processes
through page sharing
D. Virtual memory makes the task of programming easier because the programmer need
not worry about the physical memory.
3 Marks Questions

Question no 1:

Suppose, Logical address space=32 bits and page size = 8k then calculate the following.

1. Maximum pages in a process address space

2. Address bits p (page number) and d (offset)

Answer:

Maximum pages in a process address space can be calculated as follows:

2^32 (total logical address space) / 8k (page size) = 2^20 pages

Address bits p (page number) and d (offset) can be calculated as follows:

Since there are 2^20 pages in total, the page number (p) requires 20 bits.

The remaining bits are used for the offset (d), which is 12 bits since the page size is 8k (2^13)
and 2^12 is 4k. Therefore, 32 - 20 = 12 bits are used for the offset.

Question no 2:

In segmentation, how do you evaluate whether a logical address is legal or not? Write
evaluation criteria and segment offset partitioning.

Answer:

To evaluate whether a logical address is legal or not in segmentation,

The segment number must be less than the maximum number of segments allowed by the
system, and the offset must be less than the size of the segment identified by the segment
number.

Segment offset partitioning divides a logical address into two parts:

• the segment number and the offset within that segment


• allowing for efficient memory management and protection
Question no 3:

A Spin lock is a synchronization object that normally device drivers used to avoid destructive
interference in an object-based multitasking environment. Spin locks are released explicitly,
although some are released automatically. You are required to mention the negative effects
of spin lock?

Answer:

The negative effects of spin locks include

• wasting CPU cycles


• increasing cache misses
• potentially causing priority inversion.

Question no 4:

Write down the access modes and classes of users (to implement file protection permissions)
in UNIX based systems.

Answer:

The access modes in UNIX based systems are read, write, and execute. The classes of users to
implement file protection permissions are owner, group, and others
Question no 5:

Semaphore are used as synchronization tools for orderly execution of cooperating processes.
However, sometimes incorrect use of semaphores may lead to Deadlock, starvation and
mutual exclusion violation. Write down the ways through which programmer does not have to
write down wait() and signals() calls in correct sequence and let the compiler do the serialized
execution of these calls.

Answer:

One way to avoid the need for the programmer to manually write wait() and signal() calls in the
correct sequence is to use the concept of monitors. In this approach, the programmer defines a monitor
module which contains shared variables and procedures. The monitor ensures that only one process can
execute inside the monitor at a time, and provides its own wait() and signal() procedures that are
automatically executed in the correct order.

Another approach is to use higher-level synchronization constructs like semaphores with higher-level
programming languages that have built-in support for such constructs. For example, some programming
languages provide constructs like monitors or mutexes which can automatically handle the required
synchronization operations, thereby simplifying the programming process and reducing the likelihood of
errors.
5 Marks Questions

Question no 1:

You are required to calculate the following parameters assuming logical address space of 8 pages of
1MB and physical address space of 16 frames.

1. No. of bits required for p

2. No. of bits required for f

3. No. of bits required for d

4. No. of bits required for logical address

5. No. of bits required for physical address

Answer:

1. No. of bits required for p:

Since the logical address space consists of 8 pages, we need log2(8) = 3 bits to represent the
page number. Therefore, p = 3.

2. No. of bits required for f:

Since the physical address space consists of 16 frames, we need log2(16) = 4 bits to represent
the frame number. Therefore, f = 4.

3. No. of bits required for d:

Since each page is 1MB in size, and the page size is the same as the frame size, there is no
displacement or offset within each page/frame. Therefore, d = 0.

4. No. of bits required for logical address:

The logical address consists of two parts: the page number and the displacement. Since p = 3
and d = 0, the number of bits required for the page number is 3 and the number of bits required
for the displacement is 20 (since each page is 1MB in size, which is 220 bytes). Therefore, the
logical address requires a total of 23 bits.

5. No. of bits required for physical address:

The physical address also consists of two parts: the frame number and the displacement. Since f
= 4 and d = 0, the number of bits required for the frame number is 4 and the number of bits
required for the displacement is 20. Therefore, the physical address requires a total of 24 bits.
Question no 2:

You are required to identify the name of the problem which can be solved by the code given
below. Also define that problem.

1st Process:

do (

produce an item in nextp

wait(empty);

wait(mutex);

add nextp to buffer

signal(mutex);

signal(full);

} while(1);

2nd Process:

do (

wait(full);

wait (mutex);

remove an item from

buffer to nextc

signal(mutex);

signal(empty);

….

consume the item in nextc


while(1);

Answer:

The code given implements a solution to the Producer-Consumer problem in operating systems
using two semaphores and a mutex to synchronize access to a shared buffer. The Producer
produces items and puts them in the buffer, while the Consumer removes items from the buffer
and consumes them. The semaphores and mutex ensure that the Producer and Consumer do
not interfere with each other's access to the buffer

Question no 3:

Enlist the four conditions of the deadlock

Answer:

The four necessary conditions for a deadlock to occur are:

1. Mutual Exclusion: At least one resource must be held in a non-shareable mode,


meaning only one process can access it at a time.

2. Hold and Wait: A process holding at least one resource is waiting to acquire
additional resources held by other processes.

3. No Preemption: Resources cannot be preempted from the processes holding them;


they can only be released voluntarily by the process holding them.

4. Circular Wait: There exists a set of processes {P1, P2, ..., Pn} such that P1 is waiting
for a resource held by P2, P2 is waiting for a resource held by P3, ..., and Pn is
waiting for a resource held by P1, creating a circular chain of dependencies.

To put it simply, deadlock occurs when multiple processes are waiting for resources that
are being held by other processes, creating a circular dependency that cannot be
resolved. This results in all the processes being stuck in a deadlock, unable to proceed
further.
Question no 4:

Consider a scenario in which some software engineers working on the same project
need to share files or directories related to the project. You are required to write
down at least four ways that facilitate file sharing in this scenario.

Answer:

There are several ways in which software engineers can share files or directories related
to a project. Some of these ways include:

1. Shared Network Drives: Shared network drives can be set up so that all the
software engineers have access to the same files and directories. This can be done
through a centralized server or cloud-based storage services such as Google Drive,
Dropbox, or OneDrive.

2. Version Control Systems: Version control systems such as Git, SVN, and Mercurial
can be used to share project files among software engineers. These systems allow
developers to make changes to files and keep track of the changes made by others,
ensuring that everyone is working on the latest version of the code.

3. File Transfer Protocols: FTP or SFTP can be used to transfer files between software
engineers working on the same project. These protocols are secure and allow large
files to be transferred easily.

4. Collaborative Tools: Collaborative tools such as Microsoft Teams, Slack, Trello, and
Asana can be used to facilitate file sharing and project collaboration. These tools
allow team members to share files, assign tasks, and communicate with each other
in real-time, making it easier to collaborate on projects.

You might also like