COMP3231 Final Exam V1

11/05/2020 Sample Final Exam V2: Attempt review

https://moodle.telt.unsw.edu.au/mod/quiz/review.php?attempt=7078995&cmid=2957991&showall=1 1/17

Dashboard  My courses  COMP9283-COMP3231-COMP3891-COMP9201-5203_00462  General  Sample Final Exam V2

Information

Question 1
Not answered

Marked out of

Question 2
Not answered

Marked out of

Question 3
Not answered

Marked out of

Question 4
Not answered

Marked out of

Started on Monday, 11 May 2020, 3�33 PM

State Finished

Completed on Monday, 11 May 2020, 4�58 PM

Time taken 1 hour 24 mins

Grade 0.00 out of 86.00 (0%)

(Staff Only)

 Site Home

 Announcements 

 User Guides

For each question in this section, classify the overall statement as �ẃẴǴ if the statement is generally true, or à ǀ ḵẎǴ if the statement (or
a component of it) is false.

You will receive one mark for each correct classification, and lose one mark for each incorrect

classification. You gain zero marks for each question left unclassified. 

A system uses a resource management policy that is potentially prone to starvation (e.g. shortest job first scheduling). When

starvation occurs, the whole system makes no progress.

Select one:

The correct answer is: False

Multi-threaded applications (i.e. user-level code) can avoid race conditions by disabling and enabling interrupts.

Select one:

The correct answer is: False

Implementing a ẎṿḙṎḵṙ ǜḮ with an atomic ẤǴẎẤᾷǀ ṎǨᾷẎǴẤ instruction avoids the issue of busy waiting.

Select one:

The correct answer is: False

On a uniprocessor machine, disabling interrupts prior to entering short critical sections, and re-enabling interrupts on exiting is a

reasonable approach to achieving mutual exclusion within critical sections inside the operating system.

Select one:

The correct answer is: True

https://moodle.telt.unsw.edu.au/my/
https://moodle.telt.unsw.edu.au/course/view.php?id=48561
https://moodle.telt.unsw.edu.au/mod/quiz/view.php?id=2957991
http://www.unsw.edu.au/
http://bit.ly/2vxLDNi
http://bit.ly/2vxLDNi
http://bit.ly/2CsKery
http://bit.ly/2CsKery
http://bit.ly/2FECVjK
http://bit.ly/2FECVjK
https://moodle.telt.unsw.edu.au/?redirect=0
http://moodle.telt.unsw.edu.au/mod/page/view.php?id=41448
https://student.unsw.edu.au/moodle/support

11/05/2020 Sample Final Exam V2: Attempt review

https://moodle.telt.unsw.edu.au/mod/quiz/review.php?attempt=7078995&cmid=2957991&showall=1 2/17

Question 5
Not answered

Marked out of

Question 6
Not answered

Marked out of

Question 7
Not answered

Marked out of

Question 8
Not answered

Marked out of

An operating system implements deadlock detection. Upon detecting deadlock, it notifies the system administrator of the set of

deadlocked processes that it has detected. A practical method of deadlock recovery is for the administrator to kill one of the

processes in the set, thus allowing the others to continue.

Select one:

The correct answer is: True

The following synchronised code ( ḙṎǜᾨᾩ ) is deadlock free when called by multiple threads concurrently. Note: ḙṎǜᾨᾩ is the only
function that acquires ǜṙ ẴṎẤ�ḵṙ ǜḮ .

int count;
void inc()
lock_acquire(count_lock);
count = count + 1;
lock_release(count_lock);

Select one:

The correct answer is: True

Semaphores can be used to implement mutually exclusive execution in ǜẃḙẤḙǜǀ ḵ ẎǴǜẤḙṙ ṎẎ in a multi-threaded program by initialising the
semaphore count to zero.

Select one:

The correct answer is: False

File systems based on indexed allocation (i.e. i-node-based file systems) have good random access performance.

Select one:

The correct answer is: True

11/05/2020 Sample Final Exam V2: Attempt review

https://moodle.telt.unsw.edu.au/mod/quiz/review.php?attempt=7078995&cmid=2957991&showall=1 3/17

Question 9
Not answered

