0% found this document useful (0 votes)
4 views

ICT1007-Part1-Tutorial2(Question)

The document contains a tutorial with questions related to operating system concepts, including context-switching, process creation, CPU and I/O-bound tasks, scheduling algorithms, synchronization, and race conditions. It emphasizes the importance of understanding process management and the implications of various scheduling strategies. Additionally, it discusses potential issues like starvation and race conditions in concurrent programming scenarios.

Uploaded by

yuxun19999
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

ICT1007-Part1-Tutorial2(Question)

The document contains a tutorial with questions related to operating system concepts, including context-switching, process creation, CPU and I/O-bound tasks, scheduling algorithms, synchronization, and race conditions. It emphasizes the importance of understanding process management and the implications of various scheduling strategies. Additionally, it discusses potential issues like starvation and race conditions in concurrent programming scenarios.

Uploaded by

yuxun19999
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

ICT1007-Part1-Tutorial 2

1. Describe the actions taken by a kernel to context-switch between processes.

2. Using the program shown below, explain what the output will be at LINE A. What will the
value be if this is using pthread? Justify the answer with an explanation. You are encouraged
to code the following to verify your answer.

3. Including the initial parent process, how many processes are created by the program shown
in the following figure? Illustrate the process with a tree structure.

4. Why is it important for the scheduler to distinguish between I/O bound programs and CPU-
bound programs?
ICT1007-Part1-Tutorial 2

5. Consider a system running ten I/O-bound tasks and one CPU-bound task. Assume that the
I/O-bound tasks issue an I/O operation once for every millisecond of CPU computing and that
each I/O operation takes 10 milliseconds to complete. Also assume that the context-
switching overhead is 0.1 millisecond and that all processes are long-running tasks. Describe
the CPU utilization for a round-robin scheduler when: The time quantum is 1 millisecond,
The time quantum is 10 milliseconds

6. Explain why implementing synchronization primitives by disabling interrupts is not


appropriate in a single-processor system if the synchronization primitives are to be used in
user-level programs.

7. Consider the exponential average formula used to predict the length of the next CPU burst.
What are the implications of assigning the following values to the parameters used by the
algorithm? α = 0 and τ0 = 100 milliseconds, α = 0.99 and τ 0 = 10 milliseconds

8. Describe the differences between a process and a thread.

9. In process scheduling what is starvation? Which scheduling algorithms could result in


starvation? Justify your answer.

10. Race conditions are possible in many computer systems. Consider a banking system with
two methods: deposit(amount) and withdraw(amount). These two methods are passed the
amount that is to be deposited or withdrawn from a bank account. Assume that a husband
and wife share a bank account and that concurrently the husband calls the withdraw()
method and the wife calls deposit(). Describe how a race condition is possible and what
might be done to prevent the race condition from occurring.

You might also like