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

Homework#1 2

The document outlines homework guidelines for the CS323 - Operating System course at Taibah University, including submission details and penalties for late work. It presents various problems related to CPU scheduling, deadlocks, virtual memory, and mass-storage structure that students must solve using specified algorithms. The deadline for submission is set for December 1, 2024, and emphasizes the importance of originality in work to avoid plagiarism.

Uploaded by

amat
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)
5 views3 pages

Homework#1 2

The document outlines homework guidelines for the CS323 - Operating System course at Taibah University, including submission details and penalties for late work. It presents various problems related to CPU scheduling, deadlocks, virtual memory, and mass-storage structure that students must solve using specified algorithms. The deadline for submission is set for December 1, 2024, and emphasizes the importance of originality in work to avoid plagiarism.

Uploaded by

amat
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

|1 Taibah University

Page
College of Computer Science and Engineering
Department of Computer Science

1st Semester (2024-2025)


CS323 – Operating System
TOTAL MARKS = 10
Homework Guidelines
1. Deadline: Sunday 01 December 2024.
2. This task is single Work not a group work
3. Remember that plagiarism will not be tolerated, and a zero mark will be given. Each report will
be examined through plagiarism detection systems.
4. Submission of the report will be an MS Word file containing the course name (Operating System:
CS323), the names and IDs of team members, and the Section on the cover page.
5. Late submission will receive 10% penalty per day.

Solve the following problems:


1- CPU Scheduling
2-1- Suppose that the following processes arrive for execution at the times indicated. Each process will run for the
amount of time listed. In answering the questions, use nonpreemptive scheduling, and base all decisions on the
information you have at the time the decision must be made.

Process Arrival Time Burst Time

P1 0.0 8

P2 0.4 4

P3 1.0 1

a. What is the average turnaround time for these processes with the FCFS scheduling algorithm‫؟‬

b. What is the average turnaround time for these processes with the SJF scheduling algorithm‫؟‬

c. The SJF algorithm is supposed to improve performance, but notice that we chose to run process P1 at time 0
because we did not know that two shorter processes would arrive soon. Compute what the average turnaround time
will be if the CPU is left idle for the first 1 unit and then SJF scheduling is used. Remember that processes P1 and P2
are waiting during this idle time, so their waiting time may increase. This algorithm could be called future-knowledge
scheduling.

2-2- What advantage is there in having different time-quantum sizes at different levels of a multilevel queueing
system‫؟‬

2-3- Many CPU-scheduling algorithms are parameterized. For example, the RR algorithm requires a parameter to
indicate the time slice. Multilevel feedback queues require parameters to define the number of queues, the
1
scheduling algorithm for each queue, the criteria used to move processes between queues, and so on. These
algorithms are thus really sets of algorithms (for example, the set of RR algorithms for all time slices, and so on). One
set of algorithms may include another (for example, the FCFS algorithm is the RR algorithm with an infinite time
quantum). What (if any) relation holds between the following pairs of algorithm sets‫؟‬

a. Priority and SJF

b. Multilevel feedback queues and FCFS

c. Priority and FCFS

d. RR and SJF

2- Deadlocks
2-1- Consider the following snapshot of a system:

Allocation Max Available

ABCD ABCD ABCD

P0 0012 0012 1520

P1 1000 1750

P2 1354 2356

P3 0632 0652

P4 0014 0656

Answer the following questions using the banker’s algorithm:

a. What is the content of the matrix Need‫؟‬

b. Is the system in a safe state‫؟‬

c. If a request from process P1 arrives for (0,4,2,0), can the request be granted immediately?

2-2- Consider the following snapshot of a system:

Allocation Max

ABCD ABCD

P0 3014 5117

P1 2210 3211

P2 3121 3321

P3 0510 4612

P4 4212 6325

Using the banker’s algorithm, determine whether or not each of the following states is unsafe. If the state is safe,
illustrate the order in which the processes may complete. Otherwise, illustrate why the state is unsafe.

a. Available(1 ،0 ،3 ،0) =

b. Available = (1, 0, 0, 2)

2
2-3- Consider the following snapshot of a system:

Allocation Max Available


ABCD ABCD ABCD
P0 2001 4212 3321
P1 3121 5252
P2 2103 2316
P3 1312 1424
P4 1432 3665
Answer the following questions using the banker’s algorithm:

a. Illustrate that the system is in a safe state by demonstrating an order in which the processes may
complete.

b. If a request from process P1 arrives for (1, 1, 0, 0), can the request be granted immediately‫؟‬

c. If a request from process P4 arrives for (0, 0, 2, 0), can the request be granted immediately?

3- Virtual Memory
3-1- Consider the following page reference string:

1.6 ،3 ،2 ،1 ،2 ،3 ،6 ،7 ،3 ،2 ،1 ،2 ،6 ،5 ،1 ،2 ،4 ،3 ،2 ،

How many page faults would occur for the following replacement algorithms, assuming one, two, three, four, five,
six, and seven frames‫ ؟‬Remember that all frames are initially empty, so your first unique pages will cost one fault
each.

•LRU replacement

•FIFO replacement

• Optimal replacement

4- Mass-Storage Structure
4-1- Suppose that a disk drive has 5,000 cylinders, numbered 0 to 4,999. The drive is currently serving a request at
cylinder 2,150, and the previous request was at cylinder 1,805. The queue of pending requests, in FIFO order, is:

2,069, 1,212, 2,296, 2,800, 544, 1,618, 356, 1,523, 4,965, 3681

Starting from the current head position, what is the total distance (in cylinders) that the disk arm moves to satisfy all
the pending requests for each of the following disk-scheduling algorithms‫؟‬

a. FCFS

b. SSTF

c. SCAN

d. LOOK

e. C-SCAN

f. C-LOOK

You might also like