0% found this document useful (0 votes)
26 views3 pages

2021 1 OS43 중간시험문제 1

This document contains a multiple choice intermediate exam for an operating systems course. It includes 5 questions: [1] Filling in blanks with operating system concepts, [2] Explaining the number of processes created from sample code, [3] Calculating scheduling details like completion times and waiting times for processes in a multi-level feedback queue, [4] Analyzing semaphore code for the dining philosophers problem, and [5] Determining if a resource allocation scenario is in a safe or unsafe state using the Habermann algorithm for deadlock avoidance. The document tests students' understanding of key operating systems concepts.

Uploaded by

nhjbest22
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views3 pages

2021 1 OS43 중간시험문제 1

This document contains a multiple choice intermediate exam for an operating systems course. It includes 5 questions: [1] Filling in blanks with operating system concepts, [2] Explaining the number of processes created from sample code, [3] Calculating scheduling details like completion times and waiting times for processes in a multi-level feedback queue, [4] Analyzing semaphore code for the dining philosophers problem, and [5] Determining if a resource allocation scenario is in a safe or unsafe state using the Habermann algorithm for deadlock avoidance. The document tests students' understanding of key operating systems concepts.

Uploaded by

nhjbest22
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

1/3

운영체제 중간시험 (2021학년도 1학기, 2021/04/15)

☆ 답안지의 각 페이지 상단에 본인 소속 학과명, 학번, 이름을 기재하세요.

⑴ 다음 괄호에 들어갈 용어를 아래 box에서 찾아 채우시오.

- A/An (① ) is the programmatic way in which a computer program requests a service from
the kernel of the operating system it is executed on. They provide an essential interface between a
process and the operating system.
- When a device completes its operation, the device controller informs the device driver that it has
finished its operation. This is accomplished via a/an (② ).
- The hardware allows (③ ) instructions to be executed only in kernel mode. If an attempt is made to
execute a/an (③ ) instruction in user mode, the hardware does not execute the instruction, but rather
treats the instruction as illegal and traps it to the operating system.
- A/An (④ ) loads an operating system into memory, performs initialization, and begins
system execution.
- A process is said to be in (⑤ ) state, when it is waiting to be assigned to a processor with
all the resources it needs for execution.
- An important performance measure of interactive system is the time from the submission of a
request until the first response is produced. This measure is called a/an (⑥ ).
- In a multiprogramming or multitasking system, each process can have a segment of code, called
a/an (⑦ ), in which the process may be accessing or updating data that is shared with at
least one other process.
- Linux provides two simple system calls, preempt_disable() and preempt_enable(), for disabling and
enabling (⑧ ) preemption.
- Multiple processes are permitted to concurrently acquire a/an (⑨ ) lock in read-mode, but only one
process may acquire the lock for writing, as exclusive access is required for writers.
- Deadlock can be avoided by using the Dijkstra’s or Habermann’s algorithm, which does not grant
resources if doing so would lead the system into a/an (⑩ ) state.

[용어 box]

exception asleep privileged aging deadlock


interrupt mutual exclusion preemptive priority inversion reader-writer
ready critical section circular wait run queue response time
safe unsafe multiprogramming kernel boot loader
race condition processor affinity ticket system call turnaround time

[답]

① ② ③ ④ ⑤

⑥ ⑦ ⑧ ⑨ ⑩
2/3

⑵ Unix/Linux 환경에서 아래 program code가 실행되는 경우 이에 의해 새롭게 생성되는 process들은 모두


몇 개인가 보이고, 그 이유를 설명하시오.

[답]

⑶ 3개의 ready queue Q0, Q1, Q2를 가지고 아래 규칙에 따라 운영되는 MFQ(Multi-level Feedback Queue)
스케줄링 기법을 가정한다.

❚ Q0의 우선순위가 가장 높으며, Q2의 우선순위가 가장 낮다.


❚ 모든 process들은 처음 ready queue에 도착할 때 Q0으로 진입한다.
❚ Q0은 time quantum 2를 갖는 RR(Round-Robin) 스케줄링 기법을, Q1은 time quantum 4를 갖는 RR 스
케줄링 기법을, Q2는 FCFS(First-Come-First-Service) 스케줄링 기법을 사용한다.
❚ Qi에서 스케줄링 받고 실행하던 process가 자신의 time quantum을 모두 사용하고 선점되는(preempted)
경우 이 process는 Qi+1로 진입한다(0 ≤ i ≤ 1).

이 스케줄링 기법으로 오른쪽 표에서 보인 속성을 갖는 4개


Process Arrival time Burst time
의 process P1, P2, P3, P4를 time 0부터 스케줄링하면서 실
P1 0 7
행시켰을 때를 가정하고 주어진 CPU burst에 대해서 아래 물
P2 1 4
음에 답하시오. (단, 이들 4개의 process들은 I/O 없이 CPU만
P3 5 5
을 사용한다고 가정하며, context switching에 소요되는 시간
P4 11 10
은 무시한다)

① Process P1, P2, P3, P4가 CPU burst를 종료하는 시점은 각각 언제인가?
② Process P1, P2, P3, P4의 waiting time은 각각 얼마인가?
③ 이들 4개 process의 평균 turnaround time은 얼마인가?

Process ① 종료 시점 ② Waiting time ③ 평균 turnaround time

P1

P2

P3

P4
3/3

⑷ Dining philosopher 문제를 semaphore로 해결한 다음 두 가지 code를 분석해보고 아래 물음에 답하시오.

① 코드-1에 어떤 문제점이 있는지 보이고, 그러한 문제점이 어떤 상황에서 발생하는지 설명하시오.

② 코드-1의 문제점을 보완하기 위하여 코드-2가 제시되었다. 코드-2에서 코드-1의 문제점을 어떻게
해결하였는지 설명하시오.

③ 코드-2에서 또 다른 문제점이 발생하는지를 분석하고 어떤 문제점이 있는지 설명하시오.

⑸ 5개의 process P1, P2, P3, P4, P5와 3종류의 resource type A(4 units), B(10 units), C(10 units)가 존재하는
시스템을 가정하자. Deadlock avoidance 기법(Habermann algorithm)을 적용한다고 가정하고, 각 process의
Max Claim과 Current Allocation이 아래와 같을 때, 이 상태가 safe인지 unsafe인지 보이시오. Safe인 경우
safe sequence를 보이고, unsafe인 경우 그 이유를 명확하게 설명하시오.

P1: Max claim = (0, 1, 2); Current allocation = (0, 0, 1)


P2: Max claim = (1, 10, 5); Current allocation = (1, 1, 0)
P3: Max claim = (2, 4, 5); Current allocation = (1, 2, 4)
P4: Max claim = (0, 6, 5); Current allocation = (0, 4, 1)
P5: Max claim = (2, 7, 5); Current allocation = (1, 2, 3)
(답)

끝. 수고했습니다.

You might also like