0% found this document useful (0 votes)
48 views74 pages

1,2,3,4

Uploaded by

abc
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)
48 views74 pages

1,2,3,4

Uploaded by

abc
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/ 74

3/10/2020 Bài kiểm tra chương 1+2 (thi lần 2)

UETOTS Thái Huy Nhật Quang

Operating systems INT2206-6 Summer 2018-2019


Home ► My courses ► Operating Systems ► INT2206-6 Summer 2018-2019 ► 14 March - 20 March ►
Bài kiểm tra chương 1+2 (thi lần 2)

Started on Sunday, 17 March 2019, 8:00 PM


State Finished
Completed on Sunday, 17 March 2019, 8:15 PM
Time taken 15 mins 33 secs
Marks 19.00/20.00
Grade 9.50 out of 10.00 (95%)

Question 1 Suppose a system uses SJN (or SJF) CPU scheduling algorithm. The processes information
Correct (arrival time, duration) is P1(0,7), P2(2,4), P3(4,1), P4(5,5). Which is the average waiting time of
the processes?
Mark 1.00 out of
1.00
Select one:
Flag question
2

3
5
4

Question 2 Suppose a system uses SJN (or SJF) scheduling algorithm. The processes information (arrival
Correct time, duration) is P1(0,7), P2(2,4), P3(4,1), P4(5,5). Calculate the turnaround time of P1 ?

Mark 1.00 out of


1.00 Answer: 7
Flag question

Question 3 Suppose a system uses SJN (or SJF) CPU scheduling algorithm. The processes information
Correct (arrival time, duration) is P1(0,7), P2(2,4), P3(4,1), P4(5,5). Which is the total waiting time of the
processes?
Mark 1.00 out of
1.00
Select one:
Flag question
16
17
18

15
https://112.137.129.56/mod/quiz/review.php?attempt=2125 1/5
3/10/2020 Bài kiểm tra chương 1+2 (thi lần 2)
Question 4 Suppose a system uses SRTF (or preemtive SJF) scheduling algorithm. The processes
Incorrect information (arrival time, duration) is P1(0,24), P2(20,40), P3(30,10), P4(50,15). Show the order
(e.g. P1 P3 P1 P4 ...) in which the processes are run?
Mark 0.00 out of
1.00

Flag question
Answer: P1 P2 P3 P4

Question 5 Which is non-preemptive CPU scheduling algorithm?


Correct
Select one:
Mark 1.00 out of
1.00 FIFO

Flag question SRTF


None of the above

Round robin

Question 6 Which is INCORRECT about Shortest Job First (SJF) CPU scheduling algorithm?
Correct
Select one:
Mark 1.00 out of
1.00 The shortest process will be selected to be run

Flag question Shortest remaining time first (SRTF) CPU scheduling algorithm is the same as SJF
It is also a priority scheduling algorithm

Another name of the algorithm is Shortest Job Next (SJN)

Question 7 Suppose a system uses SJN (or SJF) scheduling algorithm. The processes information (arrival
Correct time, duration) is P1(0,7), P2(2,4), P3(4,1), P4(5,5). Calculate the turnaround time of P3 ?

Mark 1.00 out of


1.00 Answer: 4
Flag question

Question 8 Suppose a system uses Round Robin (RR) CPU scheduling algorithm, the processes information
Correct (arrival time, duration) is P1(0,21), P2(30,10), P3(20,40), P4(40,25), and the time quantum is 15.
Calculate the total waiting time of the processes?
Mark 1.00 out of
1.00
Answer: 63
Flag question

Question 9 Which is NOT one of the main tasks of operating systems?


Correct
Select one:
https://112.137.129.56/mod/quiz/review.php?attempt=2125 2/5
3/10/2020
Mark 1.00 out of Bài kiểm tra chương 1+2 (thi lần 2)
Memory management
1.00
Protection and security
Flag question
Play audio files
Storage management (such as CD, DVD, disks, ...)

Question 10 Which is INCORRECT about time-sharing system?


Correct
Select one:
Mark 1.00 out of
1.00 It is also applicable for multiple CPU hardware

Flag question Utilize resources more effectively

Allow several processes to run on a single CPU hardware


Only utilize CPU effectively

Question 11 Suppose a system uses SJN (or SJF) scheduling algorithm. The processes information (arrival
Correct time, duration) is P1(0,7), P2(2,4), P3(4,1), P4(5,5). Which is the response time of process P2?

Mark 1.00 out of


