100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
COS3721 EXAM PACK 2021 $2.93   Add to cart

Exam (elaborations)

COS3721 EXAM PACK 2021

2 reviews
 79 views  16 purchases
  • Course
  • Institution

COS3721 exam questions and answers and summarized notes for exam preparation. or for assistance. All the best on your exams!!

Last document update: 2 year ago

Preview 4 out of 409  pages

  • November 29, 2021
  • December 9, 2021
  • 409
  • 2022/2023
  • Exam (elaborations)
  • Questions & answers

2  reviews

review-writer-avatar

By: sbmbopape • 1 year ago

review-writer-avatar

By: Rio12345 • 2 year ago

avatar-seller
COS3721

EXAM PACK

, This paper consists of 5 pages.

Instructions:

1. Answer all the five (5) questions in your answer book.

2. All rough work must be done in your answer book.

3. Please answer the questions in order. If you want to do a question later, leave a blank space.

4. The string SGG (Silberschatz, Galvin & Gagne) refers to the prescribed book, namely,
Operating Systems Concepts, 9th edition for this module.




Good luck!




[TURN OVER]

, Page 2 of 10 COS3721
October/November 2018



Question 1 : 14 Marks


1.1 Describe some of the challenges of designing operating systems for mobile devices
compared with designing operating systems for traditional PCs. [4]
Answer:
The greatest challenges in designing mobile operating systems include:
 Less storage capacity means the operating system must manage memory carefully.
 The operating system must also manage power consumption carefully.
 Less processing power plus fewer processors mean the operating system must carefully
apportion processors to applications.

1.2 Explain why Java programs running Android systems do not use the standard Java API and
virtual machine. [2]
Answer:
It is because the standard API and virtual machine are designed for desktop and server systems,
not mobile devices. Google developed a separate API and virtual machine for mobile devices.

1.3 A multithreaded web server wishes to keep track of the number of requests it services
(known as hits.) Consider the following two strategies to prevent a race condition on the variable
hits. The first strategy is to use a basic mutex lock when updating hits:

int hits;
mutex_lock hit_lock;
hit_lock.acquire();
hits++;
hit_lock.release();

A second strategy is to use an atomic integer:
Atomic_t hits;
Atomic_inc(&hits);

Explain which of these two strategies is more efficient. [4]
Answer:

The use of locks is overkill in this situation. Locking generally requires a system call and possibly
putting a process to sleep (and thus requiring a context switch) if the lock is unavailable.
(Awakening the process will similarly require another subsequent context switch.) On the other
hand, the atomic integer provides an atomic update of the hits variable and ensures no race
condition on hits. This can be accomplished with no kernel intervention and therefore the second
approach is more efficient.


[TURN OVER]

, Page 3 of 10 COS3721
October/November 2018



1.4 Which of the following scheduling algorithms could result in starvation? Explain.
[4]
(a) Shortest Job First
(b) Round-Robin
Answer:
(a) The SJF could result in starvation when shortest jobs keep on joining the ready queue which
already contains a process with highest burst time.
(b) RR could not result in starvation since each process ready for execution has equal chances to
be executed based on the time quantum.


Question 2: 24 Marks

2.1 Consider the following code segment:
Pid_t pid;
pid = fork( );
if ( pid = = 0 ) { / * child process * /
fork ( );
thread_create ( . . . );
}
Fork ( );
(a) How many unique processes are created? [2]
Answer:
There are six processes.
(b) How many unique threads are created? [2]
Answer:
There are two threads.

2.2 Consider a system consisting of four resources of the same type that are shared by three
processes, each of which needs at most two resources. Is this system deadlock free? Show the full
workings. [4]
Answer:

Suppose the system is deadlocked. This implies that each process is holding one resource and is waiting
for one more. Since there are three processes and four resources, one process must be able to obtain
two resources. This process requires no more resources and, therefore it will return its resources when
done.



2.3 Discuss how the following pairs of scheduling criteria conflict in certain settings. [6]

[TURN OVER]

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller iStudy. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for $2.93. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

80630 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 14 years now

Start selling
$2.93  16x  sold
  • (2)
  Add to cart