Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Hadje-Ghaffari
ID:
69213134
1. So
for
example,
using
C++
you
can
assign
a
variable.
The
CPU
will
take
the
data
and
move
it
between
registers
and
Main
Memory.
Also
when
you
declare
a
new
variable
using
the
new
command,
you
dont
care
about
the
page
the
variable
is
allocated
or
if
there
is
enough
space
on
the
RAM
for
your
object.
For
Secondary
Storage
such
as
writing
to
a
text
file,
the
application
does
not
need
to
worry
about
having
enough
space
for
block
allocation
to
the
file
or
to
see
if
the
operating
system
needs
to
allocate
another
block
to
the
file.
Finally,
for
I/O
devices
say
you
want
to
run
a
simple
C++
application
that
prints
out
I
am
awesome.
The
C++
application
does
not
care
if
the
system
is
using
polling
or
interrupts,
DMA.
2. Abstraction
and
virtualization
are
both
trying
to
make
everything
simpler.
In
other
words,
they
are
trying
to
hide
details
of
the
CPU.
The
difference
is
that
Abstraction
hides
complexity
while
virtualization
supports
sharing.
Virtual
memory
is
an
example
of
virtualization
and
an
example
of
abstraction
would
be
the
Edsger
W.
Dijkstra.
3. A
(disable
all
interrupts),
C
(set
the
time-of-day
clock),
D
(change
the
memory
map).
4. If
the
system
has
two
CPUs
and
each
CPU
has
two
threads
then
that
means
up
to
two
programs
can
run
at
the
same
time
and
each
CPU
can
work
on
two
programs.
Also,
if
the
CPU
is
working
on
two
programs,
the
time
spent
working
on
the
programs
is
shared.
So
it
could
be
20,
25
or
30
milliseconds.
It
just
depends
how
the
operating
system
makes
assignments.
5. The
main
goal
of
a
system
call
is
to
give
the
control
to
the
operating
system.
In
other
words,
its
a
programing
interface
provided
by
the
operating
system.
6. So
we
can
imagine
how
a
program
can
go
from
being
blocked
to
running.
For
example,
imaging
if
a
process
is
blocked
on
I/O
and
the
I/O
finished
what
it
was
doing.
If
the
CPU
is
available
at
that
time,
the
process
could
go
directly
from
being
blocked
to
running.
The
other
transition
that
is
not
displayed
in
the
figure
cannot
be
done.
Transition
from
ready
to
block
cannot
be
done
because
a
ready
process
cannot
do
anything
like
I/O
that
might
block
the
process.
In
other
words,
only
a
process
that
is
running
can
be
blocked.
7. There
are
certain
actions
that
can
take
place
while
interrupt
handler
is
running.
Some
of
these
actions
such
as
saving
registers
must
be
written
in
assembly
because
they
cannot
be
written
in
higher-level
languages
such
as
C++.
8.
So
basically
the
problem
is
split
like
this,
1/3
Disk:
75
msec
(blocked)
and
2/3
Cache:
15
msec
(running).
For
a
single
thread
for
one
cycle
you
would
have
2
requests
and
one
disk
wait
so
the
cache
hits
would
take
15
msec
and
the
misses
would
take
90
msec.
So,
(2/3
*
15)
+
(1/3
*
90)
would
be
40
msec.
The
server
can
handle
25(1000/40)
requests
per
second
(single
thread).
For
a
server
that
uses
multiple
threads
the
requests
and
waiting
for
the
disk
can
run
at
the
same
time.
So,
each
request
would
take
15
msec,
which
means
the
server
can
handle
66.66(1000/15)
requests
per
second
(multiple
threads).
9.
Cobegin{
W=X1
*
X2;
V
=
X3
*
X4;
Cobegin{
Y
=
V
*
X5;
Z
=
V
*
X6;
}
Coend
}
Coend
Cobegin{
Y
=
W
*
Y;
Z
=
W
*
Z;
}
Coend
A
=
Y
+
Z;