Select one:
1.00
6
Flag question
10

8
12

Question 12 Suppose a system uses RR scheduling algorithm. The processes information (arrival time,
Correct duration) is P1(0,20), P2(30,10),P3(20,40), P4(40,25), and the time quantum is 15. Which is the
total waiting time of the processes?
Mark 1.00 out of
1.00
Select one:
Flag question
60
70

50
40

Question 13 Which is the CORRECT relationship among process, program and application concepts?
Correct
Select one:
Mark 1.00 out of
1.00 An application may have several programs, a program has only one process

Flag question An application has only one program, a program has only one process
https://112.137.129.56/mod/quiz/review.php?attempt=2125 3/5
3/10/2020 Bài kiểm tra chương 1+2 (thi lần 2)
An application may have several processes, a process may have several programs

An application may have several programs, a program may have several processes

Question 14 Which is the CORRECT statement about a program?


Correct
Select one:
Mark 1.00 out of
1.00 Is a process

Flag question Is a library


Is a compiled (e.g binary code) application
Is a part of the operating system

Question 15 Suppose a system uses FCFS scheduling algorithm, the processes information (arrival time,
Correct duration) is P1(0,21), P2(30,10),P3(20,40), P4(50,15). Show the order in which the processes are
run (e.g. P2 P1 P3 P4)?
Mark 1.00 out of
1.00

Flag question
Answer: P1 P3 P2 P4

Question 16 Which is INCORRECT about Shortest Remaining Time First (SRTF) scheduling algorithm?
Correct
Select one:
Mark 1.00 out of
1.00 The shortest process will be run first

Flag question The shortest remaining time process will be selected to run
It is also a priority scheduling algorithm

It is the preemptive Shortest Job First (SJF) algorithm

Question 17 Suppose a system uses FCFS CPU scheduling algorithm. The duration of the processes is
Correct P1(21), P2(10), P3(6) (and this is also the order of the processes in the queue). Calculate the total
waiting time of the processes?
Mark 1.00 out of
1.00
Answer: 52
Flag question

Question 18 Which is CORRECT about a process?


Correct
Select one:
Mark 1.00 out of
1.00 Is an instance of a program

Flag question Is a file on hard disk


https://112.137.129.56/mod/quiz/review.php?attempt=2125 4/5
3/10/2020 Bài kiểm tra chương 1+2 (thi lần 2)
Is a library

Is an application

Question 19 Which is INCORRECT about process control block (PCB)?


Correct
Select one:
Mark 1.00 out of
1.00 It is a data structure containing information of a process

Flag question PCBs in all operating systems are the same


It contains the state of the process
It contains memory management information

Question 20 Suppose a system uses SJN (or SJF) scheduling algorithm. The processes information (arrival
Correct time, duration) is P1(0,7), P2(2,4), P3(4,1), P4(5,5). Calculate the turnaround time of process P4 ?

Mark 1.00 out of


1.00 Answer: 12
Flag question

Finish review

QUIZ NAVIGATION

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
Show one page at a time
Finish review

You are logged in as Thái Huy Nhật Quang (Log out)


INT2206-6 Summer 2018-2019

https://112.137.129.56/mod/quiz/review.php?attempt=2125 5/5
3/10/2020 Bài kiểm tra chương 3, 4
UETOTS Thái Huy Nhật Quang

Operating systems INT2206-6 Summer 2018-2019


Home ► My courses ► Operating Systems ► INT2206-6 Summer 2018-2019 ► 4 April - 10 April ►
Bài kiểm tra chương 3, 4

Started on Sunday, 7 April 2019, 8:00 PM


State Finished
Completed on Sunday, 7 April 2019, 8:30 PM
Time taken 29 mins 53 secs
Marks 18.00/20.00
Grade 9.00 out of 10.00 (90%)

Question 1 Given the following system information:


Incorrect
ALLOCATION MAX AVAILABLE
Mark 0.00 out of
1.00

Flag question
PROCESS TAPES TAPES TAPES

P0 5 10 3

P1 2 4

P2 2 9

Which is the correct value of FINISH and WORK vectors during the running of Banke
r's algorithm?

Select one:
FINISH=(T, F, T) WORK=(10)

FINISH=(F, T, F) WORK=(10)
FINISH=(T, F, F) WORK=(10)
FINISH=(T, T, F) WORK=(10)

