Due day : maybe 11/6?
The problems are shown below. If you need a html version problem,
just mail to bunny@bunny.idv.tw
==
2001 Fall Operating System
Homework #2
쨊Student ID:
Name:
쨊1. Given the following piece of code:
main(int argc, char ** argv) {
int child = fork();
int c = 5;
if(child == 0)
{
c += 5;
}
else
{
child = fork();
c += 10;
if(child)
c += 5;
}
}
How many different copies of the variable c are there? What are their values?
쨊쨊Ans: (Please write your answer here)
쨊쨊2. Assume that you have the following jobs to execute with one processor:
Job Burst Time Priority
1 8 3
2 3 4
3 1 1
4 2 4
5 5 2
쨊 The jobs are assumed to arrive at time 0 in the order 1,2,3,4,5
(1)쨠Suppose that a system uses round robin scheduling with a quantum of 2
(a) Draw the Gantt chart
(b) What is the turnaround time for job 3
(c) What is the average wait time for the jobs
(2)쨠Suppose that a system uses priority scheduling, where a small integer means a high priority
(a) Draw the Gantt chart
(b) What is the turnaround time for job 2
(c) What is the average wait time for the jobs
(3)쨠Suppose that a system uses shortest-job-first scheduling
(a) Draw the Gantt chart
(b) What is the turnaround time for job 4
(c) What is the average wait time for the jobs
(4)쨠If the arrival time of job is 0,3,4,6,8 and system uses preemptive scheduling
Draw the Gantt charts of
(a) Round-Robin scheduling with quantum 2
(b)쨠Priority scheduling
(c) Shortest-Job-First scheduling
쨊Ans: (Please write your answer here)
--
在一群物理學家前樹立起高高的意象, 引領他們進入更深層運動學的世界.
在文學家的眼裡, 卻又成為縱恣幻想的小玩具, 在歷史的洪流裡開著狂妄的玩笑.
新的世紀裡, 或許也該拿傅科擺來做些什麼新的嚐試吧?
音樂 資訊 娛樂
曾小兔主題遊樂園 http://www.bunny.idv.tw/
--
※ 發信站: 批踢踢實業坊(ptt.csie.ntu.edu.tw)
◆ From: ptt.twbbs.tw