Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Exam (elaborations)

COS3721 EXAM PACK 2021

Rating
4.0
(2)
Sold
16
Pages
409
Grade
A+
Uploaded on
29-11-2021
Written in
2022/2023

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

Institution
Course

Content preview

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]

Written for

Institution
Course

Document information

Uploaded on
November 29, 2021
File latest updated on
December 9, 2021
Number of pages
409
Written in
2022/2023
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

$4.74
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Reviews from verified buyers

Showing all 2 reviews
3 year ago

3 year ago

4.0

2 reviews

5
1
4
0
3
1
2
0
1
0
Trustworthy reviews on Stuvia

All reviews are made by real Stuvia users after verified purchases.

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
EduPal University of South Africa (Unisa)
Follow You need to be logged in order to follow users or courses
Sold
152803
Member since
7 year
Number of followers
36024
Documents
4894
Last sold
6 hours ago

At EduPal we provide academic assistance, exam preparation, detailed notes, and exam packs to help college students study with confidence. Our tutoring is comprehensive and personalised, focusing on your subject needs and deadlines. We guarantee quality support, clear guidance, and proven strategies that improve understanding, marks, and pass rates. For more information Whats-App 0.8.1..2.7.8..3.3.7.2..

4.2

14187 reviews

5
8235
4
2772
3
1857
2
483
1
840

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions