운영체제(공룡그려진) 연습문제 풀이 7장~12장 입니다.
- 최초 등록일
- 2008.12.10
- 최종 저작일
- 2008.06
- 36페이지/ 한컴오피스
- 가격 2,000원
소개글
운영체제(공룡그려진) 연습문제 풀이 7장~12장 입니다.
목차
7.1 What is the meaning of the term busy waiting? What othter kinds of waiting are there
7.2 Explain why spinlocks are not appropriate for uniprocessor systems yet may be suitable for
7.3 Prove that, in the bakery algorithm (Setion 7.2.2), the following property holds :
7.4 The first known correct software solution to the critical-section problem for two processes
중략..
본문내용
7.1 What is the meaning of the term busy waiting? What othter kinds of waiting are there
in an operating system? Can busy waiting be avoided altogether? Explain your answer.
☞ 한 프로세스가 임계영역에 있으면 이 임계영역에 진입하려는 프로세스는 진입코드(entry code)에서 반복해야한다. 이것을 busy waiting이라 한다. 이것은 하나의 CPU가 여러 프로세스들에게 공유되는 다중 프로그래밍에서 문제가 된다.
☞ Busy waiting을 제거하기 위해서는 세마포어를 수정하여 해결할 수 있다. wait연산을 수정하였을 때 세마포어 값이 양수가 아니면 스스로 블록되도록 한다. 여기서 블록된 연산은 대기 큐로 이동되고 프로세스의 상태를 대기상태로 바꾼다. 그다음 제어는 CPU스케줄러에게 넘어가 다른 프로세스를 실행한다. 대기 또는 중지된 프로세스는 다른 프로세스의 signal 연산에 의해 재시작 될 수 있으며 재 시작 되려는 경우는 프로세스는 준비큐로 이동되어 준비상태가 된다.
7.2 Explain why spinlocks are not appropriate for uniprocessor systems yet may be suitable for
multiprocessor systems.
☞ busy waiting을 하는 세마포어를 spinlock 이라한다. spinlock은 문맥 전환이 필요없어 오래 동안 busy waiting을 하지 않는다면 효과적인 방법이 될 수 있다.
7.3 Prove that, in the bakery algorithm (Setion 7.2.2), the following property holds :
If Pi is in its critical section and Pk (k≠i) has already chosen its number[k≠i] has already
chosen its number[k]≠0, then (number[i], I) < (number[k], k).
☞ 빵집 알고리즘(프로세스 Pi의 구조)
while(1)
{
....
choosing[i] = true;
number[i] = max(number[0], number[1], ...., number[n-1]) + 1;
choosing[i] = false;
for (j=0; j < n; j++)
{
while (choosing[j]);
while (number[j]&&(number[j], j) < (number[i], i));
}
//Critical Section
...
number[j] = 0;
...
}
참고 자료
없음