https://112.137.129.56/mod/quiz/review.php?attempt=2247 1/17
3/10/2020 Bài kiểm tra chương 3, 4
Question 2 Given the two bellow processes sharing three semaphores full, empty, mutex, and a buffer buff
Correct having initial N empty slots:

Mark 1.00 out of


semaphore mutex=1, full=0, empty=N;
1.00

Flag question

int buff[N];

Write_Process:

do {

wait(empty);

wait(mutex);

Write(buff);

signal(mutex);

signal(full);

} while (TRUE);

Read_Process:

do {

wait(full);

https://112.137.129.56/mod/quiz/review.php?attempt=2247 2/17
3/10/2020 Bài kiểm tra chương 3, 4
wait(mutex);

Read(buff);

signal(mutex);

signal(empty);

} while (TRUE);

Which is correct about the semaphore mutex?

Select one:
Both semaphore mutex and full are used to ensure at most 1 process can access the buff at
a time.

mutex is initially set to 1. wait(mutex); and signal(mutex); operators follow a protocol to


execute a critical section, i.e. to allow at most 1 process to access the buff.
mutex is used to force Read_Process to wait until Write_Process write data into buff.
mutex is used to force Write_Process to write at most N data items into buff.

Question 3 Which is incorrect about Semaphore?


Correct
Select one:
Mark 1.00 out of
1.00 signal (or V) operator is corresponding to EXIT in the protocol of a critical section

Flag question Semaphore includes an integer and two atomic operators.

wait (or P) operator is corresponding to ENTRY in the protocol of a critical section


There is only one implementation of semaphore.

Question 4 Given the following system information:


Correct
ALLOCATION REQUEST AVBALABLE
Mark 1.00 out of
1.00

Flag question
PROCESS A B C A B C A B
C

https://112.137.129.56/mod/quiz/review.php?attempt=2247 3/17
3/10/2020 Bài kiểm tra chương 3, 4

P0 0 1 0 0 0 0 0
0 0

P1 2 0 0 2 0 2

P2 3 0 3 0 0 0

P3 2 1 1 1 0 0

P4 0 0 2 0 0 2

Which is correct value of FINISH and WORK vectors during the running of the deadlock
detection algorithm?

Select one:
FINISH=(F, F, F, F, T), WORK=(0, 1, 0)

FINISH=(T, F, F, F, F), WORK=(0, 1, 0)


FINISH=(F, F, F, F, F), WORK=(0, 0, 1)
FINISH=(F, F, F, T, F), WORK=(1, 0, 0)

Question 5 Which is INCORRECT about Resource Allocation Graph (RAG)?


Correct
Select one:
Mark 1.00 out of
1.00 A rectangle represents a process

Flag question An edge from a resource vertex to a process vertex represents an instance of the resources
is allocated to the process

A circle represents a process


A request edge is from a process vertex to a resource vertex

Question 6 Given the code of Readers-Writers problem:


Correct Process writer P:

Mark 1.00 out of


do {
1.00

Flag question

https://112.137.129.56/mod/quiz/review.php?attempt=2247 4/17
3/10/2020 Bài kiểm tra chương 3, 4
wait(wrt);

write(data_set);

signal(wrt);

}while (TRUE);

Process reader Q:

do {

wait(mutex);

readcount++;

if (readcount ==1) wait(wrt);

signal(mutex);

read(data_set);

wait(mutex);

readcount--;

if (readcount ==0) signal(wrt);

signal(mutex);

https://112.137.129.56/mod/quiz/review.php?attempt=2247 5/17
3/10/2020 Bài kiểm tra chương 3, 4
} while (TRUE);

Which is the initialized value of the wrt variable in the above algorithm?

Select one:
NULL

0
1
-1

Question 7 Given the following code, with the globally shared variable int buf, and count() is a function.
Correct Which is correct when multiple instances of the code are running in the system?

Mark 1.00 out of


