Question: Consider the following source code: program ThreadTest total = 0 sub thread1 as thread for i = 1 to 3 total = total + i
Consider the following source code:
program ThreadTest
total = 0
sub thread1 as thread
for i = 1 to 3
total = total + i * 35
next
end sub
sub thread2 as thread
for i = 3 to 5
call thread1
total = total + i + 10
next
end sub
call thread2
wait
writeln (Total =, total)
end
Compile the above source code using CPU OS Simulator and load it in the main memory. Create a single process, choose RR scheduling algorithm with time quantum of 3 ticks. Run the Process.
Answer the following questions:
- What is the value of Total ?
- How many processes and how many threads are created?
- Identify the name of the processes and threads.
- What is the PID and PPID of the processes and threads created?
- Represent the parent and child relationship using tree representation
Note: Above source code should be executed using cpu os simulator only.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