Marked out of

Question 10
Not answered

Marked out of

Question 11
Not answered

Marked out of

Question 12
Not answered

Marked out of

Question 13
Not answered

Marked out of

In a typical UNIX file system, such as ext2fs, the attributes of the file (e.g., file owner, size, and creation time) are stored in the

directory entry.

Select one:

The correct answer is: False

A hypothetical i-node-based file system consists of i-nodes with only 12 direct addresses of blocks, and no addresses of indirect

blocks. Each direct address is a 32-bit integer, and the block size is 2KiB. This file system only supports files with a maximum size of

Select one:

The correct answer is: True

Adding journaling to a file system (co-located on the same device) improves reliability without changing the number of writes to the

Select one:

The correct answer is: False

File systems based on contiguous allocation are suitable for read-only media such as optical disks (DVDs and CDs).

Select one:

The correct answer is: True

Sparse files save disk space by not storing the blocks of the file that are not written to.

Select one:

The correct answer is: True

11/05/2020 Sample Final Exam V2: Attempt review

https://moodle.telt.unsw.edu.au/mod/quiz/review.php?attempt=7078995&cmid=2957991&showall=1 4/17

Question 14
Not answered

Marked out of

Question 15
Not answered

Marked out of

Question 16
Not answered

Marked out of

Question 17
Not answered

Marked out of

Question 18
Not answered

Marked out of

A file system using linked-list disk allocation (also termed chained allocation) provides poor random access performance.

Select one:

The correct answer is: True

On a microprocessor with no privileged mode, an operating system can implement resource allocation policies, but not enforce them.

Select one:

The correct answer is: True

Using an operating system is always more efficient than programming the computer hardware directly, even for a single simple

application.

Select one:

The correct answer is: False

An operating system provides a high-level programming interface to the low-level computer hardware for applications.

Select one:

The correct answer is: True

Compared to ṿṙ ḵḵǴǨ I/O, ḙṎẤǴẃẃẴṿẤᾷǨẃḙỴǴṎ I/O is preferable when there is a significant delay between requesting something from a
device and the device providing the response.

Select one:

The correct answer is: True

11/05/2020 Sample Final Exam V2: Attempt review

https://moodle.telt.unsw.edu.au/mod/quiz/review.php?attempt=7078995&cmid=2957991&showall=1 5/17

Question 19
Not answered

Marked out of

Question 20
Not answered

Marked out of

Question 21
Not answered

Marked out of

Question 22
Not answered

Marked out of

Question 23
Not answered

Marked out of

On a uniprocessor machine, it is more efficient to ǘḵṙ ǜḮ  and context switch than to spin (busy-wait) on a lock, even if the context
switching overhead is very high.

Select one:

The correct answer is: True

On a multiprocessor machine, a single ẃǴǀ Ǩӑ ẂẴǴẴǴ in the operating system provides automatic load balancing across CPUs.

Select one:

The correct answer is: True

Application multi-threading implemented entirely at user-level (i.e. user-level threads) does not expose the concurrency available in

the application to the operating system.

Select one:

The correct answer is: True

Application multi-threading provided by kernel-provided threads can have higher overheads (i.e. the time it takes to execute

individual operations) than user-level threads as thread management (such as creation, and blocking/unblocking) requires a system

call into the operating system.

Select one:

The correct answer is: True

In the three-state process model, a common state transition is from the ẃǴǀ Ǩӑ state to the ǘḵṙ ǜḮ ǴǨ state.

Select one:

The correct answer is: False

11/05/2020 Sample Final Exam V2: Attempt review

https://moodle.telt.unsw.edu.au/mod/quiz/review.php?attempt=7078995&cmid=2957991&showall=1 6/17

Question 24
Not answered

Marked out of

Question 25
Not answered

Marked out of

Question 26
Not answered

Marked out of

Question 27
Not answered

Marked out of

Question 28
Not answered

Marked out of

An I/O-bound process spends a significant fraction of its execution time blocked waiting for I/O. One can reduce the overall execution

time of the application by using user-level threads to overlap the application’s blocking I/O with its execution.

Select one:

The correct answer is: False

