Question
using cpu simulator , compile this multithread server program program ServerTest var p integer sub ServiceThread as thread writeln(Started service) for i = 1 to
using cpu simulator , compile this multithread server program
program ServerTest
var p integer
sub ServiceThread as thread
writeln("Started service")
for i = 1 to 30
next
writeln("Finished service")
end sub
sub ServerThread as thread
while true
read(nowait, p)
select p
case '1'
call ServiceThread
case 'q'
break
case else end select
wend
end sub
call ServerThread
wait
end
in the console I got this output
Now, modify the above code by removing the as thread construct from the subroutine ServiceThread.
g. Compile the above source, load the generated code in memory and run it.
h. On the console window type 1 four times one after the other and observe the displays on the console.
after modification I got why they differ? after modification
- Console OUTPUT 1started service 1started service 11started service Finished service Finished service Finished service INPUT Fonts 1 SHOW KEYBD... Stay on top No output display Display CPU id Colours Screen colour Text colour SET... SET... PRINT... CLEAR CLOSE Console OUTPUT e 1 started service st Finished service I started service Finished service 1started service Finished service 1started service Finished service Fonts INPUT 1 SHOW KEYBD... Stay on top No output display Display CPU id Colours Screen colour Text colour SET... SET... PRINT... CLEAR CLOSEStep by Step Solution
There are 3 Steps involved in it
Step: 1
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