[혼공컴운] 5주차_프로세스 관리

dev·2024년 1월 12일
0

혼공컴운

목록 보기
5/7
post-thumbnail

▶️ 혼공학습단 ▶️ 도서 정보 ▶️ 심화자료 ▶️ 유튜브 강의

기본 미션

p. 363 확인 문제 1번

Q. 뮤텍스 락세마포에 대한 설명으로 옳지 않은 것을 고르세요. 4️⃣

  1. 뮤텍스 락임계 구역을 잠근 뒤 임계 구역에 진입함으로써 상호 배제를 위한 동기화를 이룹니다. ✅

As shown in the figure, in the case of mutual exclusion (mutex), one thread blocks a critical section by using locking techniques when it needs to access the shared resource, and other threads have to wait to get their turn to enter into the section.

  1. 세마포는 공유 자원이 여러 개 있는 상황에서도 이용할 수 있습니다. ✅

Semaphores are typically used to coordinate access to resources, with the semaphore count initialized to the number of free resources.

  1. 세마포를 이용해 프로세스 실행 순서 제어를 위한 동기화도 이룰 수 있습니다. ✅

Possibly the simplest use for a semaphore is signaling, which means that one thread sends a signal to another thread to indicate that something has happened. Signaling makes it possible to guarantee that a section of code in one thread will run before a section of code in another thread; in other words, it solves the
serialization problem.

In common use, “synchronization” means making two things happen at the same time. In computer systems, synchronization is a little more general; it refers to relationships among events—any number of events, and any kind of relationship (before, during, after). Computer programmers are often concerned with synchronization constraints, which are requirements pertaining to the order of events. Examples include:

  • Serialization: Event A must happen before Event B.
  • Mutual exclusion: Events A and B must not happen at the same time.
  1. 세마포를 이용하면 반드시 바쁜 대기를 해야 합니다. ❎

반드시 바쁜 대기를 할 필요는 없고, 대기 상태로 접어들게 할 수도 있다.

A useful way to think of a semaphore as used in a real-world system is as a record of how many units of a particular resource are available, coupled with operations to adjust that record safely (i.e., to avoid race conditions) as units are acquired or become free, and, if necessary, wait until a unit of the resource becomes available.

Many operating systems provide efficient semaphore primitives that unblock a waiting process when the semaphore is incremented. This means that processes do not waste time checking the semaphore value unnecessarily.

선택 미션

임계 구역

In concurrent programming, concurrent accesses to shared resources can lead to unexpected or erroneous behavior, so parts of the program where the shared resource is accessed need to be protected in ways that avoid the concurrent access. One way to do so is known as a critical section or critical region.

This protected section cannot be entered by more than one process or thread at a time; others are suspended until the first leaves the critical section.

상호 배제

In computer science, mutual exclusion is a property of concurrency control, which is instituted for the purpose of preventing race conditions.

It is the requirement that one thread of execution never enters a critical section while a concurrent thread of execution is already accessing said critical section, which refers to an interval of time during which a thread of execution accesses a shared resource or shared memory.

The requirement of mutual exclusion was first identified and solved by Edsger W. Dijkstra in his seminal 1965 paper "Solution of a problem in concurrent programming control", which is credited as the first topic in the study of concurrent algorithms.

  • A mutex is a type used to enforce mutual exclusion, i.e., a critical section
  • Mutexes are often called locks
    • To be very precise, mutexes are one kind of lock, there are others (read/write locks, reentrant locks, etc.), but we can just call them locks in this course, usually "lock" means "mutex"
  • When a thread locks a mutex
    • If the lock is unlocked the thread takes the lock and continues execution
    • If the lock is locked, the thread blocks and waits until the lock is unlocked
    • If multiple threads are waiting for a lock they all wait until lock is unlocked, one receives lock
  • When a thread unlocks a mutex
    • It continues normally; one waiting thread (if any) takes the lock and is scheduled to run

[Chapter 12 ~ 13]

Synchronization

Semaphore

In computer science, a semaphore is a variable or abstract data type used to control access to a common resource by multiple threads and avoid critical section problems in a concurrent system such as a multitasking operating system.

The semaphore concept was invented by Dutch computer scientist Edsger Dijkstra in 1962 or 1963, when Dijkstra and his team were developing an operating system for the Electrologica X8. That system eventually became known as THE multiprogramming system.

혼공컴운

#진도기본 미션선택 미션☑️
1주차
(1/2 ~ 1/7)
Chapter
01 ~ 03
p. 51의 확인 문제 3번,
p. 65의 확인 문제 3번 풀고 인증하기
p. 100의 스택과 큐의 개념을 정리하기☑️
2주차
(1/8 ~ 1/14)
Chapter
04 ~ 05
p. 125의 확인 문제 2번,
p. 155의 확인 문제 4번 풀고 인증하기
Ch.05(05-1)
코어와 스레드, 멀티 코어와 멀티 스레드의 개념을 정리하기
☑️
3주차
(1/15 ~ 1/21)
Chapter
06 ~ 08
p. 185의 확인 문제 3번,
p. 205의 확인 문제 1번 풀고 인증하기
Ch.07(07-1)
RAID의 정의와 종류를 간단히 정리해 보기
☑️
4주차
(1/22 ~ 1/28)
Chapter
09 ~ 11
p. 304의 확인 문제 1번 풀고 인증하기Ch.11(11-2)
준비 큐에 A,B,C,D 순으로 삽입되었다고 가정했을 때,
선입 선처리 스케줄링 알고리즘을 적용하면
어떤 프로세스 순서대로 CPU를 할당받는지 풀어보기
☑️
5주차
(1/29 ~ 2/4)
Chapter
12 ~ 13
p. 363의 확인 문제 1번 풀고 인증하기Ch.12(12-1)
임계 구역, 상호 배제 개념을 정리하기
☑️
6주차
(2/5 ~ 2/12)
Chapter
14 ~ 15
p. 400의 확인 문제 1번 풀고 인증하기Ch.14(14-3)
프로세스가 사용할 수 있는 프레임이 3개 있고,
페이지 참조열이 '2313523423' 일 때
LRU 페이지 교체 알고리즘으로 이 페이지를 참조한다면
몇 번의 페이지 폴트가 발생하는지 풀어보기

0개의 댓글