Application multi-threading implemented entirely at user-level (i.e. user-level threads) can be used to take advantage of multiple

processors to increase performance, even in the situation of a single runnable process.

Select one:

The correct answer is: False

In a multi-threaded environment, local variables declared within a function have to be synchronised as they are allocated on a stack

shared between all the threads.

Select one:

The correct answer is: False

General purpose schedulers aim to improve interactivity and I/O performance by favouring I/O-bound processes (and threads) over

CPU-bound processes (and threads). This improvement for I/O-bound processes comes with the disadvantage of dramatically

reducing the CPU available to CPU-bound processes (and threads).

Select one:

The correct answer is: False

đ ṙ ẴṎǨᾷẃṙ ǘḙṎ ẎǜḎǴǨẴḵḙṎḅ  gives each ẃǴǀ Ǩӑ  process (or thread) a turn to execute for a ẤḙṊ ǴẎḵḙǜǴ length of time. A short timeslice
provides good interactive response times at the expense of more overhead due to more frequent context switching.

Select one:

The correct answer is: True

11/05/2020 Sample Final Exam V2: Attempt review

https://moodle.telt.unsw.edu.au/mod/quiz/review.php?attempt=7078995&cmid=2957991&showall=1 7/17

Question 29
Not answered

Marked out of

Question 30
Not answered

Marked out of

Question 31
Not answered

Marked out of

Question 32
Not answered

Marked out of

Question 33
Not answered

Marked out of

Applications running as the ẃṙ ṙ Ấ user under UNIX (or ǀ ǨṊ ḙṎḙẎẤẃǀ Ấṙ ẃ under Windows XP/Vista/7/8/10) all run in the processor’s
privileged mode.

Select one:

The correct answer is: False

The arguments to system calls are placed in registers (or on the application’s stack) based on a mutually defined convention

between the operating system and user-level applications.

Select one:

The correct answer is: True

A system call ṿẃṙ ǜǴẎẎṙ ẃ ḙṎẎẤẃẴǜẤḙṙ Ṏ is one way to trigger the transition between the application running in user-mode to the
Operating System running in privileged mode.

Select one:

The correct answer is: True

Every access to an application virtual address is translated to a physical address using the information in a page table. The processor

itself may cache a subset of the translation information in the Ấẃǀ ṎẎḵǀ Ấḙṙ Ṏ ḵṙ ṙ Ḯ ᾷǀ ẎḙǨǴ ǘẴḂḂǴẃ (TLB).

Select one:

The correct answer is: True

In a system using page-based virtual memory, increasing the page size will generally increase the TLB miss rate.

Select one:

The correct answer is: False

11/05/2020 Sample Final Exam V2: Attempt review

https://moodle.telt.unsw.edu.au/mod/quiz/review.php?attempt=7078995&cmid=2957991&showall=1 8/17

Question 34
Not answered

Marked out of

Question 35
Not answered

Marked out of

Question 36
Not answered

Marked out of

Question 37
Not answered

Marked out of

Question 38
Not answered

Marked out of

Memory compaction can be performed transparently to an application on a computer architecture that uses ǘǀ ẎǴand ḵḙṊ ḙẤ registers
for memory management.

Select one:

The correct answer is: True

When the amount of virtual memory allocated in a system exceeds the physical memory size, ẤḎẃǀ ẎḎḙṎḅ always occurs.

Select one:

The correct answer is: False

The size of a virtual memory page is some power of 2, and pages are aligned on boundaries that are also the same power of 2.

Select one:

The correct answer is: True

Spatial locality contributes to virtual memory system efficiency, but temporal locality does not.

Select one:

The correct answer is: False

Ďỹ ǀ ṿṿḙṎḅ allows an application larger than physical memory to execute.

Select one:

The correct answer is: False

COMP3231/COMP9201/COMP3891/COMP9283 Operating Systems T1-2020 Kah May Tan

11/05/2020 Sample Final Exam V2: Attempt review

https://moodle.telt.unsw.edu.au/mod/quiz/review.php?attempt=7078995&cmid=2957991&showall=1 9/17

Question 39
Not answered

Marked out of

Question 40
Not answered

Marked out of

