Virtual memory, paging and segmentation
도입됨
13:59
리소스, 컴파일러 및 RPN
브라우저, 음악 플레이어, 게임을 엽니다. 프로세서는 하나 — 혹은 몇 개의 코어가 있을 뿐 — 이지만 모두 동시에 실행되는 것 같습니다. 그리고 그들은 모두 더 많은 자원을 원합니다…
영어 내레이션 · 영어와 중국어 자막 전환 가능
이 수업의 내용
| English | 의미 |
|---|---|
| disk/dɪsk/ | A storage device that holds programs and data even when power is off. |
| applications/ˌæplɪˈkeɪʃnz/ | Programs designed to help users carry out particular tasks. |
| memory/ˈmeməri/ | The part of a computer that holds data and programs currently in use. |
| processor/ˈprəʊsesə/ | The component that executes instructions and performs the operations of a computer or similar system. |
| pages/ˈpeɪdʒɪz/ | 페이지 |
| virtual memory/ˈvɜːtʃuːəl ˈmeməri/ | A memory-management system that maps virtual addresses to physical storage and may move pages between RAM and secondary storage. |
| paging/ˈpeɪdʒɪŋ/ | 페이지링 |
| segmentation/ˌseɡmənˈteɪʃn/ | 세그멘테이션 |
| virtual address space/ˈvɜːtʃuːəl əˈdres speɪs/ | 가상 주소 공간 |
| process/ˈprəʊses/ | An instance of a program in execution together with its execution state and allocated resources. |
| addresses | Numbers that identify specific locations in a computer's memory. |
| OS | The software that manages a computer's hardware, memory and running programs. |
| physical RAM | The actual memory hardware that holds data and instructions currently in use. |
| physical memory | The actual memory hardware that holds data and programs currently in use. |
| frames/freɪmz/ | 프레임 |
| page table/peɪdʒ ˈteɪbl/ | 페이지 테이블 |
| hardware/ˈhɑːdweə/ | The physical parts of a computer system that can be touched. |
| page fault/peɪdʒ fɒlt/ | 페이지 폴트 |
| swap file/swɒp faɪl/ | 스왑 파일 |
| interrupt/ˈɪntərʌpt/ | A signal or event that causes the processor to suspend normal execution and run an appropriate service routine. |
| blocked/blɒkt/ | A process state in which execution waits for an event or resource, such as I/O completion, rather than merely waiting for the CPU. |
| ready state | The state of a process that can run when the processor becomes available. |
| instruction/ɪnˈstrʌkʃn/ | A command that tells the processor what action to perform. |
| thrashing/ˈθræʃɪŋ/ | 스워싱 |
| working set | The instructions and data a program is currently using or likely to need. |
| swapping | The movement of pages between physical memory and disk as they are needed. |
| disk thrashing/dɪsk ˈθræʃɪŋ/ | A state where the system spends more time moving pages than executing instructions. |
| logical segments | Parts of a program's memory that represent meaningful units and can differ in size. |
| code/kəʊd/ | Instructions written in a programming language for a computer to follow. |
| stack/stæk/ | A last-in, first-out data structure in which items are added and removed at the same end. |
| heap/hiːp/ | An area of memory used for data created while a program runs. |
| permissions | Rules that decide what a user can access or change. |
| code segment/kəʊd ˈseɡmənt/ | The part of a program's memory that holds its executable instructions. |
| access permissions | Rules that control whether a process can read, write or execute a memory segment. |
기계가 포기했음을 나타내는 디스크 라이트
- 메모리가 부족한 컴퓨터에서 너무 많은 애플리케이션을 열면 특이한 현상이 발생합니다. 시스템 전체가 거의 멈출 정도로 느려지고, 디스크 표시등은 깜박임이 멈추고 켜진 상태로 유지됩니다.
- 프로세서는 바쁘지 않습니다. 각 프로그램에 필요한 메모리가 디스크에 있어 한 페이지를 가져오면 몇 순간 후에 필요할 다른 페이지가 퇴출되기 때문입니다.
- 이 기계는 페이지를 이동하는 것 외에는 아무것도 하지 않습니다. neither 작업도, nor 충분한 메모리도 갖추어 두 가지 모두를 수행하지 못합니다.
- 이 수업의 주제는 가상 메모리이며, 페이지링과 **분할(Segmentation)**이 이를 어떻게 제공하며, 메모리를 더 크게 보이게 하는 SAME 메커니즘이 어떻게 기계를 쓸모없게 만드는지 설명합니다.
가상 주소 공간
- 각 프로세스는 자체 가상 주소 공간을 얻습니다: 0부터 시작하여 OS가 실제 데이터가 있는 곳으로 매핑하는 깨끗하고 연속적인 주소 범위입니다.
- 세 가지 결과가 따릅니다. 각 프로세스는 단순한 사적 공간을 보게 되며 다른 실행 중인 것들은 알 필요가 없습니다. 프로세스끼리는 서로 보호되며, 하나의 프로세스가 다른 프로세스의 주소에 접근할 수 없기 때문입니다. 또한 전체 사용 메모리는 물리적 RAM보다 클 수 있는데, 그 이유는 일부 데이터가 디스크에 저장되기 때문입니다.
- 이러한 격리는 편의성뿐만 아니라 보안 경계이기도 합니다.

