Question: When multiple tasks are executed on a single - threacted cpu, the tasks are shechuled boved on the prenciple of pre emption. When a higher

When multiple tasks are executed on a single
-
threacted cpu, the tasks are
shechuled boved on the prenciple of pre emption. When a higher priority tas
There are
functions to be executed on a single
-
threaded CPU, with each function
having a unique ID between o and
-
1
,
Given an integer
representing the
numberefthetions to toe executed, and an execution log as an array of strings,
focx of size m determine the exclussive times of each of the functions. Exclusive
time is the sum of execution times for all calls to a function. Any string representing
an execution log is of the form
(
function
,
/
d
)
: rstart
/
"end
"
)
:
(
timestamp
)
,
indicating
that the function wath io f fmetion id elther starts or ends at a time identified by
the cimestamp walue.
Note: While calculating the execution time of a function call, both the starting and
ending times of the function call have to be included. The log of the form
trunction todystarde:
(
timestamp
)
means that the running function is preempted at
the beginning of timestamp second. The log of the form
(
function
_
id
)
:
(
end
)
:
frimestampl means that the function function id is preempted after completing its
execution at timestamp second i
.
e after timestamp second.
Example
Suppose
=
3
,
logs
=
[
"
0
:start:
0
"
,
"
2
:start:
4
"
,
"
2
5
"
,
"
1
:start:
7
"
,
"
1
1
0
"
,
"
O
1
1
"
]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!