Question
Consider the following source code program ThreadTest total = 50 sub thread2 as thread for i = 7 to 9 total = total + i
Consider the following source code
program ThreadTest
total = 50
sub thread2 as thread
for i = 7 to 9
total = total + i
next
end sub
sub thread1 as thread
for i = 1 to 2
total = total + i
call thread2
next
end sub
call thread1
wait
writeln (“Total =”, total)
end
Compile the above source code and load it in the main memory. Create a single process, choose RR
scheduling algorithm with time quantum of 5 seconds with no-priority. Run the Process.
Answer the following questions:
a) What is the value of “Total” ?
b) How many processes and how many threads are created?
c) Identify the name of the processes and threads.
d) What is the PID and PPID of the processes and threads created?
e) Represent the parent and child relationship using tree representation
Step by Step Solution
3.40 Rating (156 Votes )
There are 3 Steps involved in it
Step: 1
a The value of Total after the program has finished executing is 75 b There is 1 process and 2 threads created c The name of the process is ThreadTest The names of the threads are thread1 and thread2 ...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started