A benefit of virtual memory is that it:
난이도 1/5 · 100코인 + 오늘 첫 완료 시 작은 보너스 추가
Virtual memory gives each process a private space and lets the working set exceed installed RAM by using disk.
What does giving each process a virtual address space achieve? Select 모든 that apply.
난이도 2/5 · 140코인 + 오늘 첫 완료 시 작은 보너스 추가
Virtual memory buys simplicity, isolation and capacity. It costs speed, since part of the memory is really on disk.
페이지링(Paging)
- 가상 공간은 고정 크기 페이지로 나뉘고, 물리적 메모리는 같은 크기의 프레임으로 나뉩니다. 페이지 테이블은 현재 각 페이지가 어떤 프레임에 저장되어 있는지 기록합니다.
- 프로세스가 주소를 사용할 때 하드웨어는 테이블에서 해당 페이지를 검색하여 프레임을 찾습니다. 만약 그 페이지가 RAM에 없다면, 이는 **페이지 결함(Page Fault)**입니다.
- 페이지 결함이 발생하면 OS는 디스크의 스왑 파일에서 페이지를 읽어와 빈 프레임에 저장합니다. 빈 프레임이 없으면 먼저 **퇴출(Evict)**해야 하며, 수정된 경우 디스크에 다시 쓰야 합니다.

표가 연결된 동일한 크기의 페이지와 프레임

In paging, memory is divided into:
난이도 1/5 · 100코인 + 오늘 첫 완료 시 작은 보너스 추가
Paging uses fixed-size pages and frames, linked by a page table. (Variable sizes are segmentation.)
A page fault occurs when:
난이도 1/5 · 100코인 + 오늘 첫 완료 시 작은 보너스 추가
The accessed page isn't in a frame, so the OS fetches it from the swap file (evicting another page if needed).
worked example: 페이지 결함 시 일어나는 일
- RAM에 없는 페이지를 포함하는 주소를 프로세스가 접근했습니다. OS가 하는 일을 설명하십시오. [4]
- 하드웨어가 페이지가 존재하지 않음을 감지하고 페이지 결함 인터럽트를 발생시키며, 프로세스는 블록(Blocked) 상태가 됩니다.
- OS는 빈 프레임(frame)을 찾습니다. 만약 없다면 페이지를 교체(replace) 할 것을 선택하며, 수정된 경우 스왑 파일(swap file)에 다시 기록합니다.
- 필요한 페이지를 스왑 파일에서 해당 프레임으로 읽어와 페이지 테이블을 업데이트합니다.
- 프로세스는 준비(Redy) 상태로 복귀하고 명령어가 재시도됩니다. 네 단계, 네 점수이며, 프로세스가 전 과정 동안 블록 상태였다는 점을 유의하십시오.
What happens on a page fault
Step through a page fault. When the program touches a page that isn't in RAM, the OS quietly fetches it from disk and updates the page table — so the program sees more memory than physically exists.
Put the OS's response to a page fault in order.
난이도 3/5 · 200코인 + 오늘 첫 완료 시 작은 보너스 추가
Detect and block, make room, load, record, retry. A page fault is the normal mechanism, not an error.
스래싱(Thrashing)
- 어떤 페이지를 교체할지 선택하는 것이 중요합니다. 잘못된 선택은 해당 페이지가 즉시 다시 필요해짐을 의미합니다.
- 실행 중인 프로세스들의 작업 세트(Working Set)에 필요한 RAM이 부족할 때, 거의 모든 접근이 페이지 결함을 유발하고, 모든 결함이 동시에 다시 필요해지는 페이지를 퇴출시킵니다.
- 시스템은 이제 거의 모든 시간을 명령어를 실행하는 대신 페이지를 스왑하는 데 보냅니다. 이것이 바로 스래싱 또는 디스크 스래싱이며, 이 수업 상단에 기술된 상태입니다.
- 해결책은 더 많은 RAM이나 더 적은 프로세스입니다. 더 빠른 프로세서는 전혀 도움이 되지 않습니다. 왜냐하면 바쁜 것은 프로세서가 아니기 때문입니다.
A machine slows almost to a stop and the disk runs constantly. What will fix it?
난이도 1/5 · 100코인 + 오늘 첫 완료 시 작은 보너스 추가
This is thrashing: nearly every access faults and the processor waits. The processor is not the busy component, so speeding it up changes nothing.
분할(Segmentation)
- **분할(Segmentation)**은 프로그램의 구조인 코드, 스택, 힙, 대용량 데이터 배열 등 변동적 크기의 논적 세그먼트로 메모리를 나눕니다.
- 세그먼트는 논적 단위이므로 자체 **권한(Permissions)**을 가질 수 있습니다: 코드 세그먼트는 읽기 전용 및 실행 가능일 수 있고, 스택은 읽기-쓰기 및 비실행 가능일 수 있습니다.
- 시험에서 원하는 대비: 페이지는 고정 크기이며 프로그램에게 의미를 가지지 않는 반면, 세그먼트는 변동적 크기로 논적 부분과 대응합니다. 많은 실제 시스템은 두 가지를 결합하여 세그먼트 내에서 페이지링을 사용합니다.

