0% found this document useful (0 votes)
33 views5 pages

EEE 3132 Assignment 5

Uploaded by

Joseph Zulu
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)
33 views5 pages

EEE 3132 Assignment 5

Uploaded by

Joseph Zulu
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/ 5

THE UNIVERSITY OF ZAMBIA

COMPUTER ENGINEERING - EEE 3132

Assignment 5

Due Date: 23.10.2024 08:00 hrs

Total Marks: 50

Instructions:

1. Answer all questions completely and concisely.


2. Support your answers with relevant examples, and diagrams where applicable.
3. Cite any external sources used in your answers.
4. Adhere to academic writing standards in terms of grammar, punctuation, and
formatting.
5. Submit your assignment in a clear and organized manner.
Questions [ 1-10] 1 Mark each

1 Give an example of a real-time database application. Is it a hard or a soft real-time system?


Give your arguments.
2 The car engine management system (EMS) is a real-time embedded system. Read related
online materials, and find out major hardware components of the system and how they interact
with each other to ensure the best engine performance.
3 Give an example of real-time embedded systems in which an earlier response than expected
is as bad as a late response.
4 Give an example of a real-time embedded system that has both hard and soft real-time
constraints.
5 What is the kernel of an operating system? In which mode does it run?
6 What are the two approaches that a user process interacts with the operating system?
Discuss the merits of each approach.
7 What is a context switch and when does it occur?
8 Why can a general-purpose OS not meet the requirements of real-time systems?
9 How does memory fragmentation form? Name one approach to control it.
10 What are the basic functions of an RTOS kernel?
11 Consider the following set of processes, with the length of the CPU-burst time given in
milliseconds:
Process burst Time Priority
P1 10 3
P2 1 1
P3 2 3
P4 1 4
P5 5 2

For each of the scheduling algorithms, FCFS, Shortest-Job-First (SJF, non preemptive),
Priority (smaller priority number implies higher scheduling priority), and RR (quantum =
1) do the following.

a. Draw a Gantt chart to show how these processes would be scheduled (4 marks)
b. Give the turnaround time (total time from first arrival into the ready state until
CPU-burst is completed) of each process. (2 marks)
c. Give the waiting time (total time spent in the Ready state) of each process. (2
marks)
d. Give the average waiting time of all the processes. (2 marks)

Which of these scheduling algorithms gives the smallest average waiting time?
12 Suppose the following three processes arrive for execution at the arrival times indicated.
Process Arrival Time Burst Time
P1 0.0 8
P2 0.4 4
P3 1.0 1

a. What is the average wait time for these three processes using the FCFS
algorithm? (3 marks)
b. What is the average wait time, using the non-preemptive SJF algorithm? (1 mark)
c. What is the average wait time, using Shortest Remaining Time First (the
preemptive version of SJF)? (1 mark)

Note! You cannot schedule a process to execute before it has arrived!

13 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 non-preemptive
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? (1 mark)
b. What is the average turnaround time for these processes with the SJF
scheduling algorithm? (1 mark)
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 known as future-
knowledge scheduling. (3 marks)
14 Consider the following set of processes, with the length of the CPU burst time given in
milliseconds:

Process Burst Time Priority


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

The processes are assumed to have arrived in the order P1, P2, P3, P4, P5, all at time 0.
a. Draw four Gantt charts that illustrate the execution of these processes using
the following scheduling algorithms: FCFS, SJF, non-preemptive priority (a
larger priority number implies a higher priority), and RR (quantum = 2).
(4 marks)
b. What is the turnaround time of each process for each of the scheduling
algorithms in part a? (2 marks)
c. What is the waiting time of each process for each of these scheduling
algorithms? (2 marks)
d. Which of the algorithms results in the minimum average waiting time
(overall processes)? (2 marks)

15 The following processes are being scheduled using a preemptive, round-robin scheduling
algorithm.

Process Priority Burst Arrival


P1 40 20 0
P2 30 25 25
P3 30 25 30
P4 35 15 60
P5 5 10 100
P6 10 10 105

Each process is assigned a numerical priority, with a higher number indicating a higher relative
priority. In addition to the processes listed above, the system also has an idle task (which consumes
no CPU resources and is identified as Pidle). This task has priority 0 and is scheduled whenever
the system has no other available processes to run. The length of a time quantum is 10 units. If a
process is preempted by a higher-priority process, the preempted process is placed at the end of
the queue.
a. Show the scheduling order of the processes using a Gantt chart. (2 marks)
b. What is the turnaround time for each process? (3 marks)
c. What is the waiting time for each process? (3 marks)
d. What is the CPU utilization rate? (2 marks)

Total Marks: [50]

Submission Guidelines:

• Submit your assignment in any of the formats, handwritten, (PDF, or Word for blended
students)
• Include your name, student ID, and course code on the first page.

Good luck!

You might also like