while (true) {
1.00

Flag question

//Some code

int val=buf;

val += count();//A time consuming function

buf=val

//Some other code

Select one:
The globally shared variable buf can get an incorrect value when there are more than 1
instance of the code running.
The globally shared variable buf will always get an incorrect value when there are more than
2 instances of the code running.

https://112.137.129.56/mod/quiz/review.php?attempt=2247 6/17
3/10/2020 Bài kiểm tra chương 3, 4
The globally shared variable buf will always get an incorrect value when only 2 instances of
the code running.

The globally shared variable buf will always get the correct value.

Question 8 Which is NOT an implementation of critical section?


Correct
Select one:
Mark 1.00 out of
1.00 Monitor

Flag question Peterson’s solution


Condition
Semaphore

Question 9 Given the following system information, and process P4 requests (1, 0, 0) more resources:
Correct
ALLOCATION MAX AVBALABLE
Mark 1.00 out of
1.00

Flag question
PROCESS A B C A B C A B
C

P0 0 1 0 7 5 3
2 3 0

P1 3 0 2 3 2 2

P2 3 0 2 9 0 2

P3 2 1 1 2 2 2

P4 0 0 2 4 3 3

Which is the correct value of FINISH and WORK vectors during the running of Banker's algorithm
which is called in the Resource-Request algorithm (to avoid deadlock)?

Select one:
FINISH=(F, T, F, F, F), WORK=(4,
https://112.137.129.56/mod/quiz/review.php?attempt=2247 3, 2) 7/17
3/10/2020 Bài kiểm tra chương 3, 4
FINISH=(F, F, T, F, F), WORK=(4, 3, 0)
FINISH=(F, F, F, T, F), WORK=(4, 3, 2)
FINISH=(F, T, F, F, F), WORK=(4, 3, 0)

Question 10 Given the following system information:


Correct
ALLOCATION REQUEST AVBALABLE
Mark 1.00 out of
1.00

Flag question
PROCESS A B C A B C A B
C

P0 0 1 0 0 0 0 0
0 0

P1 2 0 0 2 0 2

P2 3 0 3 0 0 0

P3 2 1 1 1 0 0

P4 0 0 2 0 0 2

Which is correct for the deadlock detection algorithm?

Select one:
The algorithm results in FINISH=(F, T, T, T, T), WORK=(5, 1, 2), thus there is a deadlock.
The algorithm results in FINISH=(T, T, T, T, T), WORK=(7, 2, 4), thus there is no deadlock.

The algorithm results in FINISH=(F, T, T, T, T), WORK=(7, 2, 5), thus there is a deadlock.
The algorithm results in FINISH=(T, T, T, T, T), WORK=(7, 2, 6), thus there is no deadlock.

Question 11 Given the following system information, and process P0 requests (0, 2, 0) more resources:
Correct
ALLOCATION MAX AVBALABLE
Mark 1.00 out of
1.00
https://112.137.129.56/mod/quiz/review.php?attempt=2247 8/17
3/10/2020
Flag question Bài kiểm tra chương 3, 4
PROCESS A B C A B C A B
C

P0 0 1 0 7 5 3 3
3 2

P1 2 0 0 3 2 2

P2 3 0 1 9 0 2

P3 2 1 1 2 2 2

P4 0 0 2 4 3 3

Which is the correct value of FINISH and WORK vectors during the running of Banker's algorithm
which is called in the Resource-Request algorithm (to avoid deadlock)?

Select one:
FINISH=(F, T, T, F, T), WORK=(7, 3, 3)

FINISH=(T, T, T, T, F), WORK=(10, 5, 4)


FINISH=(F, T, T, T, T), WORK=(10, 5, 3)
FINISH=(T, T, F, T, T), WORK=(7, 5, 4)

Question 12 Which is INCORRECT about banker algorithm?


Correct
Select one:
Mark 1.00 out of
1.00 Banker algorithm can be used in case each resource type has several instances

Flag question Each process has to register the maximum number of resource instances it needs

When a process hold a resource, it must release in a finite duration


When a process requests a resource, it does not have to wait

Question 13 Given the two bellow processes sharing three semaphores full, empty, mutex, and a buffer buff
Correct having initial N empty slots:

semaphore mutex=1, full=0, empty=N;


https://112.137.129.56/mod/quiz/review.php?attempt=2247 9/17
3/10/2020
Mark 1.00 out of Bài kiểm tra chương 3, 4

1.00
int buff[N];
Flag question

Write_Process:

do {

wait(empty);

wait(mutex);

Write(buff);

signal(mutex);

signal(full);

} while (TRUE);

Read_Process:

do {

wait(full);

wait(mutex);

Read(buff);

https://112.137.129.56/mod/quiz/review.php?attempt=2247 10/17
3/10/2020 Bài kiểm tra chương 3, 4
signal(mutex);

signal(empty);

} while (TRUE);

Which is incorrect about semaphore full?

Select one:
The maximum value of full is N.

The minimum value of full is 0.


It is a binary semaphore.
It is a counting semaphore.

Question 14 Given the following resource allocation graph, provide the name of the edge from P3 to R2
Correct (Assignment, Claim,or Request)?

Mark 1.00 out of


1.00

Flag question

https://112.137.129.56/mod/quiz/review.php?attempt=2247 11/17
3/10/2020 Bài kiểm tra chương 3, 4

Answer: Request

Question 15 Given the following system information:


Correct
ALLOCATION REQUEST AVBALABLE
Mark 1.00 out of
1.00

Flag question
PROCESS A B C A B C A B
C

https://112.137.129.56/mod/quiz/review.php?attempt=2247 12/17
3/10/2020 Bài kiểm tra chương 3, 4
P0 0 1 0 0 0 0 0
0 0

P1 2 0 0 2 0 2

P2 3 0 3 0 0 1

P3 2 1 1 1 0 0

P4 0 0 2 0 0 2

Which is correct value of FINISH and WORK vectors during the running of the deadlock
detection algorithm?

Select one:
FINISH=(T, F, F, F, F), WORK=(2, 0, 0)

FINISH=(F, F, F, F, T), WORK=(0, 1, 0)


FINISH=(F, T, F, F, F), WORK=(0, 0, 2)
FINISH=(T, F, F, F, F), WORK=(0, 1, 0)

Question 16 Given the code of Readers-Writers problem:


Correct Process writer P:

Mark 1.00 out of


do {
1.00

Flag question

wait(wrt);

write(data_set);

signal(wrt);

}while (TRUE);

https://112.137.129.56/mod/quiz/review.php?attempt=2247 13/17
3/10/2020 Bài kiểm tra chương 3, 4

Process reader Q:

do {

wait(mutex);

readcount++;

if (readcount ==1) wait(wrt);

signal(mutex);

read(data_set);

wait(mutex);

readcount--;

if (readcount ==0) signal(wrt);

signal(mutex);

} while (TRUE);

Why do we need readcount variable?

Select one:
To make sure there is one reader at a time

We may remove this variable


To make sure no readers are reading
To make sure no readers are reading before writing

https://112.137.129.56/mod/quiz/review.php?attempt=2247 14/17
3/10/2020 Bài kiểm tra chương 3, 4
Question 17 Given the code for bounded-buffer problem:
Correct Write process P:

Mark 1.00 out of


do {
1.00

Flag question

wait(empty);

wait(mutex);

Write (item);

signal(mutex);

signal(full);

} while (TRUE);

Read process Q:

do {

wait(full);

wait(mutex);

Read(item);

signal(mutex);

signal(empty);

https://112.137.129.56/mod/quiz/review.php?attempt=2247 15/17
3/10/2020 Bài kiểm tra chương 3, 4
} while (TRUE);

What will be the problem if the initialized value of the full variable is 1?

Select one:
the reader process can not run

no problem at all
the reader can read an invalid value
the writer process can not run

Question 18 Which is INCORRECT about Inter-process communication (IPC)?


Correct
Select one:
Mark 1.00 out of
1.00 IPC can be used for memory management

Flag question IPC can be used for data communication

IPC can be used to handle critical section


IPC can be used to synchronization

Question 19 Given the following system information, and process P0 requests (0, 2, 0) more resources:
Incorrect
ALLOCATION MAX AVBALABLE
Mark 0.00 out of
1.00

Flag question
PROCESS A B C A B C A B
C

P0 0 1 0 7 5 3 3
3 2

P1 2 0 0 3 2 2

P2 3 0 1 9 0 2

P3 2 1 1 2 2 2

https://112.137.129.56/mod/quiz/review.php?attempt=2247 16/17
3/10/2020 Bài kiểm tra chương 3, 4
P4 0 0 2 4 3 3

Which is the correct value of FINISH and WORK vectors during the running of Banker's algorithm
which is called in the Resource-Request algorithm (to avoid deadlock)?

Select one:
FINISH=(F, F, T, F, T), WORK=(7, 3, 3)

FINISH=(F, T, F, T, F), WORK=(7, 2, 3)


FINISH=(F, F, F, F, T), WORK=(5, 3, 2)
FINISH=(F, T, F, T, F), WORK=(5, 2, 3)

Question 20 Which is not Interprocess Communication?


Correct
Select one:
Mark 1.00 out of
1.00 A process reads data from a file.

Flag question Two processes shares data in a file via file mapping.

A web browser views a webpage from a web server.


A process shares a semaphore with another process.

Finish review

QUIZ NAVIGATION

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
Show one page at a time
Finish review

You are logged in as Thái Huy Nhật Quang (Log out)


INT2206-6 Summer 2018-2019

https://112.137.129.56/mod/quiz/review.php?attempt=2247 17/17
7/4/2019 Bài kiểm tra chương 3, 4
UETOTS Nguyễn Trí Công

Operating systems INT2206-6 Summer 2018-


2019
Home ► My courses ► Operating Systems ► INT2206-6 Summer 2018-2019 ► 4 April - 10 April ►
Bài kiểm tra chương 3, 4

Started on Sunday, 7 April 2019, 8:03 PM


State Finished
Completed on Sunday, 7 April 2019, 8:33 PM
Time taken 30 mins 1 sec
Marks 18.00/20.00
Grade 9.00 out of 10.00 (90%)

Question 1 Which is CORRECT about the bounded waiting condition of critical section?
Correct
Select one:
Mark 1.00 out of
1.00 It makes sure no process can never enter its critical section, or ensures the fairness
among processes
Flag question
It ensures the correct use of the shared resource
It utilizes the shared resource effectively
It supports the priority of processes

Question 2 Given the code of Readers-Writers problem:


Correct Process writer P:

Mark 1.00 out of


do {
1.00

Flag question

wait(wrt);

write(data_set);

signal(wrt);

https://112.137.129.56/mod/quiz/review.php?attempt=2291#q11 1/16
7/4/2019 Bài kiểm tra chương 3, 4
}while (TRUE);

Process reader Q:

do {

wait(mutex);

readcount++;

if (readcount ==1) wait(wrt);

signal(mutex);

read(data_set);

wait(mutex);

readcount--;

if (readcount ==0) signal(wrt);

signal(mutex);

} while (TRUE);

Which is the initialized value of the mutex variable in the above algorithm?

Select one:
0

NULL
-1
https://112.137.129.56/mod/quiz/review.php?attempt=2291#q11 2/16
7/4/2019 Bài kiểm tra chương 3, 4
1

Question 3 Given the following resource allocation graph. What is the correct name of the edge from P2
Correct to R3?

Mark 1.00 out of


1.00

Flag question

Select one:
Assignment edge.
Request edge.

Claim edge.

Question 4 Which is NOT an implementation of critical section?


Correct
https://112.137.129.56/mod/quiz/review.php?attempt=2291#q11 3/16
7/4/2019
Mark 1.00 out of Select one: Bài kiểm tra chương 3, 4

1.00 Condition
Flag question
Semaphore
Monitor
Peterson’s solution

Question 5 Given the following system information, and process P0 requests (0, 2, 0) more resources:
Correct
ALLOCATION MAX AVBA
Mark 1.00 out of
LABLE
1.00

Flag question

PROCESS A B C A B C A
B C

P0 0 1 0 7 5 3
3 3 2

P1 2 0 0 3 2 2

P2 3 0 1 9 0 2

P3 2 1 1 2 2 2

P4 0 0 2 4 3 3

Which is the correct value of FINISH and WORK vectors during the running of Banker's
algorithm which is called in the Resource-Request algorithm (to avoid deadlock)?

Select one:
FINISH=(F, T, F, F, F), WORK=(3, 3, 2)
FINISH=(F, F, T, F, F), WORK=(3, 0, 2)

FINISH=(F, F, F, F, F), WORK=(3, 1, 2)


FINISH=(F, F, F, T, F), WORK=(2, 1, 2)

https://112.137.129.56/mod/quiz/review.php?attempt=2291#q11 4/16
7/4/2019 Bài kiểm tra chương 3, 4
Question 6 Which is INCORRECT about safe state? The system is in safe state if there exists a
Correct sequence of processes that satisfies the following condition:

Mark 1.00 out of


Select one:
1.00
The processes finish in the order of the above sequence
Flag question
There may be several sequences if the system is in a safe state
Process Pi can finish with its current resources and those held by processes Pj (j>i)
Process Pi can finish with its current resources and those held by processes Pj (j

Question 7 Given the following system information, and process P4 requests (1, 0, 0) more resources:
Correct
ALLOCATION MAX AVBA
Mark 1.00 out of
LABLE
1.00

Flag question

PROCESS A B C A B C A
B C

P0 0 1 0 7 5 3
3 3 2

P1 2 0 0 3 2 2

P2 3 0 1 9 0 2

P3 2 1 1 2 2 2

P4 0 0 2 4 3 3

Which is the correct value of FINISH and WORK vectors during the running of Banker's
algorithm which is called in the Resource-Request algorithm (to avoid deadlock)?

Select one:
FINISH=(F, F, T, T, T), WORK=(10, 5, 5)
FINISH=(F, T, F, T, T), WORK=(9, 4, 4)

FINISH=(T, T, T, T, F), WORK=(9, 5, 4)


https://112.137.129.56/mod/quiz/review.php?attempt=2291#q11 5/16
7/4/2019 Bài kiểm tra chương 3, 4
FINISH=(F, T, F, F, T), WORK=(10, 5, 4)

Question 8 Given the following resource allocation graph, provide the name of the edge from R2 to P4
Correct (Assignment, Claim,or Request)?

Mark 1.00 out of


1.00

Flag question

Answer: Assignment

Question 9 Which is not Interprocess Communication?


Correct
Select one:
Mark 1.00 out of
1.00 A web browser views a webpage from a web server.
https://112.137.129.56/mod/quiz/review.php?attempt=2291#q11 6/16
7/4/2019
Flag question Bài kiểm tra chương 3, 4
A process writes data to a file.

A process sends signal to another process


A process connects to a Database Management System (such as Microsoft SQL
Server)

Question 10 Which is incorrect about Semaphore?


Correct
Select one:
Mark 1.00 out of
1.00 We can manipulate the semaphore's integer directly.

Flag question wait (or P) operator is corresponding to ENTRY in the protocol of a critical section
Semaphore includes an integer and two atomic operators.

signal (or V) operator is corresponding to EXIT in the protocol of a critical section

Question 11 Given the following system information, and process P0 requests (0, 2, 0) more resources:
Correct
ALLOCATION MAX AVBA
Mark 1.00 out of
LABLE
1.00

Flag question

PROCESS A B C A B C A
B C

P0 0 1 0 7 5 3
3 3 2

P1 2 0 0 3 2 2

P2 3 0 1 9 0 2

P3 2 1 1 2 2 2

P4 0 0 2 4 3 3

Which is the correct value of FINISH and WORK vectors during the running of Banker's
algorithm which is called in the Resource-Request algorithm (to avoid deadlock)?
https://112.137.129.56/mod/quiz/review.php?attempt=2291#q11 7/16
7/4/2019 Select one: Bài kiểm tra chương 3, 4

FINISH=(F, F, T, F, T), WORK=(7, 3, 3)

FINISH=(F, T, F, T, F), WORK=(5, 2, 3)


FINISH=(F, F, F, T, T), WORK=(5, 3, 2)
FINISH=(F, T, F, T, F), WORK=(7, 2, 3)

Question 12 Which is CORRECT about critical section?


Correct
Select one:
Mark 1.00 out of
1.00 A code snippet working with a global variable

Flag question A code snippet working with a resource

A code snippet working with a global resource


A code snippet working with a shared resource

Question 13 Which is the correct protocol to run a critical section named CS?
Correct
A)
Mark 1.00 out of
1.00

Flag question
do {

ENTRY;

Before_Code;

CS;

EXIT;

After_Code;

} while (TRUE);

https://112.137.129.56/mod/quiz/review.php?attempt=2291#q11 8/16
7/4/2019 Bài kiểm tra chương 3, 4
B)

do {

Before_Code;

ENTRY;

CS;

EXIT;

After_Code;

} while (TRUE);

C)