Question 41
Not answered

Marked out of

Question 42
Not answered

Marked out of

Information

An ḙṎỴǴẃẤǴǨ ṿǀ ḅǴ Ấǀ ǘḵǴ is a single data structure shared between all processes, therefore, it is efficient at enabling the sharing of
virtual memory between multiple processes.

Select one:

The correct answer is: False

A hypothetical computer has a 48-bit virtual address space and a 32-bit physical address space. It also uses an 8KiB page size. On

such a computer, a single level page table would need entries.

Select one:

The correct answer is: False

In this section you will match pairs that are the most closely related. Each correct pair earns  of the marks available for the

question, where is the number of pairs to match.

ZǴǀ Ǩḵṙ ǜḮ ṿẃǴỴǴṎẤḙṙ Ṏ is a strategy where one of the four conditions required for deadlock is prevented, thereby preventing deadlock
from occurring.

Listed below are the four conditions required for deadlock and four approaches to preventing the condition from occurring. Match

the individual condition with its method of prevention.

No Preemption Choose…

Mutual exclusion Choose…

Hold and Wait Choose…

Circular Wait Choose…

The correct answer is: No Preemption → Nearly always impractical to remove a resource, Mutual exclusion → Always infeasible, Hold

and Wait → Allocate all required resources initially, Circular Wait → Use a single defined order of resource acquistion

Given the statements below, match them to whether they describe internal, external, or not fragmentation.

Space wasted due to space needed being larger than space available between existing allocations. Choose…

Space wasted due to space needed being smaller than space allocated. Choose…

The correct answer is: Space wasted due to space needed being larger than space available between existing allocations. → External

fragmentation, Space wasted due to space needed being smaller than space allocated. → Internal fragmentation

11/05/2020 Sample Final Exam V2: Attempt review

https://moodle.telt.unsw.edu.au/mod/quiz/review.php?attempt=7078995&cmid=2957991&showall=1 10/17

Question 43
Not answered

Marked out of

Question 44
Not answered

Marked out of

Information

For each resource, OS or processor feature listed below, indicate whether it is accessible in kernel (privileged) mode, user mode, or

in both modes.

 

An add instruction Choose…

Hard disk drive controller registers Choose…

An interrupt disabling instruction Choose…

A TLB management instruction Choose…

The application’s memory containing the ẎẤǀ ṎǨǀ ẃǨ Q ḵḙǘẃǀ ẃӑ Choose…

The registers used to transfer system call arguments. Choose…

The application’s page table Choose…

Application memory Choose…

The correct answer is: An add instruction → Kernel mode and user mode, Hard disk drive controller registers → Kernel mode, An

interrupt disabling instruction → Kernel mode, A TLB management instruction → Kernel mode, The application’s memory containing

the ẎẤǀ ṎǨǀ ẃǨ Q ḵḙǘẃǀ ẃӑ → Kernel mode and user mode, The registers used to transfer system call arguments. → Kernel mode and user
mode, The application’s page table → Kernel mode, Application memory → Kernel mode and user mode

In a system that supports multi-threaded processes, for each attribute listed below, indicate whether it is a per process or a per

thread attribute.

 

Virtual address space Choose…

Program counter Choose…

Local variables Choose…

Open file descriptors Choose…

Global variables Choose…

The execution state, e.g. blocked, ready, running Choose…

General purpose registers Choose…

Stack Choose…

The correct answer is: Virtual address space → Per process, Program counter → Per thread, Local variables → Per thread, Open file

descriptors → Per process, Global variables → Per process, The execution state, e.g. blocked, ready, running → Per thread, General

purpose registers → Per thread, Stack → Per thread

This section consists of choosing the most correct answer from the multiple choices available.

A correct answer earns 100% of the marks available. An incorrect answer subtracts   of the marks available, where  is the

number of choices available in the question.

For example, an incorrect answer to a questions with 5 choices would reduce your marks by  of the marks available for the

specific question.

No marks are awarded or subtracted for unanswered questions.

11/05/2020 Sample Final Exam V2: Attempt review

https://moodle.telt.unsw.edu.au/mod/quiz/review.php?attempt=7078995&cmid=2957991&showall=1 11/17

