Study/OS

[OS] Process Description and Control I

__PS 2024. 4. 19. 00:36
728x90

Programm vs Process

- program: passive entry stored on disk (binary sequence)

- process: active entity (executin sequence) / 메모리에 올라온 상태

 

Process Control Block (PCB)

- OS에서 가장 중요한 자료 구조

- OS에서 프로세스에 필요한 정보가 포함

- 인터럽트가 발생하고 수행되었을 때 마치 발생하지 않은 것처럼 다음 프로세스를 수행하기 위한 목적

- PC, processor register (context switch)는 PCB에 저장됨.

- process마다 존재

 

1) Process Identification: PID

2) Processor State Information: Stack pointer + register information

3) Process Control Information: Process state 

 

PCB의 준비 리스트: 연결 리스트로 구현 (포인터 집합)

 

Process Image

프로세스가 수행될 때 필요한 코드, 데이터가 로드된다는 그림, stack이 별도로 allocation 되어야함, PCB도 새로 생겨야함

 

프로세스 이미지의 요소

-> 프로세스를 수행하기 위한 유저 프로그램, 코드, 스택, PCB


Process Model

 

Two - state Process Model

not running <-> running

문제점: 어떤 프로세스는 실행 준비상태, 어떤 프로세스는 I/O operation 수행 대기 상태인데,

이를 구분할 방법이 없음.

-> Time out (ready) / I/O complish event를 분리할 필요 존재

 

Five - State Process Model 

new <-> ready <-> running <-> exit

             blocked

new: OS에 의해 실행 가능한 프로세스로 승인되지 않은 상태

ready: 실행 준비 상태

running: 현재 실행 중

blocked: I/O operation의 완료와 같은 이벤트가 있기 전까지 수행할 수 없는 상태

exit: 수행 완료 / abort

 

- ready, blocked queue 존재

-> 수천개의 프로세스가 queue에 존재하므로 더 효율적인 queue가 있어야 한다.

 

Suspended Process

메인 메모리 -> 디스크

 

swapping

- lower-priority를 suspend로, higher-priority를 blocked로 전환

- suspended queue: 메인 메모리에서 일시적으로 방출된 프로세스

 

disk -> running으로 갈 수 는 없으나,

running -> disk로 갈 수 는 있음