[공부정리] Process Description and Control
IT/운영체제

[공부정리] Process Description and Control

반응형

프로세스란?

- A program in execution (실행 중에 있는 프로그램)

- An instance of a program running on a computer (컴퓨터에서 실행중인 프로그램의 인스턴스)

- The entity that can be assigned to and executed on a processor (프로세서에 할당되고 실행될 수있는 엔티티)

 

프로세스 생성 이유

- 서비스를 제공하기 위해서 OS에 의해 만들어진다

- interactive login : A user at a terminal logs on to the system

- 존재하는 프로세스에 의해 만들어진다

- 사용자 요청으로 만들어진다

 

프로세스 종료 이유

- 정상종료

- 메모리 부족

- 보안 에러

- 부모 요청 (필요없어진 자식을 죽인다)

- Arithmetic error(산수 에러 ex.0으로 나누기), I/O failure, Invaild instruction 등

 

실행되지 않고 있는 프로세스

- Ready 상태

 : 실행할 준비, cpu를 받기 위해 기다리는 중

- Blocked 상태 (= wait, sleep)

 : 어떤 이벤트를 대기하는 중(I/O completion)

 

프로세스의 5가지 상태

 

Suspended Processes

- 프로세스가 디스크로 스왑(메인 메모리 -> 하드 디스크)되면 일시중지 상태가 된다.

 

이유?

 : 프로세서는 I/O 보다 빠르기 때문에 모든 프로세스들은 I/O를 기다릴 수 밖에 없다.

 : 이런 프로세스들을 디스크로 스왑하여 메모리를 절약한다

 

두 가지의 새로운 상태

: Blocked/Suspend (suspended block) : 하드 디스크에 있으면서 block된 상태

: Ready/Suspend (suspended ready) : 하드 디스크에 있으면서 ready인 상태

 

Two Suspend States

 

Process Control Block (PCB)

- 프로세스 속성들을 가지고 있다.

 : Identifier

 : State, Priority

 : Program counter

 : Memory pointers

 : Address of memory context (program code, variables)

 : I/O status information

 : Accounting information

- os가 생성하고 관리한다.

- 각 프로세스마다 하나의 PCB를 가진다.

 

Process Context

- Context : the execution environment of a program (프로그램 실행환경)

- User Context (프로세스 몸체)

 : Code - 실행될 사용자 프로그램 코드

 : Data - 프로세스의 글로벌 변수

 : User stack - Last-in-first-out (LIFO) data structure

                    - 사용자 함수를 호출하기 위한 정보를 저장하는데 사용( 지역변수, 함수의 파라미터, register value)

- System Context (운영체제가 알아서 결정하는 Context)

 : system stack (kernel stack) - 커널 함수를 호출하기 위한 정보를 저장하는데 사용

 : Process Control Block (PCB) - OS가 프로세스를 컨트롤하기 위해 필요한 데이터

 

프로세스를 전환할 때 (Context Switch)

- Termination of a process

- Expiration of time slice

- Blocking system calls

- I/O interrupt

 

반응형

'IT > 운영체제' 카테고리의 다른 글

[공부정리] Threads and Microkernels  (0) 2020.10.30
[공부정리] OS란?  (0) 2020.10.26