Question 45
Not answered

Marked out of

Bill and Ben are two threads that execute the functions of the same name below respectively. Bill and Ben are prone to deadlock.

Identify the function calls in Bill and Ben where they end up deadlocked if they deadlock. 

Each line of code in each function has a line number to help you identify the location of deadlock. 

void bill() 
1:    lock_acq(&file2)
2:    lock_acq(&file3)
3:    lock_acq(&file1)

/* access all three files mutually exclusively */

4:    lock_rel(&file3)
5:    lock_rel(&file1)

/* do nothing */

6:    lock_acq(&file1)

/* access file1 and file2 mutually exclusively */

7:    lock_rel(&file1)
8:    lock_rel(&file2)

void ben()
1:     lock_acq(&file2)
2:     lock_acq(&file3)
3:     lock_acq(&file1)

/* access all three files mutually exclusively */

4:    lock_rel(&file3)
5:    lock_rel(&file2)

/* do nothing */

6:    lock_acq(&file3)

/* write to file1 and file3 */

7:    lock_rel(&file1)
8:    lock_rel(&file3)

Select one:

Bill line 6, Ben line 3

Bill line 4, Ben line 7

Bill line 3, Ben line 6

Bill line 6, Ben line 6

The correct answer is: Bill line 3, Ben line 6

11/05/2020 Sample Final Exam V2: Attempt review

https://moodle.telt.unsw.edu.au/mod/quiz/review.php?attempt=7078995&cmid=2957991&showall=1 12/17

Question 46
Not answered

Marked out of

In most UNIX file systems, every file has an index block, called an ḙᾷṎṙ ǨǴ, which is used to store
information about the file as well as pointers to data blocks, as shown in the diagram below.

Assume a block size of 2 KiB (2048 bytes) and 4-byte block numbers. What is the approximate largest possible file size supported

by this filesystem?

Select one:

275415851008 bytes

1048576 bytes

274877906944 bytes

24576 bytes

8.796 * 10^12 bytes

536870912 bytes

The correct answer is: 275415851008 bytes

11/05/2020 Sample Final Exam V2: Attempt review

https://moodle.telt.unsw.edu.au/mod/quiz/review.php?attempt=7078995&cmid=2957991&showall=1 13/17

Question 47
Not answered

Marked out of

Below is a (somewhat compressed and simplified) snapshot of a TLB with 20 entries.

All mappings use 4 KiB page sizes. “VPN” is the virtual page number, “PFN” is the physical frame

number, “V” indicates if the entry is valid (1) or not (0), and “D” (Dirty) indicates if a valid entry

is writable (1) or not (0). All numbers are hexadecimal.

200 31a 0 1

7fffe 54 1 1

7fffd 56 0 0

7ffff 50 1 1

201 6d 1 1

203 aa 0 1

202 4f 1 1

7fffc 97 1 1

 

If software attempts to access virtual address 0x7fffe18d, choose the most accurate answer from the options below.

Select one:

A TLB exception occurs.

Physical address 0x5418d is accessed, stores are not allowed.

Physical address 0x54 is accessed, and stores are allowed.

Physical address 0x54 is accessed

Physical address 0x5418d is accessed, and stores are allowed.

The correct answer is: Physical address 0x5418d is accessed, and stores are allowed.

11/05/2020 Sample Final Exam V2: Attempt review

https://moodle.telt.unsw.edu.au/mod/quiz/review.php?attempt=7078995&cmid=2957991&showall=1 14/17

Question 48
Not answered

Marked out of

Below is a (somewhat compressed and simplified) snapshot of a TLB with 20 entries.

All mappings use 4 KiB page sizes. “VPN” is the virtual page number, “PFN” is the physical frame

number, “V” indicates if the entry is valid (1) or not (0), and “D” (Dirty) indicates if a valid entry

is writable (1) or not (0). All numbers are hexadecimal.

200 31a 0 1

7fffe 54 1 1

7fffd 56 0 0

7ffff 50 1 1

201 6d 1 1

203 aa 0 1

202 4f 1 1

7fffc 97 1 1

 

