090-Computational System复习 (二) Operating System练习测试

 

 

 

 

QUESTION 1

P1,P2,P3,P4,P5
0,5,7,10,14
10,7,2,10,5

a.
画图分析

 

 

0,10,17,19,29,34
average waiting time =
(0+(10-5)+(17-7)+(19-10)+(29-14)/5=

(0+5+10+9+15)/5=7.8ms

 

average turnaround time =
((0+10)+(5+7)+(10+2)+(9+10)+(15+5))/5=

(10+12+12+19+20)/5=14.6ms

 

 

 

 


b. non-preemptive

P1,P2,P3,P4,P5
0,5,7,10,14
10,7,2,10,5

 

The timeline is

      P1          P3         P2          P5        P4
0________10______12________19_____24_______34


so
average waiting time =
(0+(12-5)+(10-7)+(24-10)+(19-14))/5=

(0+7+3+14+5)/5=5.8ms

average turnaround time =
((0+10)+(7+7)+(3+2)+(14+10)+(5+5))/5=

(10+14+5+24+10)/5=12.6ms

 

 


c.preemptive
The timeline is


     P1      P3     P1           P2           P5           P4
0_______7____9_____12__________19______24_________34

So
average waiting time =
(2+(12-5)+0+(24-10)+(19-14))/5=
(2+7+0+14+5)/5=5.6ms

average turnaround time =
((2+10)+(7+7)+(0+2)+(14+10)+(5+5))/5=
(12+14+2+24+10)/5=12.4ms

 

 

 

 

d.priority

P1,P2,P3,P4,P5
0,5,7,10,14
10,7,2,10,5
The timeline is

      P1        P2       P3      P5     P1         P4
0_______5_______12___14_____19____24_______34


So
average waiting time =
((19-5)+(5-5)+(12-7)+(24-10)+(14-14))/5=
(14+0+5+14+0)/5=6.6ms

average turnaround time =
((14+10)+(0+7)+(5+2)+(14+10)+(0+5))/5=
(24+7+7+24+5)/5=13.4ms

 

 

 

 


e. Round Robin

Arrival time 0,5,7,10,14

Burst time 10,7,2,10,5

The timeline is

  P1   P1    P2     P3      P1     P4     P2       P5     P4      P5     P4

0___4___8____12____14___16____20____23____27____31___32____34

So
average waiting time =

((4+2)+(8-5+20-12)+(12-7)+(16-10+27-20+32-31)+(23-14+31-27))/5=

(6+11+5+14+13)/5=9.8ms

average turnaround time =

((6+10)+(11+7)+(5+2)+(14+10)+(13+5))/5=

(16+18+7+24+18)/5=16.6ms
 

 

 

 

 

 

QUESTION 2

The frame size is 4

00011 = 3   %4 =0...3
10000 = 16 %4 =4...0
00110 = 6   %4 =1...2
01100 = 12 %4 = 3...0
00001 = 1   %4 = 0...1
00110 = 6   %4 =1...2

according to page table
0---3*4+3=15    P
4---0*4+0=0    A
1---1*4+2=6    G
3---2*4+0=8    I
0---3*4+1=13    N
1---1*4+2=6    G

 

 

 

 

QUESTION 2  

Solution 2 另一种解法

The page size is 4.

00011 =  000,11    =0,3
10000 = 100,00    =4,0
00110 =  001,10    =1,2
01100 = 011,00    =3,0
00001 = 000,01    =0,1
00110 = 001,10    =1,2

according to page table
0---3---011,11    15    P
4---0---000,00    0    A
1---1---001,10    6    G
3---2---010,00    8    I
0---3---011,01    13    N
1---1---001,10    6    G

 

 

 

 

 

QUESTION 3
file system

root,group,all users
auth.log    -rw-r-----
installer    drwxr-xr-x
gdm3    drwx--x--x
sssd    drwxr-x---


a.
look at the first character of the permissions
- indicates a regular file, d indicates a directory

b.
r
the user 'syslog' or any user in the group 'adm'

c.
w
the user 'syslog'

d.
r and x
everyone

e.
r and x
only root

f.
w and x
user 'sssd' and group 'sssd'

 

 

 

 

 

 


a.
look at the first character of the permissions
'-' indicates a regular file
'd' indicates a directory

b.
check the r permission: granted in the first and second triads
so user 'syslog' and user in group 'adm' can read

c.
check the w permission: granted in the first triad
so user 'syslog' can modify the file

d.
check the r and x permissions: granted first,second and third triads
so everyone can list the contents

e.
check the r and x permissions: granted only first triad
so only user 'root' can list the contents

f.
check the r and x permissions: granted first and second triads
so user 'sssd' and users in group 'sssd' have the permissions
but still need to check the permissions on the file itself

g.
check the w and x permissions: granted first and second triads
so user 'sssd' and users in group 'sssd' have the permissions

 

 

 

 


 

 

 

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值