ICT1007-Part1-Tutorial2(Question)
ICT1007-Part1-Tutorial2(Question)
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
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
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.