do {

ENTRY;

Before_Code;

CS;

After_Code;

https://112.137.129.56/mod/quiz/review.php?attempt=2291#q11 9/16
7/4/2019 Bài kiểm tra chương 3, 4
EXIT;

} while (TRUE);

D)

do {

Before_Code;

ENTRY;

CS;

After_Code;

EXIT;

} while (TRUE);

Select one:
C

B
D
A

Question 14 Which is CORRECT about banker algorithm?


Correct
Select one:
Mark 1.00 out of
1.00 It detects deadlock in the system
https://112.137.129.56/mod/quiz/review.php?attempt=2291#q11 10/16
7/4/2019
Flag question Bài kiểm tra chương 3, 4
It finds out the safe state of the system

It finds out the safe sequence of the system when a process requests a resource
It does not detect the unsafe state of the system

Question 15 Given the following information of the system.


Incorrect
Pro Allocation Request
Mark 0.00 out of
Available
1.00

Flag question

A B C A B
C A B C

P0 0 1 0 0 0
0 0 0 0

P1 2 0 0 2 0
2

P2 1 0 1 0 1
0

P3 2 1 1 1 0
2

P4 0 0 2 0 0
2

The deadlock detection algorithm will indicate:

Select one:
The system is in a deadlock and P1, P2, P3, P4 are in the deadlock
The system is in a safe state since P0 P2 P1 P3 P4 is a safe sequence
The system is in a deadlock and P1, P3, P4 are in the deadlock

