Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Part III: Multi-Threading Consider the following source code program ThreadTest total = 100 sub thread1 as thread for i = 1 to 2 total =

Part III: Multi-Threading

Consider the following source code

program ThreadTest

total = 100

sub thread1 as thread

for i = 1 to 2

total = total - i

next

end sub

sub thread2 as thread

for i = 3 to 4

total = total + i

call thread1

next

end sub

call thread2

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 3 ticks. Run the Process.

Answer the following questions:

  1. What is the value of Total?
  2. How many processes and how many threads are created?
  3. Identify the name of the processes and threads.
  4. What is the PID and PPID of the processes and threads created?
  5. Represent the parent and child relationship using tree representation.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Principles Programming And Performance

Authors: Patrick O'Neil, Elizabeth O'Neil

2nd Edition

1558605800, 978-1558605800

More Books

Students also viewed these Databases questions