If software attempts to access virtual address 0x00009dde, choose the most accurate answer from the options below.

Select one:

Physical address 0x7adde is invalid, but stores are allowed.

Physical address 0x7a is accessed

Physical address 0x7adde is accessed, and stores are allowed.

Physical address 0x7a is invalid but stores are allowed.

A TLB exception occurs.

The correct answer is: A TLB exception occurs.

11/05/2020 Sample Final Exam V2: Attempt review

https://moodle.telt.unsw.edu.au/mod/quiz/review.php?attempt=7078995&cmid=2957991&showall=1 15/17

Question 49
Not answered

Marked out of

Below is a (somewhat compressed and simplified) snapshot of a TLB with 20 entries.

All mappings use 4 KiB page sizes. “VPN” is the virtual page number, “PFN” is the physical frame

number, “V” indicates if the entry is valid (1) or not (0), and “D” (Dirty) indicates if a valid entry

is writable (1) or not (0). All numbers are hexadecimal.

200 31a 0 1

7fffe 54 1 1

7fffd 56 0 0

7ffff 50 1 1

201 6d 1 1

203 aa 0 1

202 4f 1 1

7fffc 97 1 1

 

If software attempts to access virtual address 0x7fffd257, choose the most accurate answer from the options below.

Select one:

A TLB exception occurs.

Physical address 0x56 is accessed

Physical address 0x56257 is accessed, and stores are allowed.

Physical address 0x56 is invalid but stores are allowed.

Physical address 0x56257 is invalid, but stores are allowed.

The correct answer is: A TLB exception occurs.

11/05/2020 Sample Final Exam V2: Attempt review

https://moodle.telt.unsw.edu.au/mod/quiz/review.php?attempt=7078995&cmid=2957991&showall=1 16/17

Question 50
Not answered

Marked out of

Below is a (somewhat compressed and simplified) snapshot of a TLB with 20 entries.

All mappings use 4 KiB page sizes. “VPN” is the virtual page number, “PFN” is the physical frame

number, “V” indicates if the entry is valid (1) or not (0), and “D” (Dirty) indicates if a valid entry

is writable (1) or not (0). All numbers are hexadecimal.

200 31a 0 1

7fffe 54 1 1

7fffd 56 0 0

7ffff 50 1 1

201 6d 1 1

203 aa 0 1

202 4f 1 1

7fffc 97 1 1

 

If software attempts to access virtual address 0x200a2f, choose the most accurate answer from the options below.

Select one:

A TLB exception occurs.

Physical address 0x31a is accessed

Physical address 0x31a is accessed, but stores are not allowed.

Physical address 0x31aa2f is accessed, and stores are allowed.

Physical address 0x31aa2f is accessed, but stores are not allowed.

The correct answer is: Physical address 0x31aa2f is accessed, but stores are not allowed.

11/05/2020 Sample Final Exam V2: Attempt review

https://moodle.telt.unsw.edu.au/mod/quiz/review.php?attempt=7078995&cmid=2957991&showall=1 17/17

Question 51
Not answered

Marked out of

Information

Below is a (somewhat compressed and simplified) snapshot of a TLB with 20 entries.

All mappings use 4 KiB page sizes. “VPN” is the virtual page number, “PFN” is the physical frame

number, “V” indicates if the entry is valid (1) or not (0), and “D” (Dirty) indicates if a valid entry

is writable (1) or not (0). All numbers are hexadecimal.

200 31a 0 1

7fffe 54 1 1

7fffd 56 0 0

7ffff 50 1 1

201 6d 1 1

203 aa 0 1

202 4f 1 1

7fffc 97 1 1

 

If software attempts to access virtual address 0x00005765, choose the most accurate answer from the options below.

Select one:

Physical address 0x6c is accessed

Physical address 0x6c765 is accessed, and stores are allowed.

A TLB exception occurs.

Physical address 0x6c765 is accessed, stores are not allowed.

Physical address 0x6c is accessed, and stores are allowed.

The correct answer is: Physical address 0x6c765 is accessed, and stores are allowed.

This is the last page of the exam. 

You can submit your exam by clicking Finish attempt … , and Submit all and finish at the bottom of the page, and confirm via the