The system is in a deadlock and P0, P1, P2, P3, P4 are in the deadlock

https://112.137.129.56/mod/quiz/review.php?attempt=2291#q11 11/16
7/4/2019 Bài kiểm tra chương 3, 4
Question 16 Given the following system information, and process P0 requests (0, 2, 0) more resources:
Correct
ALLOCATION MAX AVBA
Mark 1.00 out of
LABLE
1.00

Flag question

PROCESS A B C A B C A
B C

P0 0 1 0 7 5 3
3 3 2

P1 2 0 0 3 2 2

P2 3 0 1 9 0 2

P3 2 1 1 2 2 2

P4 0 0 2 4 3 3

Which is the correct value of FINISH and WORK vectors during the running of Banker's
algorithm which is called in the Resource-Request algorithm (to avoid deadlock)?

Select one:
FINISH=(F, F, F, F, F), WORK=(3, 1, 2)

FINISH=(F, F, F, F, F), WORK=(3, 0, 2)


FINISH=(F, F, F, F, F), WORK=(3, 3, 2)
FINISH=(F, F, F, F, F), WORK=(2, 1, 2)

Question 17 Which is incorrect about Semaphore?


Correct
Select one:
Mark 1.00 out of
1.00 wait (or P) operator is corresponding to ENTRY in the protocol of a critical section.

