컴퓨터(Computer Science)/운영체제(Operation System)

운영체제에서 스와핑(Swapping)

게임이 더 좋아 2020. 6. 10. 17:17
반응형
728x170

 

스와핑 이미 언급했지만 한 번 더 다뤄보자 더 ㅎㅎ

 


• A process can be swapped temporarily out of memory to a backing store, and then brought back into memory for continued execution
        Total physical memory space of processes can exceed physical memory


Backing store – fast disk large enough to accommodate copies of all memory images for all users; must provide direct access to these memory images


Roll out, roll in – swapping variant used for priority-based scheduling algorithms; lower-priority process is swapped out so higher-priority process can be loaded and executed


• Major part of swap time is transfer time; total transfer time is directly proportional to the amount of memory swapped


• System maintains a ready queue of ready-to-run processes which have memory images on disk

 

프로세스가 실행되기 위해서는 프로세스의 명령어와 명령어가 접근하는 데이터가 메모리에 있어야 한다.

그러나 프로세스 또는 프로세스의 일부분은 실행 중에 임시로 백업 저장장치(backing store)로 내보내졌다가 실행을 계속하기 위해 다시 메모리로 되돌아 올 수 있다.

 

그림을 보면 저렇게 한다는 뜻이다.

 

 

 

** 스와핑을 통해서 물리 메모리의 제약을 덜 받을 수 있고 다중 프로그래밍 정도를 높일 수 있다.(degree of multiprogramming)

 

메모리에서 나오는 것은 Swap out

메모리로 들어가는 것은 Swap in

** 메모리 기준 in and out 이다.

 


 

1.  기본적인 스와핑(standard swapping)

 

 

메인 메모리와 백업 저장장치 간에 전체 프로세스를 이동시킨다. //부분 스왑도 되는 경우 있다.

백업 저장장치는 저장 및 다시 접근해야하는 프로세스의 크기에 상관없이 수용할 수 있게 엄청 커야한다.

그리고 이러한 메모리 이미지에 직접 접근할 수 있어야 한다.

 

프로세스 또는 일부가 백업 저장장치로 스왑될 때 프로세스와 관련된 자료구조는 백업 저장장치에 기록되어야 한다.

 

표준 스와핑의 장점은

실제 물리 메모리보다 더 많은 프로세스를 수용할 수 있도록 물리 메모리가 초과 할당될 수 있다는 것이다.

유휴 또는 대부분의 시간을 유휴 상태로 보내는 프로세스가 스와핑에 적합한 후보이다.

 

**유휴 또는 대부분의 시간을 유휴 상태로 보내는 프로세스가 스와핑에 적합하다.

 

 

 


2. 페이징에서 스와핑 (swapping with paging)

 

사실 표준 스와핑은 현재는 잘 사용하지 않는 경우가 태반이다.

메모리와 저장장치 간에 프로세스 전체를 이동시키는 것이 힘들기 때문이다.

 

그래서 적은 수의 페이지만으로 이용하고는 한다.

 

 

 

 

자세한 내용은 생략

 

 


 

• Not typically supported
    Flash memory based
        Small amount of space
        Limited number of write cycles
        Poor throughput between flash memory and CPU on mobile platform


• Instead use other methods to free memory if low
    iOS asks apps to voluntarily relinquish allocated memory  
        1. Read-only data thrown out and reloaded from flash if needed
        2. Failure to free can result in termination


• Android terminates apps if low free memory, but first writes application state to flash for fast restart
• Both OSes support paging as discussed below

 

 

 

3. 모바일 시스템에서 스와핑( swapping on Mobile System)

 

 

모바일에서는 일반적으로 지원하지 않는다. 

ㅋㅋㅋㅋㅋㅋ 이러고 끝나면 ㅋㅋㅋㅋㅋ

 

**특정 상황

가용 메모리가 부족하다면 프로세스를 종료시키는 것이 가능한데, 종료하기 전 으용의 상태를 플래시 메모리에 저장하는 것으로 나중에 빠르게 재시작할 수 있게 한다.

 

 

 

반응형
그리드형