You are on page 1of 10

Chapter 5 Concurrency 1: Mutual exclusion and synchronization

Multiple Choice
1. A situation where multiple computations are happening at same time by processes or threads
is termed
a) Mutual exclusion
b) Concurrency
c) Parallel processing
d) Inter-leaving
2. Concurrency will most likely occur in all of the following contexts except
a) Operating system structure
b) Multiprogramming
c) Multiprocessing
d) Uniprogramming
3. A section of code within a process that required access to shared resources is called?
a) Critical section
b) Trace of a process
c) Shared section
d) Non-critical section
4. Some of the challenges faced by operating system in handling concurrency include the
following except
a) Sharing resources
b) Communication among processes
c) Synchronization of multiple processes
d) generalization
5. which of the following is an example of mutual exclusion implementation using hardware?
a) Interrupt disabling
b) Semaphores
c) Messaging
d) Monitors
6. A resource which can be used by a process at a time without being depleted by that use is known as
a) nondepleted resource
b) Reusable resource
c) Consumable resource
d) Unconsumable resource
7. Which of the following is not an example of consumable resources?
a) Interrupt
b) Signals
c) Memory
d) Messages
8. A deadlock prevention technique is concerned about
a) Preventing the possibility of deadlock
b) Preventing the existence of deadlock
c) Aborting the deadlocked processes
d) Denying resources to processes if that will lead to deadlock
9. Which of the following is not one of techniques used to solving deadlock?
a) Deadlock avoidance
b) Deadlock suspension
c) Deadlock detection
d) Deadlock prevention
10. Which of the following best describe deadlock avoidance approach?
a) Abort the deadlock processes
b) Deny start or resource increment to process if that will lead to deadlock
c) Prevent possibility of deadlock
d) Roll-back process to pre-deadlock time

Essay
1. What is mutual exclusion
mutual exclusion is a property of concurrency control, which is instituted for the purpose of
preventing race conditions.
2. state four (4) requirement of mutual exclusion
*Only one process at a time is allowed in the critical section for a resource
*No deadlock or starvation
*A process remains inside its critical section for a finite time only.
*A process must not be delayed access to a critical section when there is no other process
using it.
3. Define the term Concurrency
Concurrency can be defined as a situation where multiple computations by the processes
or threads are happening at same time.
4. List any Four key terms associated with concurrency
-mutual exclusion
-starvation
-deadlock
-livelock
5. Explain one of the terms associated with concurrency
Deadlock: a situation in which two or more processes are unable to proceed because each
is waiting for one of the other to do something.
6. List the two (2) hardware approaches for implementing mutual exclusion
Interrupt Disabling
Special Machine Instructions
7. Explain each one of the approaches listed in 6.
Interrupt Disabling
 A process runs until it invokes an operating system service or until it is interrupted
 Disabling interrupts guarantees mutual exclusion

Special Machine Instructions

 These are special machine instructions performed in a single instruction cycle


 Access to the memory location is blocked for any other instructions referencing that
location.
Chapter 6 Concurrency II: Deadlock and starvation
Multiple choice
11. A situation where multiple computations are happening at same time by processes or threads
is termed
e) Mutual exclusion
f) Concurrency
g) Parallel processing
h) Inter-leaving
12. Concurrency will most likely occur in all of the following contexts except
e) Operating system structure
f) Multiprogramming
g) Multiprocessing
h) Uniprogramming
13. A section of code within a process that required access to shared resources is called?
e) Critical section
f) Trace of a process
g) Shared section
h) Non-critical section
14. Some of the challenges faced by operating system in handling concurrency include the
following except
e) Sharing resources
f) Communication among processes
g) Synchronization of multiple processes
h) generalization
15. which of the following is an example of mutual exclusion implementation using hardware?
e) Interrupt disabling
f) Semaphores
g) Messaging
h) Monitors
16. A resource which can be used by a process at a time without being depleted by that use is known as
e) nondepleted resource
f) Reusable resource
g) Consumable resource
h) Unconsumable resource
17. Which of the following is not an example of consumable resources?
e) Interrupt
f) Signals
g) Memory
h) Messages
18. A deadlock prevention technique is concerned about
e) Preventing the possibility of deadlock
f) Preventing the existence of deadlock
g) Aborting the deadlocked processes
h) Denying resources to processes if that will lead to deadlock
19. Which of the following is not one of techniques used to solving deadlock?
e) Deadlock avoidance
f) Deadlock suspension
g) Deadlock detection
h) Deadlock prevention
20. Which of the following best describe deadlock avoidance approach?
e) Abort the deadlock processes
f) Deny start or resource increment to process if that will lead to deadlock
g) Prevent possibility of deadlock
h) Roll-back process to pre-deadlock time

