0% found this document useful (0 votes)
2 views12 pages

Pre Test 2

The document contains a series of multiple-choice questions related to operating systems, focusing on synchronization constructs, process management, and scheduling algorithms. It covers topics such as monitors, semaphores, critical sections, and process states. Additionally, it includes specific scenarios and calculations related to process scheduling and waiting times.

Uploaded by

ninhhanh20112005
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views12 pages

Pre Test 2

The document contains a series of multiple-choice questions related to operating systems, focusing on synchronization constructs, process management, and scheduling algorithms. It covers topics such as monitors, semaphores, critical sections, and process states. Additionally, it includes specific scenarios and calculations related to process scheduling and waiting times.

Uploaded by

ninhhanh20112005
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 12

1.

A monitor is a type of ____________


Câu hỏi 1Select one:
none of the mentioned
high level synchronization construct
semaphore
low level synchronization construct

2. A situation where several processes access and manipulate the same data concurrently
and the outcome of the execution depends on the particular order in which access takes
place is called ____________
Câu hỏi 2Select one:
data consistency
starvation
race condition
aging
3. Cascading termination refers to termination of all child processes if the parent process
terminates ______
Câu hỏi 3Select one:
None of the mentioned
Abnormally
Normally or abnormally
Normally

4. TestAndSet instruction is executed ____________


Câu hỏi 4Select one:
periodically
none of the mentioned
after a particular process
atomically

5. Semaphore is a/an _______ to solve the critical section problem.


Câu hỏi 5Select one:
hardware for a system
integer variable
special program for a system
none of the mentioned

6. In UNIX, the return value for the fork system call is _____ for the child process and
_____ for the parent process.
Câu hỏi 6Select one:
Zero, A Negative integer
A Negative integer, Zero
A nonzero integer, Zero
Zero, A nonzero integer

7. The monitor construct ensures that ____________


Câu hỏi 7Select one:
only one process can be active at a time within the monitor
n number of processes can be active at a time within the monitor (n being greater than 1)
all of the mentioned
the queue has only one process in it at a time

8. An un-interruptible unit is known as ____________


Câu hỏi 8Select one:
single
static
atomic
none of the mentioned

9. The child process completes execution, but the parent keeps executing, then the child
process is known as __________
Câu hỏi 9Select one:
Orphan
Dead
Body
Zombie

10. A semaphore is a shared integer variable __________


Câu hỏi 10Select one:
that can not drop below zero
that can not drop below one
that can not be more than zero
that can not be more than one

11. Considering a system with 4 processes and the following parameters:

Process Arrival Time Burst time

P1 0 8
P2 1 4
P3 2 9
P4 3 5
If using the SRT scheduling algorithm, the turnaround time of P3 is

Câu hỏi 11Select one:


26
24
23
25

12. A procedure defined within a ________ can access only those variables declared
locally within the _______ and its formal parameters.
Câu hỏi 12Select one:
process, monitor
semaphore, semaphore
process, semaphore
monitor, monitor

13. What is the main disadvantage of spinlocks?


Câu hỏi 13Select one:
they are unreliable sometimes
they require busy waiting
they are not sufficient for many process
they are too complex for programmers

14. If a process is executing in its critical section, then no other processes can be
executing in their critical section. What is this condition called?
Câu hỏi 14Select one:
critical exclusion
asynchronous exclusion
mutual exclusion
synchronous exclusion

15. Which process can be affected by other processes executing in the system?
Câu hỏi 15Select one:
init process
child process
cooperating process
parent process
16. The segment of code in which the process may change common variables, update
tables, write into files is known as ____________
Câu hỏi 16Select one:
synchronizing
critical section
program
non – critical section
17. What are Spinlocks?
Câu hỏi 17Select one:
Locks that avoid time wastage in context switches
Locks that work better on multiprocessor systems
All of the mentioned
CPU cycles wasting locks over critical sections of programs
18. Consider a system with 4 processes with the following parameters:

Arriv Burs
Proces
al t
s
time time

P1 0 6
P2 0 8
P3 0 7
P4 0 3

If using the SJF process scheduling algorithm, the average waiting time of the processes
is
P4 P1 P3 P2
0 3 9 16 24
WT: TAT - BT
P1: (9 – 0) – 6 = 3
P2: (24 – 0) – 8 = 16
P3: (16 – 0) – 7 = 9
P4: (3 – 0) – 3 = 0
AVG WT = 7
19. Concurrent access to shared data may result in ____________
Câu hỏi 19Select one:
data insecurity
data inconsistenc
ydata consistency
none of the mentioned

20. In UNIX, each process is identified by its __________


Câu hỏi 20Select one:
Process Identifier
Process Control Block
Device Queue
None of the mentioned

Đáp án: wait(S1); wait(S2); wait(S1); wait(S2);


Minimum:
1. P2 reads D = 90, preempted
2. P1 executes D=D+20, D = 110
3. P3 executes D=D+10, D = 120
4. Now, P2 has D = 90, executes, D = D – 50 = 90 – 50 = 40. P2 writes D=40 final
value.
Maximum:
1.P1 reads D=90, preempted.
2.P2 reads D=90, executes, D = D-50 = 90-50 = 40.
3.Now, P1 executes, D = D+20 = 90+20 = 110.
4.And now, P3 reads D=110, executes D=D+10, D=120. P3
writes D=120 final value.
 Y – X = 120 – 40 = 80

Đáp án: 24
Đáp án: Safe state
Đáp án: At least twice

33 0 48 4 13 28 0 0 8
P1 P2 P3 P4 P1 P3 P4 P1 P3 P3
0 20 28 48 68 88 108 112 125 145 153

WT = TAT – BT
P1 = (125 – 0) – 53 = 72
P2 = (28 – 0) – 8 = 20
P3 = (153 – 0) – 68 = 85
P4 = (112 – 0) – 24 = 88

Đáp án: 66,25


Đáp án: It does not prevent deadlocks, but ensures mutual exclusion.
Đáp án: Ko có

https://www.studocu.vn/vn/document/truong-dai-hoc-su-pham-ky-thuat-thanh-pho-ho-
chi-minh/he-dieu-hanh/kiem-tra-lan-2-de-thi-dap-an/51711796

You might also like