Online E4-1 2013 2014

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 9

11 2013-14 ONLINE E4-1

Online 4-1 ( ..
) 4 (
31/03/2014)
4 10%. (10)
(multiple choice)
#22 #27 ,
, 1, 2, 3 4 (
- . ). -
1-3 - . . ,
site
(http://study.eap.gr/ - . #32).

( ,
, ,
..). :
1. (10) .
2. (4) .
3. , (
).
4. (1) ()
, .
,
1/ .
: ,
1/ . [
0
0].
5. ( = 0 , =
10 .
6.
4 (4) 10% ( 0.1
4).
( )
01/04/2014 13.00
14/04/2014 17.00,
.

URL: http://www.eap.gr 1

1. / / -
; [1 ]
()
, , .
() - , ,
.
()
.
()
.

2. Gantt
,,,. ; [1 ]

() FCFS
() SJF
() SRTF
() -

3. :


P1 0 12 3
P2 5 19 3
P3 8 21 5
P4 11 13 2
P5 15 15 3

:
P2 ,
21 P3,
58 5, 2 4,
/ /
; . [1 ]
() (Round Robin, RR) 8 .
. ,
, .
() (Shortest Job First, SJF).
() (Preemptive Priority)
(First Come First Served, FCFS)
.
() .

URL: http://www.eap.gr 2
4. P1, P2 P3
, a b.
: s1, s2, s3 mutex (
s1, s2 s3 - mutex ).

-1,2,-1,2,-1,2, [1 ]
: ,
a b :
a = 0; b = -0.5;
P1 P2 P3
while(true) { while(true) { while(true) {
P(s1); P(s2); P(s3);
P(mutex); P(mutex); P(mutex);
if (a ^ 2 == 4) print a + (b * 2); a = 0;
{ V(mutex); V(mutex);
V(mutex); V(?3); V(?4);
V(?1); } }
}
else
{
a = a + 1;
b = a 2;
V(mutex);
V(?2);
}
}

() s1=1, s2=0, s3=0, mutex=1, ?1=s2, ?2=s2, ?3=s3, ?4=s1


() s1=1, s2=0, s3=0, mutex=1, ?1=s3, ?2=s2, ?3=s1, ?4=s1
() s1=0, s2=1, s3=0, mutex=1, ?1=s3, ?2=s2, ?3=s1, ?4=s1
() s1=1, s2=1, s3=0, mutex=1, ?1=s3, ?2=s2, ?3=s1, ?4=s1

5. . x y,
f(x,y),
.
,
; [1 ]

() 0. , .
() 1
() 2
() 3

URL: http://www.eap.gr 3
6.
, .
( )
.
(. , .
. , 3.7.4, - ),
. [1 ]


var flagR, flagW : boolean;
flagR = flagW = false;
cobegin
READER WRITER
repeat repeat
while flagW do ; while flagR do ;
flagR := true; flagW := true;
<Read Document> <Write Document>
flagR := false; flagW := false;
until false; until false;

coend

B
var flagR, flagW : boolean;
flagR = flagW = false;
cobegin
READER WRITER
repeat repeat
flagR := true; flagW := true;
while flagW do ; while flagR do ;
<Read Document> <Write Document>
flagR := false; flagW := false;
until false; until false;

coend

() .
() .
() .
() .

4
7. 1 5.

o/ /
; [1 ]

() .
() .
() .
() V .

I. II.
var a, b, c, d, e: semaphore; P1;
a=b=c=d=e=0; cobegin
begin P2; end;
cobegin begin P3; end;
begin P1; V(a); V(b); end; coend
begin P(a); P2; V(c); end; cobegin
begin P(b); P3; V(d); V(e); end; begin P4; end;
begin P(c); P(d); P4; end; begin P5; end;
begin P(e); P5; end; coend
coend

III. IV.
var a, b, c, d: semaphore; var a: semaphore;
a=b=c=d=0; a=0:

cobegin P1;
begin P1; V(a); V(b); end; cobegin
begin P(a); P2; V(c); end; begin P2; end;
begin P(b); P3; V(d); V(d); end; begin P3; V(a); end;
begin P(c); P(d); P4; end; begin P(a); P5; end;
begin P(d); P5; end; coend
coend P4;

5
8. ()
. (
6, 7 8)
(), ;
. [1 ]

() ()

40 40

55 55

65 65

72 72

80 80

90
92 92

100 100
106

120 120

132 132
141 141

150 150

160 160

() .
() .
() .
() .

6
9. 13 bits
10
2 . ,
/ /; [1 ]

/ /

0 15010 120010
1 140010 230010
2 330010 380010
3 590010 613010

() (2, 5010) D1616.


() (4, 35010) .
() 7D016 (1, 50010).
() .

10.
223 bytes ( byte). To 32.
/ /; [1 ]
() (3607)16 (1D)16.
() (3607)16 (07)16, ,
, (76)16 (15)16.
() byte ( )
(37FFF)16 .
() .

!!!

7

Online 4-1
http://study.eap.gr 01/04/2014
13.00 14/04/2014 17.00.
( ):
1.
http://study.eap.gr 11 ( username
password 11
.
2. 11 ,
#29 (14/04/14 20/04/14).
3. , , Online
4-1 2013-2014.
4. (button) Quiz ,
, Start attempt.
5. (10) ,
.
6. ( )
. [ ( )
,
] [
, (
/
')
(scroll Return to attempt)
.]
7. ( )
, (
) .

Return to
attempt '.
, '
.

Return to attempt.

/,
..
(..
11 /).
, (
, 14/04 17.00),
[ link Online 4-1 2013-2014
#29
(In progress),
, -
...].

8
:

1. ( '),
Back to the course (button
) [. ,
,
quiz ( 14/04/2014 17.00)]
,
, quiz
( 14/04/2014 17.00) 15/04 .

.
( ) 15/04 ,
(http://study.eap.gr)
, Online 4-1 2013-2014
( #29), ( 10),
(
).
2. (1) ( )
. (
button '),
.
3. ( ,
, ...)
: ()
(
) : ()
(QUIZ) /
()
.
4. ( )
(server) (
button '), :
.
5. 14/04/2014 17.00 Online
4-1 ( quiz / ).
Online 4-1
Portal [http://study.eap.gr 11 ) 15/04 .

You might also like