Essay
1. Define the terms deadlock and starvation
Deadlock: a situation in which two or more processes are unable to proceed because each
is waiting for one of the other to do something.
Starvation: a situation in which ha runnable process is overlooked indefinitely by the
scheduler.
2. What are the differences between reusable and consumable resources?
Resources can be reusable or consumable.
Reusable if they can be used again after a process is done using them. Memory, printers, tape
drives are examples of reusable resources.
Consumable resources are resources that can be used only once.
3. Give 3 examples each for reusable and consumable resource
Reusable Resource: Processors, I/O channels, main and secondary
memory.
Consumable Resource: Interrupts, signals, messages
4. Using resource allocation graph explain the process of deadlock for two process P1 and P2
competing over resources Ra and Rb.

5. List and explain four conditions for the existence of deadlock


 Mutual Exclusion
 Hold and Wait
 No pre-emption
 Circular Wait
6. What is the difference between deadlock prevention and deadlock avoidance?
deadlock prevention ensures that at least one of the necessary conditions to cause
a deadlock will never occur.
deadlock avoidance ensures that the system will not enter an unsafe state.

7. List and explain the two approaches to deadlock avoidance

• Do not start a process if its demands might lead to deadlock


• Do not grant an incremental resource request to a process if this allocation
might lead to deadlock

8. Using banker’s algorithm show how the operating system will allocate resources to process to
avoid deadlock from the figure below ( not included )
3 2 2

6 1 3

3 1 4

9. What do you understand by deadlock detection?


Deadlock detection is the process of actually determining that a deadlock exists and
identifying the processes and resources involved in the deadlock.
10. Mention four strategies of deadlock detection
• Abort all deadlocked processes
• Back up each deadlocked process to some previously defined checkpoint, and restart all process
• Successively abort deadlocked processes until deadlock no longer exists
• Successively pre-empt resources until deadlock no longer exists
Chapter.7
1. In fixed Partitioning, if the program size is bigger than the memory partition size then the
programmer has to divide the program into modules some of which will be loaded later on when
some modules free up space, the name of this technique is?
a) Fragmentation
b) Overlays
c) Compaction
d) Compression
2. Which of the following is not a concern of the operating system in memory management?
a) Relocation
b) Protection
c) Sharing
d) deadlock
3. A problem with fixed partitioning where a process is smaller than the partition assigned to it and
leave behind an empty memory space (hole) is known as?
a) Wasted space
b) vacuum
c) internal fragmentation
d) external fragmentation
4. Which of the following is most accurate about virtual paging?
a) All pages of a process must be loaded in the memory
b) Some pages can be in system memory while other can be in virtual memory
c) All pages of a process must be in the virtual memory
d) All pages must be in the cache memory
5. A technique used in Dynamic partitioning to shift processes so that the gap (created due to
external fragmentation) between the processes is closed is known as?
a) External fragmentation
b) Squeezing
c) Compaction
d) None of the above
6. What is the difference between a page and a frame?
a) Page and frame have different sizes
b) Page is a partition in Process while Frame is a partition in memory which holds page
c) There are more pages than frames
d) None of the above
7. What is the difference between a page and a Segment?
a) All pages have same size while segment can have variable sizes
b) Segments are bigger in size than pages
c) Segments are faster to be loaded the pages
d) None of the above

8. In side process A, a byte holding data (a=200) has a physical address of 500, if the base register
of process A is 215, what is the relative address of that byte (a=200) what will be referenced by
the processor?
a) 500
b) 215
c) 285
d) 715
9. What is the use of a base register?
a) It holds information about the process execution
b) Buffer for storing starting address of a process in memory
c) Buffer for storing ending address of a process in memory
d) Buffer for storing the current address to be fetched from the process by the processor
e) None of the above
10. A process which is newly loaded into the system memory has the base register value of 786 and
the bound register value of 3858, what is the size of the process in KB.
a) 4KB
b) 1KB
c) 3KB
d) 2KB
11. Logical address in paging consist of a
a) Page number and offset
b) Page number only
c) Offset only
d) Page number and frame number
12. What is a virtual memory?
a) Location in secondary memory where content of a suspended process is temporarily
stored
b) Location in cache memory where content of a suspended process is temporarily stored
c) Location in main memory where content of a suspended process is temporarily stored
d) Not a real memory
13. What is the use of page table?
a) It’s used by operating system to update the most recent location of a page in the memory
b) It’s used to store process data
c) It is use for updating virtual memory
d) It is use to swap process to virtual memory

Essays

1. Mention 5 requirements in memory management


-relocation
-protection
-sharing
-logical organization
-physical oragnization
2. List 6 different types of partitioning schemes use in memory management
-fixed partitioning
-dynamic partitioning
-simple paging
-simple segmentation
-virtual memory paging
-virtual memory segmentation
3. What is the difference between simple paging and simple segmentation?
Paging, a process address space is broken into fixed sized blocks called pages.
Segmentation, a process address space is broken in varying sized blocks called
sections.
4. Show that the relative address 1502 is same as the with logical address in a simple
paging, if the size of page is 1KB and the system uses 16-bit for addressing space.

You might also like