0% found this document useful (0 votes)
13 views3 pages

Comp354 Ex2

This document outlines the objectives and exercises for COMP-354 Operating Systems Exercise Set 2, focusing on key OS concepts, process and thread understanding, and CPU scheduling algorithms. It includes questions on operating systems definitions, dual-mode operation benefits, multiprocessor systems, interrupts, command interpreters, context-switching, and Gantt chart derivations for various scheduling algorithms. Additionally, it presents two tables with processes for practical exercises in scheduling and performance evaluation.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views3 pages

Comp354 Ex2

This document outlines the objectives and exercises for COMP-354 Operating Systems Exercise Set 2, focusing on key OS concepts, process and thread understanding, and CPU scheduling algorithms. It includes questions on operating systems definitions, dual-mode operation benefits, multiprocessor systems, interrupts, command interpreters, context-switching, and Gantt chart derivations for various scheduling algorithms. Additionally, it presents two tables with processes for practical exercises in scheduling and performance evaluation.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

COMP–354 Operating Systems Exercise Set 2 1

Department of Computer Science


COMP–354 Operating Systems
Practice Exercise Set 2
1 Objectives
• You will familiarize yourself with the major OS components and con-
cepts that we studied the first couple of weeks of classes

• You will familiarize yourself with process and thread concepts

• You will gain experience in deriving Gantt charts for various CPU
scheduling algorithms

2 Exercises Description
1. What is an operating system? Is there a clear precise definition?

2. What are the benefits of the dual-mode of operation?

3. Describe the differences between symmetric and asymmetric multi-


processing. What are the three advantages and one disadvantage of
multiprocessor systems?

4. Briefly describe the layered and microkernel structures.

5. Give two reasons why caches are useful. What problems do they solve?
What problems do they cause?

6. What is the purpose of interrupts? What are the differences between


a trap and an interrupt? Can traps be generated intentionally by a
user program? If so, for what purpose?
COMP–354 Operating Systems Exercise Set 2 2

7. What is the purpose of the command interpreter? How would you


develop a new command interpreter?
8. Do you think a web browser should be an integral part of the operating
system? Support your answer with proper justification.
9. Describe the actions taken by a kernel to context-switch between pro-
cesses.
10. Draw the diagram of process states and explain all the transitions from
state to state.
11. Describe how the fork() and exec() system calls are used to create a
separate duplicate process (If you are going to provide code, then you
have to explain it as well). How are the fork() and exec() system calls
used to create threads?
12. Given two matrices A and B, where A is a matrix with M rows and K
columns and matrix B contains K rows and N columns. The matrix
product of A and B is matrix C, where C contains M rows and N
columns. The entry in matrix C for row i column j is C(i,j) and is
the sum of products of the elements for row i in matrix A and column
j in matrix B. How would you use threads to efficiently calculate each
element C(i,j)?
13. Consider Table 1 that illustrates a set of processes, with the length of
the CPU burst given in milliseconds. The processes are assumed to
arrive in the order P1 , P2 , P3 , P4 , P5 all at time 0.

Table 1: Processes Burst times and priorities

Process Burst Time Priority


P1 10 3
P2 1 1
P3 2 3
P4 1 4
P5 5 2

(a) Draw four Gantt charts that illustrate the execution of these
processes using the following scheduling algorithms: FCFS, SJF,
COMP–354 Operating Systems Exercise Set 2 3

nonpreemptive priority (a smaller priority number implies a higher


priority), and RR (quantum = 1);
(b) What is the turnaround time of each process for each of the
scheduling algorithms in part a?
(c) What is the waiting time for each process for each of the schedul-
ing algorithms in part a?
(d) Which of the algorithms in part a results in the minimum average
waiting time (over all processes)?

14. Consider Table 2 that illustrates a set of processes, with the length of
the CPU burst and arrival times given in milliseconds.

Table 2: Processes Burst times, priorities and arrival times

Process Burst Time Priority Arrival Time


P1 10 3 0
P2 1 1 2
P3 2 3 5
P4 1 4 6
P5 5 2 8

(a) Draw four Gantt charts that illustrate the execution of these pro-
cesses using the following scheduling algorithms: FCFS, preemp-
tive SJF, preemptive priority (a smaller priority number implies
a higher priority), and RR (quantum = 1);
(b) What is the turnaround time of each process for each of the
scheduling algorithms in part a?
(c) What is the waiting time for each process for each of the schedul-
ing algorithms in part a?
(d) Which of the algorithms in part a results in the minimum average
waiting time (over all processes)?

You might also like