Assignment No. 2: Instructions

You might also like

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

Bahria University, Islamabad Campus

Department of Computer Sciences


Class/Section: BS(CS) (5A, 5B)
(Spring 2021 Semester)
Assignment No. 2

Course: Operating Systems Date: 6-4-2021


Course Code:
CS325 Time:
Faculty’s Name: Mehroz Sadiq Max Marks: 10

INSTRUCTIONS:
I. All questions are compulsory.
II. There are total five questions.
III. The paper is closed book.

Student’s Name: Hamza Ahmad Enroll No: 01-134191-040


(USE CAPITAL LETTERS)

Question#1: Provide two programming examples in which multithreading provides


better performance than a single threaded solution.

Answer:

 A parallelized application, for example, network augmentation where various


pieces of the grid might be dealt with in equal.
 An intuitive GUI program, for example, a debugger where a string is utilized to
screen client input, another string addresses the running application, and a third
string screens execution.
 A Web worker that benefits each solicitation in a different string.

Question#2: What are two differences between user level threads and kernel level
threads? Under what circumstances is one type better than the other?

Answer:

Client level strings are obscure by the bit, while the bit knows about bit strings.
On frameworks utilizing either M:1 or M:N planning, client strings are booked by the
string library and the portion plans bit strings.
 Piece strings need not be related with an interaction though every client string has a
place with a cycle. Portion strings are for the most part more costly to keep up than
client strings as they should be addressed with a bit information structure.
Question#3: Describe the actions taken by a kernel to context switching between kernel
level threads.

Page 1 of 2
%
Enrollment Number: 01-134191-081

Answer:

Setting exchanging between bit strings regularly requires saving the estimation of the CPU
registers from the string being changed out and reestablishing the CPU registers of the new
string being planned.

Question#4: What resources are used when a thread is created? How do they differ from
those used when a process is created?

Answer: Since a string is more modest than an interaction, string creation commonly utilizes
less assets than measure creation. Making a cycle requires allotting an interaction control
block (PCB), an enormous information structure. The PCB incorporates a memory map,
rundown of open documents, and climate factors. Designating and dealing with the memory
map is regularly the most tedious movement. Making either a client or part string includes
apportioning a little information construction to hold a register set, stack, and need.

Question#5: Can a multithreaded solution using multiple user level threads achieve
better performance on a multiprocessor system than on a single processor system?
Explain.

Answer: Certainly. On a single-core system, the one core has no choice but to timeslice itself
among the ready-to-execute threads, whereas in a multi core system there can be multiple
threads executing simultaneously, up to the number of available cores, without incurring a
penalty for having to divide a single core’s available time.

The End of Question Sheet

Page 2 of 2

You might also like