100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.6 TrustPilot
logo-home
Exam (elaborations)

CS 162 Spring 2024 Midterm II SOLUTIONS

Rating
-
Sold
-
Pages
22
Grade
A+
Uploaded on
21-12-2024
Written in
2024/2025

CS 162 Spring 2024 Midterm II SOLUTIONS

Content preview

University of California, Berkeley
College of Engineering
Computer Science Division  EECS
Spring 2024 John Kubiatowicz

Midterm II
SOLUTION
March 14th, 2024
CS162: Operating Systems and Systems Programming

Your Name:

Your SID:

TA Name:

Discussion Section
Time:

General Information:
This is a closed book exam. You are allowed 2 pages of notes (both sides). You have 2 hours to
complete as much of the exam as possible. Make sure to read all of the questions first, as some of the
questions are substantially more time consuming. Write all of your answers directly on this paper.
Make your answers as concise as possible. On programming questions, we will be looking for
performance as well as correctness, so think through your answers carefully. If there is something
about the questions that you believe is open to interpretation, please ask us about it!

Problem Possible Score

1 18

2 16

3 14

4 13

5 19

6 20

Total 100



Page 1/22

,CS 162 Spring 2024 Midterm II SOLUTION March 14th, 2024




[ Happy  Day! ]

3.14159265358979323846264338327950288419716939937510582097494459230781640628620899




Page 2/22

, CS 162 Spring 2024 Midterm II SOLUTION March 14th, 2024



Problem 1: True/False [18 pts]
Please EXPLAIN your answer in TWO SENTENCES OR LESS (Answers longer than this may not
get credit!). Also, answers without an explanation GET NO CREDIT.

Problem 1a[2pts]: With the Round Robin scheduling policy, the larger the time quantum, Q, the
higher the throughput of execution.
 True ⬜ False
Explain: With a larger time quantum, threads are interrupted less frequently. Consequently, there is
less overhead (saving and restoring of registers, pipeline interruption/draining) and processor mechanisms for
single-threaded performance have more chance to work (caching, branch prediction, etc.)

Problem 1b[2pts]: If the Banker's algorithm finds that it's safe to allocate a resource to an existing
thread, then all threads will eventually complete.
⬜ True  False
Explain: Banker’s algorithm only prevents deadlocks caused by resource-related
dependency cycles. Threads could still fail to complete for a variety of other reasons (such as entering
an infinite loop).

Problem 1c[2pts]: Suppose that a shell program wants to execute another program and wait on its
result. It does this by creating a thread, calling exec() from within that thread, then waiting in the
original thread.
⬜ True  False
Explain: If the shell only creates a new thread, then calling exec() within that thread will
completely replace the shell with the new program (and hence there won’t be an original thread to do
any waiting). The shell program needs to use fork() to create a new process in which to call exec(),
not a new thread.

Problem 1d[2pts]: Because the CFS scheduler uses the same mechanism to choose the next running
thread regardless of whether a thread is interactive or computational, it has poor interactive behavior.
⬜ True  False
Explain: Interactive threads have short bursts and spend most time sleeping; consequently
they will not accumulate as much virtual time as computational threads and will thus run preferentially
when the are ready to run (e.g. when a user has just pressed a key on their keyboard).

Problem 1e[2pts]: A 2-way set-associative cache has a faster hit time than a direct-mapped cache.
⬜ True  False
Explain: Unlike a direct-mapped cache, the 2-way set-associative cache must (1) compare
tags after the cache-bank lookup using the index, (2) use the result to select the direction of a mux and
(3) wait for the data to route through the mux. All of these combine to make a 2-way set-associative
cache slower than a direct-mapped cache.
Page 3/22

Document information

Uploaded on
December 21, 2024
Number of pages
22
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

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.
Wiseman NURSING
View profile
Follow You need to be logged in order to follow users or courses
Sold
7257
Member since
4 year
Number of followers
3859
Documents
27501
Last sold
10 hours ago
Premier Academic Solutions

3.9

1484 reviews

5
733
4
267
3
227
2
81
1
176

Trending documents

Recently viewed by you

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

Frequently asked questions