Flag question Semaphore includes an integer and two atomic operators.

wait() operator must be called before signal() in all cases


One important statement in signal (or V) operator is to increase the integer by 1.
https://112.137.129.56/mod/quiz/review.php?attempt=2291#q11 12/16
7/4/2019 Bài kiểm tra chương 3, 4

Question 18 Given the code of a philosopher in the Dinning-philosophers problem with 5 philosophers:
Incorrect
do {
Mark 0.00 out of
1.00

Flag question
wait(chopstick[i]);

wait(chopstick[(i+1)%5];

Eat(i);

signal(chopstick[i]);

signal(chopstick[(i+1)%5];

Think(i);

} while (TRUE);

What value chopstick[i] is initialized?

Select one:
2
0

1
5

Question 19 Given the following system information:


Correct
ALLOCATION REQUEST AVBALABLE
Mark 1.00 out of
1.00

Flag question
PROCESS A B C A B C A
B C
https://112.137.129.56/mod/quiz/review.php?attempt=2291#q11 13/16
7/4/2019 Bài kiểm tra chương 3, 4

P0 0 1 0 0 0 0
0 0 0

P1 2 0 0 2 0 2

P2 3 0 3 0 0 0

P3 2 1 1 1 0 0

P4 0 0 2 0 0 2

Which is correct value of FINISH and WORK vectors during the running of the deadlock
detection algorithm?

Select one:
FINISH=(F, T, F, T, F), WORK=(2, 0, 0)

FINISH=(T, F, T, F, F), WORK=(3, 1, 3)


FINISH=(F, F, T, F, T), WORK=(3, 0, 1)
FINISH=(F, F, T, F, T), WORK=(2, 1, 0)

Question 20 Given the code of Readers-Writers problem:


Correct Process writer P:

Mark 1.00 out of


do {
1.00

Flag question

wait(wrt);

write(data_set);

signal(wrt);

}while (TRUE);
https://112.137.129.56/mod/quiz/review.php?attempt=2291#q11 14/16
7/4/2019 Bài kiểm tra chương 3, 4

Process reader Q:

do {

wait(mutex);

readcount++;

if (readcount ==1) wait(wrt);

signal(mutex);

read(data_set);

wait(mutex);

readcount--;

if (readcount ==0) signal(wrt);

signal(mutex);

} while (TRUE);

Which is the initialized value of the wrt variable in the above algorithm?

Select one:
-1

NULL
0
1

https://112.137.129.56/mod/quiz/review.php?attempt=2291#q11 15/16
7/4/2019 Bài kiểm tra chương 3, 4

Finish review

QUIZ NAVIGATION

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
Show one page at a time
Finish review

You are logged in as Nguyễn Trí Công (Log out)


INT2206-6 Summer 2018-2019

https://112.137.129.56/mod/quiz/review.php?attempt=2291#q11 16/16

You might also like