세그먼트는 프로그램의 자체 부분이지, 균등하게 쪼개진 조각이 아닙니다

Match each memory-management term to its meaning.
난이도 2/5 · 140코인 + 오늘 첫 완료 시 작은 보너스 추가
Paging = fixed pages; segmentation = logical variable units; a page fault triggers a swap; too many faults = thrashing.
Segmentation divides memory into variable-sized logical units (code, stack, heap), each with its own permissions, whereas paging uses fixed-size pages.
난이도 1/5 · 100코인 + 오늘 첫 완료 시 작은 보너스 추가
Segments match the program's logical structure; pages are uniform fixed-size blocks — some systems combine both.
Unlike pages, which are all the same size, segments are of ____ size and match the program's logical parts.
난이도 1/5 · 100코인 + 오늘 첫 완료 시 작은 보너스 추가
A segment is the code, the stack or the heap, so it can carry its own permissions. A page is a fixed-size division of virtual memory with no inherent meaning to the program.
worked example: 페이지링과 분할 비교
- 페이지링과 분할 사이의 차이점 두 가지를 서술하십시오. [2]
- 페이지는 시스템에 의해 결정되는 고정 크기이고, 세그먼트는 프로그램의 논적 부분에 의해 결정되는 변동적 크기입니다.
- 페이지는 프로그램에게 의미가 없는 순수한 물리적 구분이지만, 세그먼트는 코드나 스택과 같은 논적 단위에 대응하며 자체 접근 권한을 부여받을 수 있습니다.
- 필요할 경우 세 번째 차이: 페이지링은 할당된 마지막 페이지 내부에 사용되지 않은 공간을 남길 수 있으며, 분할은 세그먼트 사이에 사용 불가능한 공백(Gap)을 남길 수 있습니다.

놓칠 수 있는 점
- 가상 메모리는 메모리를 생성하지 않습니다. 일부를 디스크에 유지함으로써 사용 중인 총량이 물리적 RAM을 초과하게 하며, 그 대가로 디스크 접근이 발생합니다.
- 페이지 결함은 오류가 아닙니다. 페이지를 불러오는 정상적인 메커니즘입니다.
- 스래싱은 실행보다 스왑에 더 많은 시간을 보내는 것이며, 해결책은 더 많은 RAM이나 더 적은 프로세스이며 절대 더 빠른 프로세서가 아닙니다.
- 고정 크기 versus 변동적 크기, 논적으로 의미 있음이 페이지링과 분할의 차이입니다. 두 부분 모두 언급하십시오.
이해했습니다
- 가상 주소 공간은 각 프로세스에게 사적인 연속 범위를 제공하며, 프로세스들 간 보호를 보장하고 사용 중인 메모리를 물리적 RAM보다 크게 만들 수 있게 합니다.
- 페이지링: 고정 크기 페이지가 페이지 테이블에 의해 프레임에 매핑됨; 페이지 결함이 발생하면 프로세스가BLOCK되며 OS는 필요 시 페이지를 퇴출하고 스왑 파일에서 로드하며 테이블을 업데이트하고 재시도함
- 스래싱은 실행보다 스왑에 더 많은 시간을 보내는 것; 더 많은 RAM이나 더 적은 프로세스로 해결함
- **분할(segmentation)**은 프로그램의 논리적 부분과 일치하는 변형 크기(variable-sized) 세그먼트를 사용하며, 각 세그먼트는 자체 권한을 가집니다; 많은 시스템에서 세그먼트 내에서 페이지가 분할됩니다
어떤 문제가 있었나요? 사이트 팀만 이 내용을 볼 수 있습니다.