100% tevredenheidsgarantie Direct beschikbaar na je betaling Lees online óf als PDF Geen vaste maandelijkse kosten 4,6 TrustPilot
logo-home
Tentamen (uitwerkingen)

CS 162 Spring 2024 Midterm II SOLUTIONS

Beoordeling
-
Verkocht
-
Pagina's
22
Cijfer
A+
Geüpload op
21-12-2024
Geschreven in
2024/2025

CS 162 Spring 2024 Midterm II SOLUTIONS

Instelling
Vak

Voorbeeld van de inhoud

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

Geschreven voor

Instelling
Vak

Documentinformatie

Geüpload op
21 december 2024
Aantal pagina's
22
Geschreven in
2024/2025
Type
Tentamen (uitwerkingen)
Bevat
Vragen en antwoorden

Onderwerpen

Maak kennis met de verkoper

Seller avatar
De reputatie van een verkoper is gebaseerd op het aantal documenten dat iemand tegen betaling verkocht heeft en de beoordelingen die voor die items ontvangen zijn. Er zijn drie niveau’s te onderscheiden: brons, zilver en goud. Hoe beter de reputatie, hoe meer de kwaliteit van zijn of haar werk te vertrouwen is.
Wiseman NURSING
Volgen Je moet ingelogd zijn om studenten of vakken te kunnen volgen
Verkocht
7257
Lid sinds
4 jaar
Aantal volgers
3859
Documenten
27501
Laatst verkocht
10 uur geleden
Premier Academic Solutions

3,9

1484 beoordelingen

5
733
4
267
3
227
2
81
1
176

Populaire documenten

Recent door jou bekeken

Waarom studenten kiezen voor Stuvia

Gemaakt door medestudenten, geverifieerd door reviews

Kwaliteit die je kunt vertrouwen: geschreven door studenten die slaagden en beoordeeld door anderen die dit document gebruikten.

Niet tevreden? Kies een ander document

Geen zorgen! Je kunt voor hetzelfde geld direct een ander document kiezen dat beter past bij wat je zoekt.

Betaal zoals je wilt, start meteen met leren

Geen abonnement, geen verplichtingen. Betaal zoals je gewend bent via Bancontact, iDeal of creditcard en download je PDF-document meteen.

Student with book image

“Gekocht, gedownload en geslaagd. Zo eenvoudig kan het zijn.”

Alisha Student

Veelgestelde vragen