COMP 3430 Operating Systems: Instructions

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

COMP 3430 Operating systems

Term test 2
Franklin Bristow and Rasit Eskicioglu

April 16th, 2021

Instructions
Due date: April 16th, 2021 at 11:59pm CST (Winnipeg time) on UM Learn.
• All questions for this test are contained within this document.

– Any additional resources you need to answer questions are provided as both
URLs (direct to the source) and as a PDF on the course web page (in the same
place you found this document).

• You must write your answers in the provided template. If you do not answer the
questions using the provided template, your submission will not be graded (you will
earn a score of 0).

• Provide your answers to questions in the correct location in the template document
(i.e., write your answer for question 1 in the question 1 section). You will not be
awarded points for a question if your answer for the question is not in the correct
section.

• You are explicitly permitted to refer to resources that are provided to you as part of
this course (slides, discussion questions, etc). Further, you are explicitly permitted to
refer to the notes that you took during class with your team. You can consider this to
be an open book test.

• You are explicitly not permitted to share answers or discuss test questions with your
classmates. Further, you are explicitly not permitted to post these questions on
“homework help” or “tutorial” websites. Please do not ask questions about the test on
the course forum.

• You must complete the honesty declaration checklist before you can see the
submission folder for this test.

• Submissions are only accepted on UM Learn. Submissions will not be accepted by e-


mail.

• Late submissions will not be accepted, the submission deadline is enforced


electronically.
• You may ask questions about the test and related content on Zoom during the
scheduled class meeting time or by e-mail. Your instructor will be available for
questions during the scheduled class time (A01: 1:30pm–2:20pm, A02: 12:30pm–
1:20pm). You may also ask questions by e-mail (9:00am – 3:30pm). E-mails received
after 3:30pm may not be answered.

To help make sure that the instructors are able to answer your questions, please make
sure that all questions submitted by e-mail about the term test include the string
“[COMP 3430 Term Test 2]” in the subject line.

• Please be concise with your answers. Following the suggested answer lengths would
be the best.

Questions
1. File systems like vsfs use data structures like an array of blocks and multi-level paging
uses a page directory which is essentially an array of page directory entries. Both
multi-level paging and file systems rely on structures that use arrays.

2. FAT32 because it is more efficient in allocating disk space and wastes less space. It
also does not limit the number of entries in the root folder.

3. The metadata is not required. We can go through the file system and calculate the
information that the metadata readily provides. They are useful because they save
time and work, instead of going through the whole file system counting the number of
free clusters or finding the next free cluster, this metadata provides us that
information in real time.

4. The scheduler can cause various problems when a lock is introduced; some of the
problems include deadlock, bottleneck, granularity and priority inversion. For
example, if there is a resource that is accessed frequently by multiple threads and is
protected by a lock, a thread could gain access to this resource pre-emptively and keep
access to the resource for longer than expected causing other threads to be stuck
waiting for the lock to be released.
Using semaphores as ordering primitive will resolve the problem, since there would
be signals sent to wake the waiting thread.

5. Thrashing will occur if a process does not have enough frames to hold all the pages for
its execution. This machine has more frames than total pages, so the machine will not
thrash.

6. SCAN services requests in order across the tracks, so it gives all the blocks on a track
an equal chance of getting services on each sweep. C-SCAN sweeps from outer to inner
tracks and resets back to the outer tracks, this favors all tracks equally unlike SCAN
which favors the middle tracks as it will cross the middle twice before getting back to
the outer tracks. This prevents starvation.
No, the same solution is not used here, in terms of task scheduling algorithm the
solution was to give each task an equal opportunity to run but in locking mechanisms,
the solution was focused on preventing bugs like deadlock, equal opportunity to run
does not solve that problem instead makes it more likely.

7. Mutual exclusion: when t1 starts, v2 acquires the lock since adAll is called (because
it calls toArray())

Hold-and-wait: the synchronized object keeps the lock until execution is complete.

No preemption: no locks are forcibly removed from threads

Circular wait: v2 holds the lock which is required by v1

Yes it will deadlock, because all the conditions for deadlock are met. And t1 waits to
finish but t2 is already running and it cannot forcibly acquire the lock.

8. a) 12 direct block pointers, 1 single indirect block pointer.

b) 12 direct block ptrs=12 blocks


2048
single indirect block ptr= =256 blocks
8
2048 2
double indirect block ptr=( 8) =65536 blocks

2048 3
triple indirect block ptr=( ) =16777216 blocks
8

Total of 16,843,020 blocks and a total of about 32.1GB

c) The first 12 direct block pointers store 24KB = 24576 bytes


2048001 – 24576 = 2023425 bytes
Each block in the indirect block ptrs hold 256  2048 bytes = 524288 bytes
2023425/524288 = 3.85
So we are going to need 4 blocks from the indirect blocks
12 direct block + 4 indirect block = 16 blocks

You might also like