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

Tutorial 1 OS 2025

This document is a tutorial sheet focused on process management in operating systems, containing exercises related to race conditions, critical sections, semaphores, scheduling algorithms, and deadlock. It includes various questions and problems that require explanations, examples, and Gantt charts for different scheduling methods. The exercises aim to deepen understanding of key concepts in operating systems for students in HND 1/SWE, CWD, NWS courses.

Uploaded by

Roland Ndzo
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)
15 views3 pages

Tutorial 1 OS 2025

This document is a tutorial sheet focused on process management in operating systems, containing exercises related to race conditions, critical sections, semaphores, scheduling algorithms, and deadlock. It includes various questions and problems that require explanations, examples, and Gantt charts for different scheduling methods. The exercises aim to deepen understanding of key concepts in operating systems for students in HND 1/SWE, CWD, NWS courses.

Uploaded by

Roland Ndzo
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

OPERATING SYSTEM

HND 1/SWE, CWD, NWS


TUTORIAL SHEET 1: PROCESSING MANAGEMENT

Exercise 1 :
1. What is a race condition? Give an example.
2. What is a critical region? How are they relate to controlling access to shared resources?
3. What are the three requirements of any solution to the critical sections problem? Why are the
requirements needed?
4. Why is turn passing a poor solution to the critical sections problem?
5. What is the producer consumer problem? Give an example of its occurrence in operating systems.
6. A semaphore is a blocking synchronization primitive. Describe how they work with the
aid of pseudo-code. You can assume the existence of a thread_block() and a thread_wakeup()
function.
7. Interrupt disabling and enabling is a common approach to implementing mutual exclusion, what
are its advantages and disadvantages?
8. Locks prevent the OS scheduler from performing a context switch during a critical section.
9. Peterson’s algorithm uses the atomic fetch-and-add instruction to provide mutual exclusion for
two threads.
10. A lock implementation should block instead of spin if it will always be used only on a
uniprocessor.
11. What is a test-and-set instruction? How can it be used to implement mutual exclusion? Consider
using a fragment of psuedo-assembly language aid you explanation.
enter_region:
tsl register, lock
cmp register, #0
b enter_region ; if non-zero the lock was set, so loop!
b critical_region ; else, the lock was 0, so get in there
leave_region:
mov lock, #0 ; store a 0 in the lock
b caller
12. What are monitors and condition variables?
13. Describe how to implement a lock using semaphores
14. Explain semaphores and write a short note on it.
15. Explain de producer consumer problem and how you can solve the problem using semaphore.
16. Explain the dinner philosopher and how you can solve the problem using semaphore.
17. Using a simple system call as an example (e.g. getpid, or uptime), describe what is generally
involved in providing the result, from the point of calling the function in the C library to the
point where that function returns.
18. With producer/consumer relationships and a finite-sized circular shared buffer, producing threads
must wait until there is an empty element of the buffer.
19. What is the difference between Job and Process?
20. What is the relationship between threads and processes?
21. What is a process? What are attributes of a process?
22. What is the function of the ready queue?

INSTRUCTOR : TSEKANE ADI Page 1


23. Describe the three state process model, describe what transitions are valid between the three
states, and describe an event that might cause such a transition.
24. What are the different principles which must be considered while selection of a scheduling
algorithm?
25. What is a process scheduler? State the characteristics of a good process scheduler?
26. What are the differences between Real Time System and Timesharing System?
27. What is deadlock? What is startvation? How do they differ from each other?
28. What are the four condtions required for deadlock to occur?
29. Describe the general strategy behind deadlock prevention, and give an example of a practical
deadlock prevention method.
30. Describe round robin scheduling. What is the parameter associated with the scheduler? What is
the issue in chosing the parameter?
31. What is the difference between preemptive scheduling and non-preemptive scheduling?
32. Describe a sequence the sequence of step that occur when a timer interrupt occurs that eventually
results in a context switch to another application.
Exercise 2 :
1. A CPU scheduling algorithm determines an order for the execution of its scheduled processes.
Given 'n' processes to be scheduled on one processor, how many possible different schedules are
there? Give a formula in terms of 'n'.
2. CPU utilization is given by: Utilization = 1 – pn (%), Where p = fraction of time spent by each
process waiting for input/output, and 'n' is the number of processes in the memory. How
many processes must be in the memory to guarantee that CPU time waste is less than 5%, given
that each process waste 90% of time waiting for I/O.
Exercise 3 :
Problem 1:
Shown below is the workload for 5 jobs arriving at time zero in the order given below.
Job Burst Time

1 10

2 29

3 3

4 7

5 12

1. What is an Algorithm scheduler?


2. Draw the ghant chart FCFS, SJF and RR with the quantum 10.
3. Calculate the average waiting time of each of the above algorithm.
4. Which one would give the minimum average time for the given workload?

INSTRUCTOR : TSEKANE ADI Page 2


Problem 2:
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
The processes are assumed to have arrived in the order P1, P2, P3, P4, P5, all at time 0.
1. Draw four Gantt charts illustrating the execution of these processes using FCFS, SJF, and RR
(quantum = 4) and Priority Scheduling.
2. What is the turnaround time of each process for each of the scheduling algorithms? Provide the
final answer in a table form.
3. What is the waiting time of each process for each of the scheduling algorithms? Provide the final
answer in a table form.
4. Give one advantage of using each of the above scheduling algorithm. Which of the schedules is
the most efficient? Why?
5. After establishing a clear difference between pre-emptive and non-pre-emptive scheduling,
categorize scheduling algorithm with respect to that.

Problem 3:
Given 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 is made.

Process Arrival Time Burst Time


P1 1 8
P2 3 4
P3 6 3

1. Draw Gantt chart for these processes with the First Come First Served (FCFS) and Shortest
Job First (SJF) scheduling algorithms.
2. Calculate the average waiting time for each of the above algorithms.
3. Which one is more efficient than the other one?

INSTRUCTOR : TSEKANE ADI Page 3

You might also like